src/video/uikit/SDL_uikitview.m
changeset 4465 3e69e077cb95
parent 3685 64ce267332c6
child 4488 6dc6a2bdd55e
equal deleted inserted replaced
4464:fa77a6429698 4465:3e69e077cb95
    45 	
    45 	
    46 #if SDL_IPHONE_KEYBOARD
    46 #if SDL_IPHONE_KEYBOARD
    47 	[self initializeKeyboard];
    47 	[self initializeKeyboard];
    48 #endif	
    48 #endif	
    49 
    49 
       
    50 #if FIXME_MULTITOUCH
    50 	int i;
    51 	int i;
    51 	for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
    52 	for (i=0; i<MAX_SIMULTANEOUS_TOUCHES; i++) {
    52         mice[i].id = i;
    53         mice[i].id = i;
    53 		mice[i].driverdata = NULL;
    54 		mice[i].driverdata = NULL;
    54 		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
    55 		SDL_AddMouse(&mice[i], "Mouse", 0, 0, 1);
    55 	}
    56 	}
    56 	self.multipleTouchEnabled = YES;
    57 	self.multipleTouchEnabled = YES;
       
    58 #endif
    57 			
    59 			
    58 	return self;
    60 	return self;
    59 
    61 
    60 }
    62 }
    61 
    63 
    62 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    64 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    63 
    65 
    64 	NSEnumerator *enumerator = [touches objectEnumerator];
    66 	NSEnumerator *enumerator = [touches objectEnumerator];
    65 	UITouch *touch =(UITouch*)[enumerator nextObject];
    67 	UITouch *touch =(UITouch*)[enumerator nextObject];
    66 	
    68 	
       
    69 #if FIXME_MULTITOUCH
    67 	/* associate touches with mice, so long as we have slots */
    70 	/* associate touches with mice, so long as we have slots */
    68 	int i;
    71 	int i;
    69 	int found = 0;
    72 	int found = 0;
    70 	for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
    73 	for(i=0; touch && i < MAX_SIMULTANEOUS_TOUCHES; i++) {
    71 	
    74 	
   102 		touch = (UITouch*)[enumerator nextObject]; 
   105 		touch = (UITouch*)[enumerator nextObject]; 
   103 		
   106 		
   104 		/* switch back to our old mouse */
   107 		/* switch back to our old mouse */
   105 		SDL_SelectMouse(oldMouse);
   108 		SDL_SelectMouse(oldMouse);
   106 		
   109 		
   107 	}	
   110 	}
       
   111 #endif
   108 }
   112 }
   109 
   113 
   110 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   114 - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
   111 	
   115 	
   112 	NSEnumerator *enumerator = [touches objectEnumerator];
   116 	NSEnumerator *enumerator = [touches objectEnumerator];
   113 	UITouch *touch=nil;
   117 	UITouch *touch=nil;
   114 	
   118 	
       
   119 #if FIXME_MULTITOUCH
   115 	while(touch = (UITouch *)[enumerator nextObject]) {
   120 	while(touch = (UITouch *)[enumerator nextObject]) {
   116 		/* search for the mouse slot associated with this touch */
   121 		/* search for the mouse slot associated with this touch */
   117 		int i, found = NO;
   122 		int i, found = NO;
   118 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
   123 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
   119 			if (mice[i].driverdata == touch) {
   124 			if (mice[i].driverdata == touch) {
   125 				/* discontinue search for this touch */
   130 				/* discontinue search for this touch */
   126 				found = YES;
   131 				found = YES;
   127 			}
   132 			}
   128 		}
   133 		}
   129 	}
   134 	}
       
   135 #endif
   130 }
   136 }
   131 
   137 
   132 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   138 - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
   133 	/*
   139 	/*
   134 		this can happen if the user puts more than 5 touches on the screen
   140 		this can happen if the user puts more than 5 touches on the screen
   141 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   147 - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
   142 	
   148 	
   143 	NSEnumerator *enumerator = [touches objectEnumerator];
   149 	NSEnumerator *enumerator = [touches objectEnumerator];
   144 	UITouch *touch=nil;
   150 	UITouch *touch=nil;
   145 	
   151 	
       
   152 #if FIXME_MULTITOUCH
   146 	while(touch = (UITouch *)[enumerator nextObject]) {
   153 	while(touch = (UITouch *)[enumerator nextObject]) {
   147 		/* try to find the mouse associated with this touch */
   154 		/* try to find the mouse associated with this touch */
   148 		int i, found = NO;
   155 		int i, found = NO;
   149 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
   156 		for (i=0; i<MAX_SIMULTANEOUS_TOUCHES && !found; i++) {
   150 			if (mice[i].driverdata == touch) {
   157 			if (mice[i].driverdata == touch) {
   155 				/* discontinue search */
   162 				/* discontinue search */
   156 				found = YES;
   163 				found = YES;
   157 			}
   164 			}
   158 		}
   165 		}
   159 	}
   166 	}
       
   167 #endif
   160 }
   168 }
   161 
   169 
   162 /*
   170 /*
   163 	---- Keyboard related functionality below this line ----
   171 	---- Keyboard related functionality below this line ----
   164 */
   172 */