Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-15-2010, 07:27 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 16
Default Quartz Based Dynamic Touch Areas

I'm working on developing a version of Sudoku as seen below...



The conventional method of testing for touches in a grid like version of sudoku is relatively easy. Grid Squares can be a series of Tile objects with their touch interface defined or using a bit of math and keeping track of touch points you can find out which tile has been touched.

My problem is that I need to dynamically generate cells out of these ring segments as the number of segments reflecting different sudoku puzzles.

One method I've found is to store paths and use method CGPathContainsPoint to test if a point is stored within the path...

Code:
CGMutablePathRef myPath = CGPathCreateMutable();
    CGPathMoveToPoint   ( myPath, NULL, top.x,         top.y );
    CGPathAddLineToPoint( myPath, NULL, bottomRight.x, bottomRight.y );
    CGPathAddLineToPoint( myPath, NULL, bottomLeft.x,  bottomLeft.y );
    CGPathCloseSubpath( myPath );
    
    bool pathContainsPoint = CGPathContainsPoint( myPath, NULL, myPoint, false );
    NSLog( @"path %@ contain point", ( pathContainsPoint ? @"DOES" : @"does NOT" ));
I got this from here.

This test could correlate to points generated using touch events.

However this seems quite over complex and has a couple of problems more that I'd have to work out. Has anyone got any experience with anything like this?

Problems:

1. Generating cells in the middle of these segments dynamically.
2. The fact that the arches are drawn from outside to the centre overlapping path areas would mean the outside arch contains all of the points of the inner arches so somehow I would need to subtract these paths or use some kind of layering.

Any ideas? Alternative solutions?

Thanks.
MMan is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 235
16 members and 219 guests
ADY, Alsahir, cacao, dacapo, Dani77, Desert Diva, djohnson, F_Bryant, HemiMG, jansan, M@realobjects, MarkC, prchn4christ, smethorst, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:52 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0