Just updated
This commit is contained in:
commit
9610eb78b6
17 changed files with 480 additions and 133 deletions
|
@ -1,5 +1,5 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "SDL\SDL.vcproj", "{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDLmain", "SDLmain\SDLmain.vcproj", "{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="9.00"
|
||||
Name="SDL"
|
||||
ProjectGUID="{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}"
|
||||
RootNamespace="SDL"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
@ -76,16 +77,21 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalOptions="/MACHINE:I386"
|
||||
AdditionalOptions="/MACHINE:I386
msvcrt.lib"
|
||||
AdditionalDependencies="msimg32.lib winmm.lib"
|
||||
OutputFile=".\Debug/SDL.dll"
|
||||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
IgnoreAllDefaultLibraries="true"
|
||||
IgnoreAllDefaultLibraries="false"
|
||||
IgnoreDefaultLibraryNames=""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/SDL.pdb"
|
||||
SubSystem="2"
|
||||
SubSystem="0"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\Debug/SDL.lib"
|
||||
Profile="true"
|
||||
CLRThreadAttribute="0"
|
||||
CLRUnmanagedCodeCheck="false"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -106,9 +112,6 @@
|
|||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
|
@ -185,6 +188,8 @@
|
|||
IgnoreAllDefaultLibraries="true"
|
||||
ProgramDatabaseFile=".\Release/SDL.pdb"
|
||||
SubSystem="2"
|
||||
RandomizedBaseAddress="1"
|
||||
DataExecutionPrevention="0"
|
||||
ImportLibrary=".\Release/SDL.lib"
|
||||
/>
|
||||
<Tool
|
||||
|
@ -205,9 +210,6 @@
|
|||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
|
@ -928,6 +930,14 @@
|
|||
RelativePath="..\..\src\timer\SDL_timer_c.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\events\SDL_touch.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\events\SDL_touch_c.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\video\SDL_video.c"
|
||||
>
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Version="9.00"
|
||||
Name="SDLmain"
|
||||
ProjectGUID="{DA956FD3-E142-46F2-9DD5-C78BEBB56B7A}"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
|
@ -25,7 +26,7 @@
|
|||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY"
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
@ -98,7 +99,7 @@
|
|||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY"
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
@ -171,7 +172,7 @@
|
|||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
Description="Making sure basic SDL headers are in place..."
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY"
|
||||
CommandLine="if exist "$(ProjectDir)\..\..\include\SDL_config.h" goto SDLCONFIGOKAY
echo Copying SDL_config_win32.h to SDL_config.h...
copy "$(ProjectDir)\..\..\include\SDL_config_win32.h" "$(ProjectDir)\..\..\include\SDL_config.h"
:SDLCONFIGOKAY

