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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 02-12-2010, 09:18 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 3
homojedi is on a distinguished road
Default UIView touch problems

im currently trying to get touch responding in my game however although the code picks up the touch event when i try to use the hash key value for the touch it always comes in as the value 1 so when this function occurs

Code:
- (void)touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event {
	
	[touchDelegate touchesBegan:touches withEvent:event];
        //when i go to use [touches hash] the value returned is always 1?
}
this baffles me and obviously i cant do anything with it, i can only assume its the way the view and window are set up, and at the moment im using someone else's engine so im not to sure what it could be exactly but i have a feeling the error is in that area. Code of how the window is as follows

Code:
//
//  EAGLView.m
//  Game
//
//  Created by Richard Henry on 16/11/2009.
//  Copyright University of Teesside 2009. All rights reserved.
//

#import "DSGLView.h"
#import "DSES1DrawContext.h"
#import "DSES2DrawContext.h"


@implementation DSGLView

+ (Class)layerClass { return [CAEAGLLayer class]; }

- (id)initWithCoder: (NSCoder*)coder {
	
	// The GL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:

    if ((self = [super initWithCoder:coder])) {
		
        // Get the layer
        CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
        
        eaglLayer.opaque = YES;
        eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
		
#ifdef __IPHONE_3_0
		
		BOOL tryES2 = YES;
		
		// Initialise a draw context
		if (!tryES2 || !(drawContext = [[DSES2DrawContext alloc] init])) {
			
			if (!(drawContext = [[DSES1DrawContext alloc] init])) { [self autorelease]; return nil; }
		}
		
#else
		
		// Initialise a draw context
		if (!(drawContext = [[DSES1DrawContext alloc] init])) { [self autorelease]; return nil; }
		
#endif
		
    }
	
    return self;
}

- (void)layoutSubviews {
	
	[drawContext attachFramebuffer:(CAEAGLLayer*)self.layer];
}

- (void)dealloc {
	
    [drawContext release];
	
    [super dealloc];
}

#pragma mark Touch handling

- (void)touchesBegan: (NSSet *)touches withEvent: (UIEvent *)event {
	
	[touchDelegate touchesBegan:touches withEvent:event];
}

- (void)touchesMoved: (NSSet *)touches withEvent: (UIEvent *)event {
	
	[touchDelegate touchesMoved:touches withEvent:event];
}

- (void)touchesEnded: (NSSet *)touches withEvent: (UIEvent *)event {
	
	[touchDelegate touchesEnded:touches withEvent:event];
}

- (void)touchesCancelled: (NSSet *)touches withEvent: (UIEvent *)event {
	
	[touchDelegate touchesCancelled:touches withEvent:event];
}


@synthesize touchDelegate;
@synthesize drawContext;

@end
ive been told initWithCoder comes with some issues.
Any suggestions?
homojedi 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: 398
7 members and 391 guests
13dario13, iOS.Lover, jeroenkeij, Leslie80, Wikiboo, Yosh_K
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,670
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Yosh_K
Powered by vBadvanced CMPS v3.1.0

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