August 22, 2010

codes for touch in iphone

Every user should control game easily. Game controlling can be doing with  keypress
or touch or device(in iphone and some device).Which one you like?In iphone or even
java you should use events for every user command .In  this article we  focused on
touch events and codes.

a touch can be occurred in interface that i discussed in previous article. For any touch
and interface you should define function and connection from interface to function.
if you want use button button have many touch event like touch cancel,touch
down,touch up inside and etc.With right click in button in mainwindow you’ll see
events, select one of them and connected it to window select function you create for 
button.like this image


For other part of windows you shoul add more code .A code like it can be use
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
}
with this code you can define point for your touch .
CGPoint  lastPoint;
and in part of program that you can use it for detect your finger.
CGPoint gamePoint = [touch locationInView:self.view];
you can get coordinates of point.
x=gamePoint.x;y=gamePoint.y
in next post we discussed detailed about game making and also i’ll add more source code.

8 comments:

Isha Shiri said...

Hello, thank you for follow me. Here you give interesting tips!

Very good work, cool.

dahstar said...

@isha thanks for your comment also

kelly world news said...

very good tips, following you now

bujju said...

Interesting, informative and educative. Thanks.
medical devices and gadgets

dahstar said...

@kelly thanks for follow me,i followed you too

@bujju i visit your blog and followed your blog also

bujju said...

Thanks for the great information you provided,
new emerging technologies

dahstar said...

@bujju thanks for your comment

website hostings said...

Above the topic in new one for me. I learned some new things through your blog. It's simple and excellent topic.