Page 1 of 1

Touch screen

Posted: Fri May 13, 2005 7:46 am
by Seldon
I tried my program (FULL SCREEN MODE) on a machine with a touch-screen installed (it is connected via PS/2 and it does mouse emulation), but it doesn't work at all.

Of course the program does work with a normal mouse attached. I use ExamineMouse() in a loop. And I only open a screen with OpenScreen().

The machine runs under Win-XP SP2.

Is there any solution you know? Thanks for any hints.

Posted: Sat May 14, 2005 8:50 am
by Seldon
Any hints ? None used a touch before ? Fred ? Do you have any ideas about this ? From my point of view, it could be a problem of Direct-Input ? (it only recognizes a real mouse??) .

Posted: Wed Sep 06, 2006 2:52 am
by mskuma
I have seen this problem. If I make a fake cursor with movement tied to the directx mouse using:

Code: Select all

DisplaySprite3D(#Cursor, MouseX(), MouseY())
the fake cursor moves when using a real mouse, but when I ignore the mouse and use touch exclusively, it doesn't work. What happens (by observing the fake cursor) is, when the program starts the fake cursor appears in the top-left corner, and the cursor wont reposition when the screen is touched at a new location. However if you press at, say, the bottom-right corner, the fake cursor will move a little bit, but the movement is very restricted - along the vertical only and moving only part way down the screen. This issue is non-existent when using a windowed-screen.

It seems to me that the PB DirectX MouseX() and MouseY() functions are tied to mouse motion (as is usual with a real mouse), and is not effective when a sudden positional change occurs (as is usual with a touch screen).

I'm seeking a solution too since I've noticed a better frame rate when using a full-screen directx display.

Can anyone can suggest some low-level directx mouse commands that might solve this problem?

Posted: Wed Sep 06, 2006 3:33 am
by chris_b
Maybe using Windows API will work? Here's an example to test:

Code: Select all

Define CursorPos.point

#VK_LBUTTON	=$01	;Left mouse button 
#VK_RBUTTON	=$02  ;Right mouse button

InitSprite()
InitKeyboard()

OpenScreen(640,480,32,"test")

Repeat

  ExamineKeyboard()
  
  ClearScreen(RGB(255,255,255))
  
  GetCursorPos_(@CursorPos)
  
  StartDrawing(ScreenOutput())
  
  DrawText(16,16,"["+Str(CursorPos\x)+","+Str(CursorPos\y)+"]")
  
  If GetAsyncKeyState_(#VK_LBUTTON)
    DrawText(16,32,"Left Button")
  EndIf
  
  If GetAsyncKeyState_(#VK_RBUTTON)
    DrawText(16,48,"Right Button")
  EndIf
  
  StopDrawing()
  
  FlipBuffers()

Until KeyboardPushed(#PB_Key_Escape)

End

Posted: Wed Sep 06, 2006 3:53 am
by mskuma
Thanks alot chris_b for your great help! Works well :D