istereo

diff src/EAGLView.m @ 30:8dd271942543

fixed everything
author John Tsiombikas <nuclear@mutantstargoat.com>
date Thu, 08 Sep 2011 14:52:13 +0300
parents 1bb950d0976b
children 23e5d274b2a2
line diff
     1.1 --- a/src/EAGLView.m	Thu Sep 08 08:31:15 2011 +0300
     1.2 +++ b/src/EAGLView.m	Thu Sep 08 14:52:13 2011 +0300
     1.3 @@ -24,12 +24,14 @@
     1.4  
     1.5  //The EAGL view is stored in the nib file. When it's unarchived it's sent -initWithCoder:
     1.6  - (id)initWithCoder:(NSCoder*)coder
     1.7 -{    
     1.8 +{
     1.9      if ((self = [super initWithCoder:coder]))
    1.10      {
    1.11          // Get the layer
    1.12          CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
    1.13  
    1.14 +		//self.contentScaleFactor = 2.0;
    1.15 +
    1.16          eaglLayer.opaque = TRUE;
    1.17          eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
    1.18                                          [NSNumber numberWithBool:FALSE], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil];
    1.19 @@ -59,6 +61,8 @@
    1.20          NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
    1.21          if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
    1.22              displayLinkSupported = TRUE;
    1.23 +
    1.24 +		self.multipleTouchEnabled = 1;
    1.25      }
    1.26  
    1.27      return self;
    1.28 @@ -140,6 +144,31 @@
    1.29      }
    1.30  }
    1.31  
    1.32 +static int touch_active;
    1.33 +static CGPoint start_touch;
    1.34 +extern int use_bump;
    1.35 +
    1.36 +- (void) touchesBegan: (NSSet*) touches withEvent: (UIEvent*) event
    1.37 +{
    1.38 +	UITouch *touch = [[touches allObjects] objectAtIndex: 0];
    1.39 +
    1.40 +	start_touch = [touch locationInView: self];
    1.41 +	touch_active = 1;
    1.42 +}
    1.43 +
    1.44 +- (void) touchesEnded: (NSSet*) touches withEvent: (UIEvent*) event
    1.45 +{
    1.46 +	UITouch *touch = [[touches allObjects] objectAtIndex: 0];
    1.47 +
    1.48 +	CGPoint end_touch = [touch locationInView: self];
    1.49 +	int dx = end_touch.x - start_touch.x;
    1.50 +	int dy = end_touch.y - start_touch.y;
    1.51 +
    1.52 +	if(dx * dx + dy * dy < 30) {
    1.53 +		use_bump = !use_bump;
    1.54 +	}
    1.55 +}
    1.56 +
    1.57  - (void)dealloc
    1.58  {
    1.59      [renderer release];