Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
authorJim Grandpre <jim.tla@gmail.com>
Tue, 13 Jul 2010 18:31:09 -0400
changeset 46623c4e0130c9b1
parent 4661 03dcb795c583
child 4663 56a2d70de945
child 4664 317a151b79ad
Added alternative finger tracking method. Still prefer IPHONE_TOUCH_EFFICIENT_DANGEROUS.
VisualC/SDL/SDL_VS2005.vcproj
VisualC/SDLmain/SDLmain_VS2005.vcproj
include/SDL_events.h
src/video/uikit/SDL_uikitview.h
src/video/uikit/SDL_uikitview.m
touchTest/gestureSDLTest.c
touchTest/touchPong
touchTest/touchSimp
touchTest/touchSimp.c
touchTest/touchTest.c
     1.1 --- a/VisualC/SDL/SDL_VS2005.vcproj	Mon Jul 12 21:09:23 2010 -0700
     1.2 +++ b/VisualC/SDL/SDL_VS2005.vcproj	Tue Jul 13 18:31:09 2010 -0400
     1.3 @@ -1,11 +1,18 @@
     1.4  <?xml version="1.0" encoding="Windows-1252"?>
     1.5  <VisualStudioProject
     1.6  	ProjectType="Visual C++"
     1.7 +<<<<<<< local
     1.8 +	Version="8.00"
     1.9 +=======
    1.10  	Version="9.00"
    1.11 +>>>>>>> other
    1.12  	Name="SDL"
    1.13  	ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
    1.14  	RootNamespace="SDL"
    1.15 +<<<<<<< local
    1.16 +=======
    1.17  	TargetFrameworkVersion="131072"
    1.18 +>>>>>>> other
    1.19  	>
    1.20  	<Platforms>
    1.21  		<Platform
    1.22 @@ -77,21 +84,36 @@
    1.23  			/>
    1.24  			<Tool
    1.25  				Name="VCLinkerTool"
    1.26 +<<<<<<< local
    1.27 +				AdditionalOptions="/MACHINE:I386"
    1.28 +=======
    1.29  				AdditionalOptions="/MACHINE:I386&#x0D;&#x0A;msvcrt.lib"
    1.30 +>>>>>>> other
    1.31  				AdditionalDependencies="msimg32.lib winmm.lib"
    1.32  				OutputFile=".\Debug/SDL.dll"
    1.33  				LinkIncremental="2"
    1.34  				SuppressStartupBanner="true"
    1.35 +<<<<<<< local
    1.36 +				IgnoreAllDefaultLibraries="true"
    1.37 +=======
    1.38  				IgnoreAllDefaultLibraries="false"
    1.39  				IgnoreDefaultLibraryNames=""
    1.40 +>>>>>>> other
    1.41  				GenerateDebugInformation="true"
    1.42  				ProgramDatabaseFile=".\Debug/SDL.pdb"
    1.43 +<<<<<<< local
    1.44 +				SubSystem="2"
    1.45 +=======
    1.46  				SubSystem="0"
    1.47  				RandomizedBaseAddress="1"
    1.48  				DataExecutionPrevention="0"
    1.49 +>>>>>>> other
    1.50  				ImportLibrary=".\Debug/SDL.lib"
    1.51 +<<<<<<< local
    1.52 +=======
    1.53  				Profile="true"
    1.54  				CLRThreadAttribute="0"
    1.55 +>>>>>>> other
    1.56  				CLRUnmanagedCodeCheck="false"
    1.57  			/>
    1.58  			<Tool
    1.59 @@ -113,6 +135,12 @@
    1.60  				Name="VCAppVerifierTool"
    1.61  			/>
    1.62  			<Tool
    1.63 +<<<<<<< local
    1.64 +				Name="VCWebDeploymentTool"
    1.65 +			/>
    1.66 +			<Tool
    1.67 +=======
    1.68 +>>>>>>> other
    1.69  				Name="VCPostBuildEventTool"
    1.70  			/>
    1.71  		</Configuration>
    1.72 @@ -188,8 +216,11 @@
    1.73  				IgnoreAllDefaultLibraries="true"
    1.74  				ProgramDatabaseFile=".\Release/SDL.pdb"
    1.75  				SubSystem="2"
    1.76 +<<<<<<< local
    1.77 +=======
    1.78  				RandomizedBaseAddress="1"
    1.79  				DataExecutionPrevention="0"
    1.80 +>>>>>>> other
    1.81  				ImportLibrary=".\Release/SDL.lib"
    1.82  			/>
    1.83  			<Tool
    1.84 @@ -211,6 +242,12 @@
    1.85  				Name="VCAppVerifierTool"
    1.86  			/>
    1.87  			<Tool
    1.88 +<<<<<<< local
    1.89 +				Name="VCWebDeploymentTool"
    1.90 +			/>
    1.91 +			<Tool
    1.92 +=======
    1.93 +>>>>>>> other
    1.94  				Name="VCPostBuildEventTool"
    1.95  			/>
    1.96  		</Configuration>
    1.97 @@ -943,6 +980,8 @@
    1.98  			>
    1.99  		</File>
   1.100  		<File
   1.101 +<<<<<<< local
   1.102 +=======
   1.103  			RelativePath="..\..\src\events\SDL_touch.c"
   1.104  			>
   1.105  		</File>
   1.106 @@ -951,6 +990,7 @@
   1.107  			>
   1.108  		</File>
   1.109  		<File
   1.110 +>>>>>>> other
   1.111  			RelativePath="..\..\src\video\SDL_video.c"
   1.112  			>
   1.113  		</File>
     2.1 --- a/VisualC/SDLmain/SDLmain_VS2005.vcproj	Mon Jul 12 21:09:23 2010 -0700
     2.2 +++ b/VisualC/SDLmain/SDLmain_VS2005.vcproj	Tue Jul 13 18:31:09 2010 -0400
     2.3 @@ -1,10 +1,17 @@
     2.4  <?xml version="1.0" encoding="Windows-1252"?>
     2.5  <VisualStudioProject
     2.6  	ProjectType="Visual C++"
     2.7 +<<<<<<< local
     2.8 +	Version="8.00"
     2.9 +=======
    2.10  	Version="9.00"
    2.11 +>>>>>>> other
    2.12  	Name="SDLmain"
    2.13  	ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
    2.14 +<<<<<<< local
    2.15 +=======
    2.16  	TargetFrameworkVersion="131072"
    2.17 +>>>>>>> other
    2.18  	>
    2.19  	<Platforms>
    2.20  		<Platform
    2.21 @@ -26,7 +33,11 @@
    2.22  			<Tool
    2.23  				Name="VCPreBuildEventTool"
    2.24  				Description="Making sure basic SDL headers are in place..."
    2.25 +<<<<<<< local
    2.26 +				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY"
    2.27 +=======
    2.28  				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
    2.29 +>>>>>>> other
    2.30  			/>
    2.31  			<Tool
    2.32  				Name="VCCustomBuildTool"
    2.33 @@ -99,7 +110,11 @@
    2.34  			<Tool
    2.35  				Name="VCPreBuildEventTool"
    2.36  				Description="Making sure basic SDL headers are in place..."
    2.37 +<<<<<<< local
    2.38 +				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY"
    2.39 +=======
    2.40  				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
    2.41 +>>>>>>> other
    2.42  			/>
    2.43  			<Tool
    2.44  				Name="VCCustomBuildTool"
    2.45 @@ -172,7 +187,11 @@
    2.46  			<Tool
    2.47  				Name="VCPreBuildEventTool"
    2.48  				Description="Making sure basic SDL headers are in place..."
    2.49 +<<<<<<< local
    2.50 +				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY"
    2.51 +=======
    2.52  				CommandLine="if exist &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot; goto SDLCONFIGOKAY&#x0D;&#x0A;echo Copying SDL_config_win32.h to SDL_config.h...&#x0D;&#x0A;copy &quot;$(ProjectDir)\..\..\include\SDL_config_win32.h&quot; &quot;$(ProjectDir)\..\..\include\SDL_config.h&quot;&#x0D;&#x0A;:SDLCONFIGOKAY&#x0D;&#x0A;&#x0D;&#x0A;if exist &quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot; goto SDLREVISIONOKAY&#x0D;&#x0A;echo Creating stub SDL_revision.h file...&#x0D;&#x0A;echo #define SDL_REVISION 0 &gt;&quot;$(ProjectDir)\..\..\include\SDL_revision.h&quot;&#x0D;&#x0A;:SDLREVISIONOKAY&#x0D;&#x0A;"
    2.53 +>>>>>>> other
    2.54  			/>
    2.55  			<Tool
    2.56  				Name="VCCustomBuildTool"
     3.1 --- a/include/SDL_events.h	Mon Jul 12 21:09:23 2010 -0700
     3.2 +++ b/include/SDL_events.h	Tue Jul 13 18:31:09 2010 -0400
     3.3 @@ -105,6 +105,7 @@
     3.4      SDL_MULTIGESTURE,
     3.5  
     3.6      /* Clipboard events */
     3.7 +
     3.8      SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */
     3.9  
    3.10      /* Obsolete events */
     4.1 --- a/src/video/uikit/SDL_uikitview.h	Mon Jul 12 21:09:23 2010 -0700
     4.2 +++ b/src/video/uikit/SDL_uikitview.h	Tue Jul 13 18:31:09 2010 -0400
     4.3 @@ -13,8 +13,7 @@
     4.4      Lesser General Public License for more details.
     4.5  
     4.6      You should have received a copy of the GNU Lesser General Public
     4.7 -    License along with this library; if not, write to the Free Software
     4.8 -    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
     4.9 +    License along with this library; if not, write to the Free Software    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    4.10  
    4.11      Sam Lantinga
    4.12      slouken@libsdl.org
    4.13 @@ -24,10 +23,8 @@
    4.14  #include "SDL_stdinc.h"
    4.15  #include "SDL_events.h"
    4.16  
    4.17 -#if SDL_IPHONE_MULTIPLE_MICE
    4.18 +#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    4.19  #define MAX_SIMULTANEOUS_TOUCHES 5
    4.20 -#else
    4.21 -#define MAX_SIMULTANEOUS_TOUCHES 1
    4.22  #endif
    4.23  
    4.24  /* *INDENT-OFF* */
    4.25 @@ -39,6 +36,9 @@
    4.26  
    4.27  #if FIXED_MULTITOUCH
    4.28  	int touchId;
    4.29 +#ifndef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    4.30 +	UITouch *finger[MAX_SIMULTANEOUS_TOUCHES];
    4.31 +#endif
    4.32  #endif
    4.33  
    4.34  #if SDL_IPHONE_KEYBOARD
     5.1 --- a/src/video/uikit/SDL_uikitview.m	Mon Jul 12 21:09:23 2010 -0700
     5.2 +++ b/src/video/uikit/SDL_uikitview.m	Tue Jul 13 18:31:09 2010 -0400
     5.3 @@ -91,9 +91,30 @@
     5.4  #if FIXED_MULTITOUCH
     5.5  	while(touch) {
     5.6  	  CGPoint locationInView = [touch locationInView: self];
     5.7 -	  SDL_SendFingerDown(touchId,(int)touch,
     5.8 +
     5.9 +
    5.10 +#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    5.11 +	  //FIXME: TODO: Using touch as the fingerId is potentially dangerous
    5.12 +	  //It is also much more efficient than storing the UITouch pointer
    5.13 +	  //and comparing it to the incoming event.
    5.14 +	  SDL_SendFingerDown(touchId,(long)touch,
    5.15  			     SDL_TRUE,locationInView.x,locationInView.y,
    5.16  			     1);
    5.17 +#else
    5.18 +	  int i;
    5.19 +	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
    5.20 +	    if(finger[i] == NULL) {
    5.21 +	      finger[i] = touch;
    5.22 +	      SDL_SendFingerDown(touchId,i,
    5.23 +				 SDL_TRUE,locationInView.x,locationInView.y,
    5.24 +				 1);
    5.25 +	      break;
    5.26 +	    }
    5.27 +	  }
    5.28 +#endif
    5.29 +	  
    5.30 +
    5.31 +	  
    5.32  
    5.33  	  touch = (UITouch*)[enumerator nextObject]; 
    5.34  	}
    5.35 @@ -113,9 +134,23 @@
    5.36  #if FIXED_MULTITOUCH
    5.37  	while(touch) {
    5.38  	  CGPoint locationInView = [touch locationInView: self];
    5.39 -	  SDL_SendFingerDown(touchId,(int)touch,
    5.40 +	  
    5.41 +
    5.42 +#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    5.43 +	  SDL_SendFingerDown(touchId,(long)touch,
    5.44  			     SDL_FALSE,locationInView.x,locationInView.y,
    5.45  			     1);
    5.46 +#else
    5.47 +	  int i;
    5.48 +	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
    5.49 +	    if(finger[i] == touch) {
    5.50 +	      SDL_SendFingerDown(touchId,i,
    5.51 +				 SDL_FALSE,locationInView.x,locationInView.y,
    5.52 +				 1);
    5.53 +	      break;
    5.54 +	    }
    5.55 +	  }
    5.56 +#endif
    5.57  
    5.58  	  touch = (UITouch*)[enumerator nextObject]; 
    5.59  	}
    5.60 @@ -146,9 +181,23 @@
    5.61  #if FIXED_MULTITOUCH
    5.62  	while(touch) {
    5.63  	  CGPoint locationInView = [touch locationInView: self];
    5.64 -	  SDL_SendTouchMotion(touchId,(int)touch,
    5.65 -			     SDL_FALSE,locationInView.x,locationInView.y,
    5.66 -			     1);
    5.67 +	  
    5.68 +
    5.69 +#ifdef IPHONE_TOUCH_EFFICIENT_DANGEROUS
    5.70 +	  SDL_SendTouchMotion(touchId,(long)touch,
    5.71 +			      SDL_FALSE,locationInView.x,locationInView.y,
    5.72 +			      1);
    5.73 +#else
    5.74 +	  int i;
    5.75 +	  for(i = 0;i < MAX_SIMULTANEOUS_TOUCHES;i++) {
    5.76 +	    if(finger[i] == touch) {
    5.77 +	      SDL_SendTouchMotion(touchId,i,
    5.78 +				  SDL_FALSE,locationInView.x,locationInView.y,
    5.79 +				  1);
    5.80 +	      break;
    5.81 +	    }
    5.82 +	  }
    5.83 +#endif
    5.84  
    5.85  	  touch = (UITouch*)[enumerator nextObject]; 
    5.86  	}
     6.1 --- a/touchTest/gestureSDLTest.c	Mon Jul 12 21:09:23 2010 -0700
     6.2 +++ b/touchTest/gestureSDLTest.c	Tue Jul 13 18:31:09 2010 -0400
     6.3 @@ -11,7 +11,7 @@
     6.4  #define BPP 4
     6.5  #define DEPTH 32
     6.6  
     6.7 -#define MAXFINGERS 3
     6.8 +#define MAXFINGERS 5
     6.9  
    6.10  #define DOLLARNPOINTS 64
    6.11  #define DOLLARSIZE 256
     7.1 Binary file touchTest/touchPong has changed
     8.1 Binary file touchTest/touchSimp has changed
     9.1 --- a/touchTest/touchSimp.c	Mon Jul 12 21:09:23 2010 -0700
     9.2 +++ b/touchTest/touchSimp.c	Tue Jul 13 18:31:09 2010 -0400
     9.3 @@ -12,7 +12,7 @@
     9.4  #define DEPTH 32
     9.5  
     9.6  
     9.7 -#define MAX_FINGERS 2
     9.8 +#define MAX_FINGERS 5
     9.9  
    9.10  int mousx,mousy;
    9.11  int keystat[512];
    10.1 --- a/touchTest/touchTest.c	Mon Jul 12 21:09:23 2010 -0700
    10.2 +++ b/touchTest/touchTest.c	Tue Jul 13 18:31:09 2010 -0400
    10.3 @@ -11,7 +11,7 @@
    10.4  #define BPP 4
    10.5  #define DEPTH 32
    10.6  
    10.7 -#define MAXFINGERS 3
    10.8 +#define MAXFINGERS 5
    10.9  
   10.10  int mousx,mousy;
   10.11  int keystat[512];