August 12, 2010

using interface in opengles(part2: functions)

In this parti’ll describe how you can run your interface on base of  game objects move.

Every code for running your game main windows,should be added in EAGLVIew class.

in opengles is better that you add more windows to games for performing menus and

games and etc but in this project it isn’t necessary .In project that we build before you

know that  ES1Rendere and ES2Renderer class have code for render engine in

opengles1 and opengles2 .All new Iphone device support opengles2.

Now we want control speed of colored box (see in previous project).we  add two lable

and  button to windows like this image

setspeedwin

Now we define two function increasespeed and decreasespeed and a lable with name label in EAGLView class.in EAGLView.h inside interface we add UILabel *label ;

then add

- (IBAction)increasespeed:(id)sender;
- (IBAction)decreasespeed:(id)sender;

after  interface definition Then linked two button + and – to them..Now we add some code in function .for example for decreasespeed function we add this code(is same for increasespeed )

   - (IBAction)decreasespeed:(id)sender {

label.text=@"increase";
    speed+=0.15f;
     [renderer setspeed:(speed)];
     [renderer render];// is necessary for seeing change

}

setspeed is function that should defined in ES1Renderer and ES2Renderer and

ESRenderer.in ES1Renderer and ES2Renderer after interface defination add

-(void)setspeed:(int)Speed; . do it for ESRenderer after @protocol defination.

Now in ES2Renderer.m and ES1Renderer.m add following code

-(void)setspeed:(int)Speed
{
    speed=Speed;
}

it is all you need. now see your app!

 

setspeedapp

12 comments:

ropcorn said...

Useful blog you have.

I'm not that technical, so it's always good with blogs like this for people like me :-)

I am following you now as well.

/Alexandra

dahcomputer said...

thank you Alexandra wait for your more comment also

perla said...

very interesting blog:))

dahcomputer said...

thankx perla you have nice blog too

fazrul arhan said...

Wonderful writing when you bring all the details into your post, love it DAHCOMPUTER :)

dahstar said...

thank fazrul for your comment

H. Nizam said...

Hello friend,
I have followed your blog on Google Friend Connect. Let's keep in touch.

multibrand.blogspot.com

dahstar said...

@H. Nizam i followed your blog too.thankx for follow

Samual said...

I recently found your blog and really impressed by reading it. Affiliate marketing is simply a marketing process utilised in web firms utilized for the function of transmitting visitors to distinct sites.

dahstar said...

hi @samual thanks for your comment

Alex Frisch said...

Computer animation is essentially a digital successor to the stop motion techniques used in traditional animation with 3D models and frame-by-frame animation of 2D illustrations.



Alex Frisch

Brian Linnekens said...

Great Blog! It helps me a lot to enhance my knowledge, I really like the way the writer presented his views.

Connie Jordan-Carmichael | Connie Jordan-Carmichael USA