Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AndrewAMD, chsmac85, NeoDumont, dr_panther, TedMar), 1,095 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Windows 7 Touch Position #356411
02/01/11 20:17
02/01/11 20:17
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Hi,

i was wondering how it is possible to set the engine mouse_pos to the last touch-position on a touchscrren device using Windows 7. Since the normal windows mouse pointer is also reset to the new position, there should be an easy way?!
vec_set(mouse_pos.x,mouse_cursor.x) didn't work for me.

Regards
TSGames

Re: Windows 7 Touch Position [Re: TSG_Torsten] #356414
02/01/11 20:30
02/01/11 20:30
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
include windows.h and then you can use:
SetCursorPos (var_x,var_y);

Re: Windows 7 Touch Position [Re: Widi] #356748
02/03/11 18:16
02/03/11 18:16
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Hi, thanks for you answer!
I don't want to change the windows cursor position, but read the position of the last "touch" event on the screen (where the user has touched with finger/pen).

Regards
TSGames

Re: Windows 7 Touch Position [Re: TSG_Torsten] #356750
02/03/11 18:22
02/03/11 18:22
Joined: May 2007
Posts: 2,043
Germany
Lukas Offline

Programmer
Lukas  Offline

Programmer

Joined: May 2007
Posts: 2,043
Germany

Re: Windows 7 Touch Position [Re: Lukas] #356769
02/03/11 19:43
02/03/11 19:43
Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
TSG_Torsten Offline OP

User
TSG_Torsten  Offline OP

User

Joined: Mar 2005
Posts: 564
/www/europe/ germany/index.php
Thanks Lukas, I've got it finally working laugh

For anyone who also wants to work with it, the code i used:

(lite-c)
Code:
#define WM_TOUCH 0x0240

BOOL WINAPI RegisterTouchWindow(HWND,ULONG);
#define PRAGMA_API RegisterTouchWindow;user32!RegisterTouchWindow

typedef struct {
  LONG      x;
  LONG      y;
  HANDLE    hSource;
  DWORD     dwID;
  DWORD     dwFlags;
  DWORD     dwMask;
  DWORD     dwTime;
  LONG   dwExtraInfo;
  DWORD     cxContact;
  DWORD     cyContact;
} PTOUCHINPUT;

BOOL WINAPI GetTouchInputInfo(LPARAM,UINT,PTOUCHINPUT*,int);
#define PRAGMA_API GetTouchInputInfo;user32!GetTouchInputInfo


LRESULT CALLBACK OriginalHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK MyMessageHandler(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
   if (message==WM_TOUCH) // touch?!
   { 
      UINT cInputs=1;
      PTOUCHINPUT pInputs;
      GetTouchInputInfo(lParam,cInputs,&pInputs,sizeof(PTOUCHINPUT));
      var touch_x=pInputs.x/100;
      var touch_y=pInputs.y/100;
      vec_set(mouse_pos.x,vector(touch_x,touch_y,0));
      // or may do something different...
       return 1; 
   }
   return OriginalHandler(hwnd,message,wParam,lParam);   	  
}


function main()
{
OriginalHandler=on_message; // save handler
on_message=MyMessageHandler; // custom ON_MESSAGE handler
RegisterTouchWindow(hWnd,0); // The engine window uses touch
}



Have fun laugh

Regards
TSGames


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1