Commit 9610eb78 authored by Jim Grandpre's avatar Jim Grandpre

Just updated

parents 9452f337 cc8ad7be
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C++ Express 2005 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
......
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="9.00"
Name="SDL" Name="SDL"
ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}" ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
RootNamespace="SDL" RootNamespace="SDL"
TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
<Platform <Platform
...@@ -76,16 +77,21 @@ ...@@ -76,16 +77,21 @@
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386" AdditionalOptions="/MACHINE:I386&#x0D;&#x0A;msvcrt.lib"
AdditionalDependencies="msimg32.lib winmm.lib" AdditionalDependencies="msimg32.lib winmm.lib"
OutputFile=".\Debug/SDL.dll" OutputFile=".\Debug/SDL.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
IgnoreAllDefaultLibraries="true" IgnoreAllDefaultLibraries="false"
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/SDL.pdb" ProgramDatabaseFile=".\Debug/SDL.pdb"
SubSystem="2" SubSystem="0"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Debug/SDL.lib" ImportLibrary=".\Debug/SDL.lib"
Profile="true"
CLRThreadAttribute="0"
CLRUnmanagedCodeCheck="false" CLRUnmanagedCodeCheck="false"
/> />
<Tool <Tool
...@@ -106,9 +112,6 @@ ...@@ -106,9 +112,6 @@
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool
Name="VCWebDeploymentTool"
/>
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
...@@ -185,6 +188,8 @@ ...@@ -185,6 +188,8 @@
IgnoreAllDefaultLibraries="true" IgnoreAllDefaultLibraries="true"
ProgramDatabaseFile=".\Release/SDL.pdb" ProgramDatabaseFile=".\Release/SDL.pdb"
SubSystem="2" SubSystem="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
ImportLibrary=".\Release/SDL.lib" ImportLibrary=".\Release/SDL.lib"
/> />
<Tool <Tool
...@@ -205,9 +210,6 @@ ...@@ -205,9 +210,6 @@
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool
Name="VCWebDeploymentTool"
/>
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
...@@ -928,6 +930,14 @@ ...@@ -928,6 +930,14 @@
RelativePath="..\..\src\timer\SDL_timer_c.h" RelativePath="..\..\src\timer\SDL_timer_c.h"
> >
</File> </File>
<File
RelativePath="..\..\src\events\SDL_touch.c"
>
</File>
<File
RelativePath="..\..\src\events\SDL_touch_c.h"
>
</File>
<File <File
RelativePath="..\..\src\video\SDL_video.c" RelativePath="..\..\src\video\SDL_video.c"
> >
......
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8.00" Version="9.00"
Name="SDLmain" Name="SDLmain"
ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}" ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
<Platform <Platform
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
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" 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;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -98,7 +99,7 @@ ...@@ -98,7 +99,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
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" 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;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
...@@ -171,7 +172,7 @@ ...@@ -171,7 +172,7 @@
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
Description="Making sure basic SDL headers are in place..." Description="Making sure basic SDL headers are in place..."
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" 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;"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
......
...@@ -41,8 +41,6 @@ extern "C" { ...@@ -41,8 +41,6 @@ extern "C" {
/* *INDENT-ON* */ /* *INDENT-ON* */
#endif #endif
typedef struct SDL_Touch SDL_Touch;
typedef struct SDL_Finger SDL_Finger;
struct SDL_Finger { struct SDL_Finger {
int id; int id;
...@@ -55,9 +53,11 @@ struct SDL_Finger { ...@@ -55,9 +53,11 @@ struct SDL_Finger {
int pressure; int pressure;
}; };
typedef struct SDL_Touch SDL_Touch;
typedef struct SDL_Finger SDL_Finger;
struct SDL_Touch struct SDL_Touch {
{
/* Free the touch when it's time */ /* Free the touch when it's time */
void (*FreeTouch) (SDL_Touch * touch); void (*FreeTouch) (SDL_Touch * touch);
...@@ -87,6 +87,7 @@ struct SDL_Touch ...@@ -87,6 +87,7 @@ struct SDL_Touch
}; };
/* Function prototypes */ /* Function prototypes */
/** /**
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "SDL_events_c.h" #include "SDL_events_c.h"
#include "../video/SDL_sysvideo.h" #include "../video/SDL_sysvideo.h"
#include <stdio.h>
static int SDL_num_touch = 0; static int SDL_num_touch = 0;
static SDL_Touch **SDL_touchPads = NULL; static SDL_Touch **SDL_touchPads = NULL;
...@@ -99,9 +101,7 @@ int ...@@ -99,9 +101,7 @@ int
SDL_AddTouch(const SDL_Touch * touch, char *name) SDL_AddTouch(const SDL_Touch * touch, char *name)
{ {
SDL_Touch **touchPads; SDL_Touch **touchPads;
int selected_touch; int index,length;
int index;
size_t length;
if (SDL_GetTouchIndexId(touch->id) != -1) { if (SDL_GetTouchIndexId(touch->id) != -1) {
SDL_SetError("Touch ID already in use"); SDL_SetError("Touch ID already in use");
...@@ -252,7 +252,6 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger) ...@@ -252,7 +252,6 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
{ {
int index; int index;
SDL_Finger **fingers; SDL_Finger **fingers;
size_t length;
//printf("Adding Finger...\n"); //printf("Adding Finger...\n");
if (SDL_GetFingerIndexId(touch,finger->id) != -1) { if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
SDL_SetError("Finger ID already in use"); SDL_SetError("Finger ID already in use");
...@@ -260,19 +259,18 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger) ...@@ -260,19 +259,18 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
/* Add the touch to the list of touch */ /* Add the touch to the list of touch */
if(touch->num_fingers >= touch->max_fingers){ if(touch->num_fingers >= touch->max_fingers){
printf("Making room for it!\n"); //printf("Making room for it!\n");
fingers = (SDL_Finger **) SDL_realloc(touch->fingers, fingers = (SDL_Finger **) SDL_realloc(touch->fingers,
(touch->num_fingers + 1) * sizeof(SDL_Finger *)); (touch->num_fingers + 1) * sizeof(SDL_Finger *));
touch->max_fingers = touch->num_fingers+1; touch->max_fingers = touch->num_fingers+1;
if (!fingers) { if (!fingers) {
SDL_OutOfMemory(); SDL_OutOfMemory();
return -1; return -1;
} } else {
else { touch->max_fingers = touch->num_fingers+1;
touch->max_fingers = touch->num_fingers+1; touch->fingers = fingers;
touch->fingers = fingers; }
} }
}
index = touch->num_fingers; index = touch->num_fingers;
//printf("Max_Fingers: %i Index: %i\n",touch->max_fingers,index); //printf("Max_Fingers: %i Index: %i\n",touch->max_fingers,index);
...@@ -295,13 +293,14 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid) ...@@ -295,13 +293,14 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid)
SDL_Finger* finger = SDL_GetFinger(touch,fingerid); SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
if (!finger) { if (!finger) {
return; return -1;
} }
SDL_free(finger); SDL_free(finger);
touch->num_fingers--; touch->num_fingers--;
touch->fingers[index] = touch->fingers[touch->num_fingers]; touch->fingers[index] = touch->fingers[touch->num_fingers];
return 0;
} }
...@@ -370,79 +369,80 @@ SDL_SendTouchMotion(int id, int fingerid, int relative, ...@@ -370,79 +369,80 @@ SDL_SendTouchMotion(int id, int fingerid, int relative,
return 0; return 0;
} }
if(finger == NULL) if(finger == NULL) {
SDL_SendFingerDown(id,fingerid,SDL_TRUE,x,y,pressure); SDL_SendFingerDown(id,fingerid,SDL_TRUE,x,y,pressure);
else { return 0;
/* the relative motion is calculated regarding the last position */
if (relative) {
xrel = x;
yrel = y;
x = (finger->last_x + x);
y = (finger->last_y + y);
} else { } else {
if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/ /* the relative motion is calculated regarding the last position */
if(y < 0) y = finger->last_y; /*The other is marked as -1*/ if (relative) {
if(pressure < 0) pressure = finger->last_pressure; xrel = x;
xrel = x - finger->last_x; yrel = y;
yrel = y - finger->last_y; x = (finger->last_x + x);
} y = (finger->last_y + y);
} else {
/* Drop events that don't change state */ if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/
if (!xrel && !yrel) { if(y < 0) y = finger->last_y; /*The other is marked as -1*/
#if 0 if(pressure < 0) pressure = finger->last_pressure;
printf("Touch event didn't change state - dropped!\n"); xrel = x - finger->last_x;
#endif yrel = y - finger->last_y;
return 0; }
}
/* Drop events that don't change state */
/* Update internal touch coordinates */ if (!xrel && !yrel) {
#if 0
finger->x = x; printf("Touch event didn't change state - dropped!\n");
finger->y = y; #endif
return 0;
/*Should scale to window? Normalize? Maintain Aspect?*/ }
//SDL_GetWindowSize(touch->focus, &x_max, &y_max);
/* Update internal touch coordinates */
/* make sure that the pointers find themselves inside the windows */
/* only check if touch->xmax is set ! */ finger->x = x;
/* finger->y = y;
if (x_max && touch->x > x_max) {
touch->x = x_max; /*Should scale to window? Normalize? Maintain Aspect?*/
} else if (touch->x < 0) { //SDL_GetWindowSize(touch->focus, &x_max, &y_max);
touch->x = 0;
} /* make sure that the pointers find themselves inside the windows */
/* only check if touch->xmax is set ! */
if (y_max && touch->y > y_max) { /*
touch->y = y_max; if (x_max && touch->x > x_max) {
} else if (touch->y < 0) { touch->x = x_max;
touch->y = 0; } else if (touch->x < 0) {
} touch->x = 0;
*/ }
finger->xdelta = xrel;
finger->ydelta = yrel; if (y_max && touch->y > y_max) {
finger->pressure = pressure; touch->y = y_max;
} else if (touch->y < 0) {
touch->y = 0;
}
/* Post the event, if desired */ */
posted = 0; finger->xdelta = xrel;
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) { finger->ydelta = yrel;
SDL_Event event; finger->pressure = pressure;
event.tfinger.type = SDL_FINGERMOTION;
event.tfinger.touchId = (Uint8) id;
event.tfinger.fingerId = (Uint8) fingerid;
event.tfinger.x = x; /* Post the event, if desired */
event.tfinger.y = y; posted = 0;
event.tfinger.pressure = pressure; if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
event.tfinger.state = touch->buttonstate; SDL_Event event;
event.tfinger.windowID = touch->focus ? touch->focus->id : 0; event.tfinger.type = SDL_FINGERMOTION;
posted = (SDL_PushEvent(&event) > 0); event.tfinger.touchId = (Uint8) id;
event.tfinger.fingerId = (Uint8) fingerid;
event.tfinger.x = x;
event.tfinger.y = y;
event.tfinger.pressure = pressure;
event.tfinger.state = touch->buttonstate;
event.tfinger.windowID = touch->focus ? touch->focus->id : 0;
posted = (SDL_PushEvent(&event) > 0);
}
finger->last_x = finger->x;
finger->last_y = finger->y;
finger->last_pressure = finger->pressure;
return posted;
} }
finger->last_x = finger->x;
finger->last_y = finger->y;
finger->last_pressure = finger->pressure;
return posted;
}
} }
int int
SDL_SendTouchButton(int id, Uint8 state, Uint8 button) SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
...@@ -483,7 +483,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button) ...@@ -483,7 +483,7 @@ SDL_SendTouchButton(int id, Uint8 state, Uint8 button)
if (SDL_GetEventState(type) == SDL_ENABLE) { if (SDL_GetEventState(type) == SDL_ENABLE) {
SDL_Event event; SDL_Event event;
event.type = type; event.type = type;
event.tbutton.touchId = (Uint8) index; event.tbutton.touchId = (Uint8) touch->id;
event.tbutton.state = state; event.tbutton.state = state;
event.tbutton.button = button; event.tbutton.button = button;
event.tbutton.windowID = touch->focus ? touch->focus->id : 0; event.tbutton.windowID = touch->focus ? touch->focus->id : 0;
......
...@@ -64,8 +64,11 @@ extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button); ...@@ -64,8 +64,11 @@ extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
/* Shutdown the touch subsystem */ /* Shutdown the touch subsystem */
extern void SDL_TouchQuit(void); extern void SDL_TouchQuit(void);
/* FIXME: Where do these functions go in this header? */ /* Get the index of a touch device */
extern void SDL_ChangeEnd(int id, int end); extern int SDL_GetTouchIndexId(int id);
#endif /* _SDL_touch_c_h */ #endif /* _SDL_touch_c_h */
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
slouken@libsdl.org slouken@libsdl.org
*/ */
#if (_WIN32_WINNT < 0x0501) #if (_WIN32_WINNT < 0x601)
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x601
#endif #endif
#include "SDL_config.h" #include "SDL_config.h"
...@@ -32,11 +32,14 @@ ...@@ -32,11 +32,14 @@
#include "SDL_vkeys.h" #include "SDL_vkeys.h"
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
/*#define WMMSG_DEBUG*/
#define WMMSG_DEBUG
#ifdef WMMSG_DEBUG #ifdef WMMSG_DEBUG
#include <stdio.h> #include <stdio.h>
#include "wmmsg.h" #include "wmmsg.h"
#endif #endif
//#include <stdio.h>
/* Masks for processing the windows KEYDOWN and KEYUP messages */ /* Masks for processing the windows KEYDOWN and KEYUP messages */
#define REPEATED_KEYMASK (1<<30) #define REPEATED_KEYMASK (1<<30)
...@@ -125,9 +128,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -125,9 +128,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (!data) { if (!data) {
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
} }
#ifdef WMMSG_DEBUG #ifdef WMMSG_DEBUG
{ {
FILE *log = fopen("wmmsg.txt", "a"); FILE *log = fopen("wmmsg.txt", "a");
fprintf(log, "Received windows message: %p ", hwnd); fprintf(log, "Received windows message: %p ", hwnd);
if (msg > MAX_WMMSG) { if (msg > MAX_WMMSG) {
fprintf(log, "%d", msg); fprintf(log, "%d", msg);
...@@ -643,7 +647,39 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ...@@ -643,7 +647,39 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
} }
returnCode = 0; returnCode = 0;
break; break;
} case WM_TOUCH:
{
//printf("Got Touch Event!\n");
FILE *log = fopen("wmmsg.txt", "a");
fprintf(log, "Received Touch Message: %p ", hwnd);
if (msg > MAX_WMMSG) {
fprintf(log, "%d", msg);
} else {
fprintf(log, "%s", wmtab[msg]);
}
fprintf(log, "WM_TOUCH = %d -- 0x%X, 0x%X\n",msg, wParam, lParam);
fclose(log);
}
break;
case WM_GESTURE:
{
//printf("Got Touch Event!\n");
FILE *log = fopen("wmmsg.txt", "a");
fprintf(log, "Received Gesture Message: %p ", hwnd);
if (msg > MAX_WMMSG) {
fprintf(log, "%d", msg);
} else {
fprintf(log, "%s", wmtab[msg]);
}
fprintf(log, "WM_GESTURE = %d -- 0x%X, 0x%X\n",msg, wParam, lParam);
fclose(log);
}
break;
}
/* If there's a window proc, assume it's going to handle messages */ /* If there's a window proc, assume it's going to handle messages */
if (data->wndproc) { if (data->wndproc) {
......
...@@ -30,7 +30,14 @@ ...@@ -30,7 +30,14 @@
#define STRICT #define STRICT
#define UNICODE #define UNICODE
#undef WINVER #undef WINVER
#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */ //#define WINVER 0x500 /* Need 0x410 for AlphaBlend() and 0x500 for EnumDisplayDevices() */
#define WINVER 0x601 /* Need 0x600 (_WIN32_WINNT_WIN7) for WM_Touch */
#if (_WIN32_WINNT < 0x601)
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x601
#endif
#include <windows.h> #include <windows.h>
#if SDL_VIDEO_RENDER_D3D #if SDL_VIDEO_RENDER_D3D
......
...@@ -256,7 +256,8 @@ WIN_CreateWindow(_THIS, SDL_Window * window) ...@@ -256,7 +256,8 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
WIN_SetError("Couldn't create window"); WIN_SetError("Couldn't create window");
return -1; return -1;
} }
/*Disable Tablet support, replace with multi-touch.*/
#if 0
/* we're configuring the tablet data. See Wintab reference for more info */ /* we're configuring the tablet data. See Wintab reference for more info */
if (videodata->wintabDLL if (videodata->wintabDLL
&& videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) { && videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) {
...@@ -290,6 +291,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window) ...@@ -290,6 +291,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
} }
g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE); g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
} }
#else
//RegisterTouchWindow(hwnd, 0);
#endif
#ifndef _WIN32_WCE /* has no RawInput */ #ifndef _WIN32_WCE /* has no RawInput */
/* we're telling the window, we want it to report raw input events from mice */ /* we're telling the window, we want it to report raw input events from mice */
Rid.usUsagePage = 0x01; Rid.usUsagePage = 0x01;
......
...@@ -283,7 +283,7 @@ char *wmtab[] = { ...@@ -283,7 +283,7 @@ char *wmtab[] = {
"WM_INITMENU", "WM_INITMENU",
"WM_INITMENUPOPUP", "WM_INITMENUPOPUP",
"UNKNOWN (280)", "UNKNOWN (280)",
"UNKNOWN (281)", "WM_GESTURE",
"UNKNOWN (282)", "UNKNOWN (282)",
"UNKNOWN (283)", "UNKNOWN (283)",
"UNKNOWN (284)", "UNKNOWN (284)",
...@@ -578,7 +578,7 @@ char *wmtab[] = { ...@@ -578,7 +578,7 @@ char *wmtab[] = {
"UNKNOWN (573)", "UNKNOWN (573)",
"UNKNOWN (574)", "UNKNOWN (574)",
"UNKNOWN (575)", "UNKNOWN (575)",
"UNKNOWN (576)", "WM_TOUCH",
"UNKNOWN (577)", "UNKNOWN (577)",
"UNKNOWN (578)", "UNKNOWN (578)",
"UNKNOWN (579)", "UNKNOWN (579)",
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <math.h> #include <math.h>
#include <SDL_touch.h> #include <SDL_touch.h>
#define PI 3.1415926535897 #define PI 3.1415926535897
#define WIDTH 640 #define WIDTH 640
#define HEIGHT 480 #define HEIGHT 480
...@@ -32,7 +34,7 @@ Finger finger[MAXFINGERS]; ...@@ -32,7 +34,7 @@ Finger finger[MAXFINGERS];
void handler (int sig) void handler (int sig)
{ {
printf ("\exiting...(%d)\n", sig); printf ("exiting...(%d)\n", sig);
exit (0); exit (0);
} }
...@@ -53,7 +55,7 @@ void setpix(SDL_Surface *screen, int x, int y, int col) ...@@ -53,7 +55,7 @@ void setpix(SDL_Surface *screen, int x, int y, int col)
colour = SDL_MapRGB( screen->format, (col>>16)&0xFF, (col>>8)&0xFF, col&0xFF); colour = SDL_MapRGB( screen->format, (col>>16)&0xFF, (col>>8)&0xFF, col&0xFF);
pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/BPP + x; pixmem32 = (Uint32*) screen->pixels + y*screen->pitch/screen->format->BytesPerPixel + x; //TODO : Check this. May cause crash.
*pixmem32 = colour; *pixmem32 = colour;
} }
...@@ -81,7 +83,7 @@ void drawCircle(SDL_Surface* screen,int x,int y,int r,int c) ...@@ -81,7 +83,7 @@ void drawCircle(SDL_Surface* screen,int x,int y,int r,int c)
void DrawScreen(SDL_Surface* screen, int h) void DrawScreen(SDL_Surface* screen, int h)
{ {
int x, y, xm,ym,c; int x, y, xm,ym,c,i;
if(SDL_MUSTLOCK(screen)) if(SDL_MUSTLOCK(screen))
{ {
if(SDL_LockSurface(screen) < 0) return; if(SDL_LockSurface(screen) < 0) return;
...@@ -98,9 +100,10 @@ void DrawScreen(SDL_Surface* screen, int h) ...@@ -98,9 +100,10 @@ void DrawScreen(SDL_Surface* screen, int h)
setpix(screen,x,y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255); setpix(screen,x,y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255);
} }
} }
drawCircle(screen,mousx,mousy,-30,0xFFFFFF); drawCircle(screen,mousx,mousy,-30,0xFFFFFF);
int i;
for(i=0;i<MAXFINGERS;i++) for(i=0;i<MAXFINGERS;i++)
if(finger[i].p.x >= 0 && finger[i].p.y >= 0) if(finger[i].p.x >= 0 && finger[i].p.y >= 0)
if(finger[i].pressure > 0) if(finger[i].pressure > 0)
...@@ -131,8 +134,8 @@ int main(int argc, char* argv[]) ...@@ -131,8 +134,8 @@ int main(int argc, char* argv[])
memset(keystat,0,512*sizeof(keystat[0])); memset(keystat,0,512*sizeof(keystat[0]));
if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1; if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
screen = initScreen(WIDTH,HEIGHT);
if (!(screen = initScreen(WIDTH,HEIGHT))) if (!screen)
{ {
SDL_Quit(); SDL_Quit();
return 1; return 1;
...@@ -179,21 +182,22 @@ int main(int argc, char* argv[]) ...@@ -179,21 +182,22 @@ int main(int argc, char* argv[])
; ;
//printf("Finger: %i,x: %i, y: %i\n",event.tfinger.fingerId, //printf("Finger: %i,x: %i, y: %i\n",event.tfinger.fingerId,
// event.tfinger.x,event.tfinger.y); // event.tfinger.x,event.tfinger.y);
SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId); //SDL_Touch *inTouch = SDL_GetTouch(event.tfinger.touchId);
SDL_Finger* inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId); //SDL_Finger *inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId);
/*
finger[event.tfinger.fingerId].p.x = ((float)event.tfinger.x)/ finger[event.tfinger.fingerId].p.x = ((float)event.tfinger.x)/
inTouch->xres; inTouch->xres;
finger[event.tfinger.fingerId].p.y = ((float)event.tfinger.y)/ finger[event.tfinger.fingerId].p.y = ((float)event.tfinger.y)/
inTouch->yres; inTouch->yres;
finger[event.tfinger.fingerId].pressure = finger[event.tfinger.fingerId].pressure =
((float)event.tfinger.pressure)/inTouch->pressureres; ((float)event.tfinger.pressure)/inTouch->pressureres;*/
/*
printf("Finger: %i, Pressure: %f Pressureres: %i\n", printf("Finger: %i, Pressure: %f Pressureres: %i\n",
event.tfinger.fingerId, event.tfinger.fingerId,
finger[event.tfinger.fingerId].pressure, finger[event.tfinger.fingerId].pressure,
inTouch->pressureres); inTouch->pressureres);
*/
//printf("Finger: %i, pressure: %f\n",event.tfinger.fingerId, //printf("Finger: %i, pressure: %f\n",event.tfinger.fingerId,
// finger[event.tfinger.fingerId].pressure); // finger[event.tfinger.fingerId].pressure);
...@@ -215,6 +219,7 @@ int main(int argc, char* argv[]) ...@@ -215,6 +219,7 @@ int main(int argc, char* argv[])
} }
//And draw //And draw
DrawScreen(screen,h); DrawScreen(screen,h);
printf("Things\n");
/* /*
for(i=0;i<512;i++) for(i=0;i<512;i++)
if(keystat[i]) printf("%i\n",i); if(keystat[i]) printf("%i\n",i);
......

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "touchTest2", "touchTest2\touchTest2.vcproj", "{42BC83F1-CF20-4CEC-AC81-12EA804639E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Debug|Win32.ActiveCfg = Debug|Win32
{42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Debug|Win32.Build.0 = Debug|Win32
{42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Release|Win32.ActiveCfg = Release|Win32
{42BC83F1-CF20-4CEC-AC81-12EA804639E2}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="touchTest2"
ProjectGUID="{42BC83F1-CF20-4CEC-AC81-12EA804639E2}"
RootNamespace="touchTest2"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="0"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="C:\programs\gsoc10\VisualC\SDL\Debug\SDL.lib&#x0D;&#x0A;C:\programs\gsoc10\VisualC\SDLmain\Debug\SDLmain.lib&#x0D;&#x0A;msvcrt.lib&#x0D;&#x0A;"
IgnoreAllDefaultLibraries="true"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1"
CharacterSet="2"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
WarningLevel="3"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
GenerateDebugInformation="true"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\..\touchTest.c"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\SDL.dll"
>
</File>
<File
RelativePath=".\wmmsg.txt"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="JGRAN-VIRTUALPC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
Command="$(TargetPath)"
WorkingDirectory=""
CommandArguments=""
Attach="false"
DebuggerType="3"
Remote="1"
RemoteMachine="JGRAN-VIRTUALPC"
RemoteCommand=""
HttpUrl=""
PDBPath=""
SQLDebugging=""
Environment=""
EnvironmentMerge="true"
DebuggerFlavor=""
MPIRunCommand=""
MPIRunArguments=""
MPIRunWorkingDirectory=""
ApplicationCommand=""
ApplicationArguments=""
ShimCommand=""
MPIAcceptMode=""
MPIAcceptFilter=""
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment