Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

August 7, 2010

using interface in opengles (part 1)

in this tutorial  i’ll describe opengles template that using in game developing and add interface to it.You can use text and image and etc without any coding in iphone games.Just for more change in text and images in during  game you need coding. first we create new project in Xcode and select opengles template like this image

opengl  

then select name for project .i select “test” for my project you can select another.

Xcode opened window like this image for you that you see test project and folders of it.

testproject

As you see test have 6 folder (classes,shaders,other sources,resources,frameworks and products).In resource you can see MainWindow.xib (is main topic of post).Select window .You can add some text and images and other library .see this image

window

In opengles codes forced some change in main window after run it.With any code you

can change interfaces also .after run your program you can see this window like it.

labelopengl

i add label(my game 1)to opengles sample project that you see.you can chage font and size of text and others that you want.

Read more »

August 4, 2008

Advanced programming II: images and text

Advanced programming II: images and text

Now we want focusing on making better game. For better game we need some text for showing score and some images for maps and other thing and at last a better graphics for getting your game more reality .

In design of 3d models you need getting texture from building and objects that you want to use in game. Some texture maybe force to distortion your model and even maybe you can’t see anything. And of course more high graphics texture and models may not be seen well in some old phone. For example when you download this game for p990 sonny erricson you see a picture like it


But when you want to download it for k750 from same company (sonny ericsson) you will see some graphics problem and maybe even you can’t see some models in older phones.

Add text and images and some functions

You can add text and images to your games with Graphics class and bind Graphics3D to it .You should add text and images to graphics after bind it to Graphics3D . it is an example code

g3d.bindTarget(graphics,true,Graphics3D.ANTIALIAS|

Graphics3D.TRUE_COLOR);

g3d.render(_world);

g3d.releaseTarget();

graphics.setColor(0x990000);

graphics.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE));

graphics.drawString("corner", 90, 150,

Graphics.TOP | Graphics.RIGHT);


In first code we bind target graphics(from Graphics class) to g3d(from Graphics3D) and in second line we render my world class . After release your g3d object you can change your graphics object and add image or add text .For add text I use three line for set color and font and text.

Add images is like that and only you need add function drawimage and image object to your code.This image can be maps or character picture or other thing.You can add some function also to your program for controlling move of cameras or objects in your game.I add a sample code for this porpose.

if(y>-20)

Y=-20;

With this code camera will be stopped if it reached to left wall.In 3ds max wall y position was 20 and

Camera will be moved to Y with this code

camera.setTranslation(X, Y, Z);

You can see more in this project


download project
Read more »