if exist "$(ProjectDir)\..\..\include\SDL_revision.h" goto SDLREVISIONOKAY
echo Creating stub SDL_revision.h file...
echo #define SDL_REVISION 0 >"$(ProjectDir)\..\..\include\SDL_revision.h"
:SDLREVISIONOKAY
"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
|
|
|
@ -41,8 +41,6 @@ extern "C" {
|
|||
/* *INDENT-ON* */
|
||||
#endif
|
||||
|
||||
typedef struct SDL_Touch SDL_Touch;
|
||||
typedef struct SDL_Finger SDL_Finger;
|
||||
|
||||
struct SDL_Finger {
|
||||
int id;
|
||||
|
@ -55,9 +53,11 @@ struct SDL_Finger {
|
|||
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 */
|
||||
void (*FreeTouch) (SDL_Touch * touch);
|
||||
|
@ -87,6 +87,7 @@ struct SDL_Touch
|
|||
};
|
||||
|
||||
|
||||
|
||||
/* Function prototypes */
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "SDL_events_c.h"
|
||||
#include "../video/SDL_sysvideo.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
static int SDL_num_touch = 0;
|
||||
static SDL_Touch **SDL_touchPads = NULL;
|
||||
|
@ -99,9 +101,7 @@ int
|
|||
SDL_AddTouch(const SDL_Touch * touch, char *name)
|
||||
{
|
||||
SDL_Touch **touchPads;
|
||||
int selected_touch;
|
||||
int index;
|
||||
size_t length;
|
||||
int index,length;
|
||||
|
||||
if (SDL_GetTouchIndexId(touch->id) != -1) {
|
||||
SDL_SetError("Touch ID already in use");
|
||||
|
@ -252,7 +252,6 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
|
|||
{
|
||||
int index;
|
||||
SDL_Finger **fingers;
|
||||
size_t length;
|
||||
//printf("Adding Finger...\n");
|
||||
if (SDL_GetFingerIndexId(touch,finger->id) != -1) {
|
||||
SDL_SetError("Finger ID already in use");
|
||||
|
@ -260,19 +259,18 @@ SDL_AddFinger(SDL_Touch* touch,SDL_Finger* finger)
|
|||
|
||||
/* Add the touch to the list of touch */
|
||||
if(touch->num_fingers >= touch->max_fingers){
|
||||
printf("Making room for it!\n");
|
||||
fingers = (SDL_Finger **) SDL_realloc(touch->fingers,
|
||||
(touch->num_fingers + 1) * sizeof(SDL_Finger *));
|
||||
touch->max_fingers = touch->num_fingers+1;
|
||||
if (!fingers) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
touch->max_fingers = touch->num_fingers+1;
|
||||
touch->fingers = fingers;
|
||||
//printf("Making room for it!\n");
|
||||
fingers = (SDL_Finger **) SDL_realloc(touch->fingers,
|
||||
(touch->num_fingers + 1) * sizeof(SDL_Finger *));
|
||||
touch->max_fingers = touch->num_fingers+1;
|
||||
if (!fingers) {
|
||||
SDL_OutOfMemory();
|
||||
return -1;
|
||||
} else {
|
||||
touch->max_fingers = touch->num_fingers+1;
|
||||
touch->fingers = fingers;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index = touch->num_fingers;
|
||||
//printf("Max_Fingers: %i Index: %i\n",touch->max_fingers,index);
|
||||
|
@ -295,13 +293,14 @@ SDL_DelFinger(SDL_Touch* touch,int fingerid)
|
|||
SDL_Finger* finger = SDL_GetFinger(touch,fingerid);
|
||||
|
||||
if (!finger) {
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
SDL_free(finger);
|
||||
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,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if(finger == NULL)
|
||||
SDL_SendFingerDown(id,fingerid,SDL_TRUE,x,y,pressure);
|
||||
else {
|
||||
/* 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);
|
||||
if(finger == NULL) {
|
||||
SDL_SendFingerDown(id,fingerid,SDL_TRUE,x,y,pressure);
|
||||
return 0;
|
||||
} else {
|
||||
if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/
|
||||
if(y < 0) y = finger->last_y; /*The other is marked as -1*/
|
||||
if(pressure < 0) pressure = finger->last_pressure;
|
||||
xrel = x - finger->last_x;
|
||||
yrel = y - finger->last_y;
|
||||
/* 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 {
|
||||
if(x < 0) x = finger->last_x; /*If movement is only in one axis,*/
|
||||
if(y < 0) y = finger->last_y; /*The other is marked as -1*/
|
||||
if(pressure < 0) pressure = finger->last_pressure;
|
||||
xrel = x - finger->last_x;
|
||||
yrel = y - finger->last_y;
|
||||
}
|
||||
|
||||
/* Drop events that don't change state */
|
||||
if (!xrel && !yrel) {
|
||||
#if 0
|
||||
printf("Touch event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Update internal touch coordinates */
|
||||
|
||||
finger->x = x;
|
||||
finger->y = y;
|
||||
|
||||
/*Should scale to window? Normalize? Maintain Aspect?*/
|
||||
//SDL_GetWindowSize(touch->focus, &x_max, &y_max);
|
||||
|
||||
/* make sure that the pointers find themselves inside the windows */
|
||||
/* only check if touch->xmax is set ! */
|
||||
/*
|
||||
if (x_max && touch->x > x_max) {
|
||||
touch->x = x_max;
|
||||
} else if (touch->x < 0) {
|
||||
touch->x = 0;
|
||||
}
|
||||
|
||||
if (y_max && touch->y > y_max) {
|
||||
touch->y = y_max;
|
||||
} else if (touch->y < 0) {
|
||||
touch->y = 0;
|
||||
}
|
||||
*/
|
||||
finger->xdelta = xrel;
|
||||
finger->ydelta = yrel;
|
||||
finger->pressure = pressure;
|
||||
|
||||
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERMOTION;
|
||||
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;
|
||||
}
|
||||
|
||||
/* Drop events that don't change state */
|
||||
if (!xrel && !yrel) {
|
||||
#if 0
|
||||
printf("Touch event didn't change state - dropped!\n");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Update internal touch coordinates */
|
||||
|
||||
finger->x = x;
|
||||
finger->y = y;
|
||||
|
||||
/*Should scale to window? Normalize? Maintain Aspect?*/
|
||||
//SDL_GetWindowSize(touch->focus, &x_max, &y_max);
|
||||
|
||||
/* make sure that the pointers find themselves inside the windows */
|
||||
/* only check if touch->xmax is set ! */
|
||||
/*
|
||||
if (x_max && touch->x > x_max) {
|
||||
touch->x = x_max;
|
||||
} else if (touch->x < 0) {
|
||||
touch->x = 0;
|
||||
}
|
||||
|
||||
if (y_max && touch->y > y_max) {
|
||||
touch->y = y_max;
|
||||
} else if (touch->y < 0) {
|
||||
touch->y = 0;
|
||||
}
|
||||
*/
|
||||
finger->xdelta = xrel;
|
||||
finger->ydelta = yrel;
|
||||
finger->pressure = pressure;
|
||||
|
||||
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_GetEventState(SDL_FINGERMOTION) == SDL_ENABLE) {
|
||||
SDL_Event event;
|
||||
event.tfinger.type = SDL_FINGERMOTION;
|
||||
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;
|
||||
}
|
||||
}
|
||||
int
|
||||
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) {
|
||||
SDL_Event event;
|
||||
event.type = type;
|
||||
event.tbutton.touchId = (Uint8) index;
|
||||
event.tbutton.touchId = (Uint8) touch->id;
|
||||
event.tbutton.state = state;
|
||||
event.tbutton.button = button;
|
||||
event.tbutton.windowID = touch->focus ? touch->focus->id : 0;
|
||||
|
|
|
@ -64,8 +64,11 @@ extern int SDL_SendTouchButton(int id, Uint8 state, Uint8 button);
|
|||
/* Shutdown the touch subsystem */
|
||||
extern void SDL_TouchQuit(void);
|
||||
|
||||
/* FIXME: Where do these functions go in this header? */
|
||||
extern void SDL_ChangeEnd(int id, int end);
|
||||
/* Get the index of a touch device */
|
||||
extern int SDL_GetTouchIndexId(int id);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* _SDL_touch_c_h */
|
||||
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
slouken@libsdl.org
|
||||
*/
|
||||
|
||||
#if (_WIN32_WINNT < 0x0501)
|
||||
#if (_WIN32_WINNT < 0x601)
|
||||
#undef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0501
|
||||
#define _WIN32_WINNT 0x601
|
||||
#endif
|
||||
|
||||
#include "SDL_config.h"
|
||||
|
@ -32,11 +32,14 @@
|
|||
#include "SDL_vkeys.h"
|
||||
#include "../../events/SDL_events_c.h"
|
||||
|
||||
/*#define WMMSG_DEBUG*/
|
||||
|
||||
|
||||
#define WMMSG_DEBUG
|
||||
#ifdef WMMSG_DEBUG
|
||||
#include <stdio.h>
|
||||
#include <stdio.h>
|
||||
#include "wmmsg.h"
|
||||
#endif
|
||||
//#include <stdio.h>
|
||||
|
||||
/* Masks for processing the windows KEYDOWN and KEYUP messages */
|
||||
#define REPEATED_KEYMASK (1<<30)
|
||||
|
@ -125,9 +128,10 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
if (!data) {
|
||||
return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam);
|
||||
}
|
||||
|
||||
#ifdef WMMSG_DEBUG
|
||||
{
|
||||
FILE *log = fopen("wmmsg.txt", "a");
|
||||
{
|
||||
FILE *log = fopen("wmmsg.txt", "a");
|
||||
fprintf(log, "Received windows message: %p ", hwnd);
|
||||
if (msg > MAX_WMMSG) {
|
||||
fprintf(log, "%d", msg);
|
||||
|
@ -643,7 +647,39 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
returnCode = 0;
|
||||
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 (data->wndproc) {
|
||||
|
|
|
@ -30,7 +30,14 @@
|
|||
#define STRICT
|
||||
#define UNICODE
|
||||
#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>
|
||||
|
||||
#if SDL_VIDEO_RENDER_D3D
|
||||
|
|
|
@ -256,7 +256,8 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
|
|||
WIN_SetError("Couldn't create window");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*Disable Tablet support, replace with multi-touch.*/
|
||||
#if 0
|
||||
/* we're configuring the tablet data. See Wintab reference for more info */
|
||||
if (videodata->wintabDLL
|
||||
&& videodata->WTInfoA(WTI_DEFSYSCTX, 0, &lc) != 0) {
|
||||
|
@ -290,6 +291,9 @@ WIN_CreateWindow(_THIS, SDL_Window * window)
|
|||
}
|
||||
g_hCtx[window->id] = videodata->WTOpenA(hwnd, &lc, TRUE);
|
||||
}
|
||||
#else
|
||||
//RegisterTouchWindow(hwnd, 0);
|
||||
#endif
|
||||
#ifndef _WIN32_WCE /* has no RawInput */
|
||||
/* we're telling the window, we want it to report raw input events from mice */
|
||||
Rid.usUsagePage = 0x01;
|
||||
|
|
|
@ -283,7 +283,7 @@ char *wmtab[] = {
|
|||
"WM_INITMENU",
|
||||
"WM_INITMENUPOPUP",
|
||||
"UNKNOWN (280)",
|
||||
"UNKNOWN (281)",
|
||||
"WM_GESTURE",
|
||||
"UNKNOWN (282)",
|
||||
"UNKNOWN (283)",
|
||||
"UNKNOWN (284)",
|
||||
|
@ -578,7 +578,7 @@ char *wmtab[] = {
|
|||
"UNKNOWN (573)",
|
||||
"UNKNOWN (574)",
|
||||
"UNKNOWN (575)",
|
||||
"UNKNOWN (576)",
|
||||
"WM_TOUCH",
|
||||
"UNKNOWN (577)",
|
||||
"UNKNOWN (578)",
|
||||
"UNKNOWN (579)",
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <math.h>
|
||||
#include <SDL_touch.h>
|
||||
|
||||
|
||||
|
||||
#define PI 3.1415926535897
|
||||
#define WIDTH 640
|
||||
#define HEIGHT 480
|
||||
|
@ -32,7 +34,7 @@ Finger finger[MAXFINGERS];
|
|||
|
||||
void handler (int sig)
|
||||
{
|
||||
printf ("\exiting...(%d)\n", sig);
|
||||
printf ("exiting...(%d)\n", sig);
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -81,7 +83,7 @@ void drawCircle(SDL_Surface* screen,int x,int y,int r,int c)
|
|||
|
||||
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_LockSurface(screen) < 0) return;
|
||||
|
@ -98,9 +100,10 @@ void DrawScreen(SDL_Surface* screen, int h)
|
|||
setpix(screen,x,y,((x%255)<<16) + ((y%255)<<8) + (x+y)%255);
|
||||
}
|
||||
}
|
||||
|
||||
drawCircle(screen,mousx,mousy,-30,0xFFFFFF);
|
||||
|
||||
int i;
|
||||
|
||||
for(i=0;i<MAXFINGERS;i++)
|
||||
if(finger[i].p.x >= 0 && finger[i].p.y >= 0)
|
||||
if(finger[i].pressure > 0)
|
||||
|
@ -131,8 +134,8 @@ int main(int argc, char* argv[])
|
|||
|
||||
memset(keystat,0,512*sizeof(keystat[0]));
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;
|
||||
|
||||
if (!(screen = initScreen(WIDTH,HEIGHT)))
|
||||
screen = initScreen(WIDTH,HEIGHT);
|
||||
if (!screen)
|
||||
{
|
||||
SDL_Quit();
|
||||
return 1;
|
||||
|
@ -179,21 +182,22 @@ int main(int argc, char* argv[])
|
|||
;
|
||||
//printf("Finger: %i,x: %i, y: %i\n",event.tfinger.fingerId,
|
||||
// event.tfinger.x,event.tfinger.y);
|
||||
SDL_Touch* inTouch = SDL_GetTouch(event.tfinger.touchId);
|
||||
SDL_Finger* inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId);
|
||||
|
||||
//SDL_Touch *inTouch = SDL_GetTouch(event.tfinger.touchId);
|
||||
//SDL_Finger *inFinger = SDL_GetFinger(inTouch,event.tfinger.fingerId);
|
||||
/*
|
||||
finger[event.tfinger.fingerId].p.x = ((float)event.tfinger.x)/
|
||||
inTouch->xres;
|
||||
finger[event.tfinger.fingerId].p.y = ((float)event.tfinger.y)/
|
||||
inTouch->yres;
|
||||
|
||||
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",
|
||||
event.tfinger.fingerId,
|
||||
finger[event.tfinger.fingerId].pressure,
|
||||
inTouch->pressureres);
|
||||
*/
|
||||
//printf("Finger: %i, pressure: %f\n",event.tfinger.fingerId,
|
||||
// finger[event.tfinger.fingerId].pressure);
|
||||
|
||||
|
@ -215,6 +219,7 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
//And draw
|
||||
DrawScreen(screen,h);
|
||||
printf("Things\n");
|
||||
/*
|
||||
for(i=0;i<512;i++)
|
||||
if(keystat[i]) printf("%i\n",i);
|
||||
|
|
BIN
touchTest/touchTest2/touchTest2.ncb
Normal file
BIN
touchTest/touchTest2/touchTest2.ncb
Normal file
Binary file not shown.
20
touchTest/touchTest2/touchTest2.sln
Normal file
20
touchTest/touchTest2/touchTest2.sln
Normal file
|
@ -0,0 +1,20 @@
|
|||
|
||||
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
|
BIN
touchTest/touchTest2/touchTest2.suo
Normal file
BIN
touchTest/touchTest2/touchTest2.suo
Normal file
Binary file not shown.
BIN
touchTest/touchTest2/touchTest2/SDL.dll
Normal file
BIN
touchTest/touchTest2/touchTest2/SDL.dll
Normal file
Binary file not shown.
195
touchTest/touchTest2/touchTest2/touchTest2.vcproj
Normal file
195
touchTest/touchTest2/touchTest2/touchTest2.vcproj
Normal file
|
@ -0,0 +1,195 @@
|
|||
<?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
C:\programs\gsoc10\VisualC\SDLmain\Debug\SDLmain.lib
msvcrt.lib
"
|
||||
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>
|
|
@ -0,0 +1,65 @@
|
|||
<?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>
|
Loading…
Add table
Add a link
Reference in a new issue