LoginLogin

Need help with touch screen.

Root / Programming Questions / [.]

thatguyCreated:
I want to make the touch screen black/remove the keyboard.


Thank you so much!

It gets rid of all sprites on the top screen :/ is there anything else i can use.

It gets rid of all sprites on the top screen :/ is there anything else i can use.
No, and what are you doing?

Do
ACLS 
XSCREEN 4
at the beginning of your code.

Do you need the keyboard and the bottom screen at the same time? if not, just set it to XSCREEN 2 at the very beginning. Even so, INPUT and LINPUT will pop up the keyboard regardless of what video mode is on.

Thank you guys! i have fixed it with of course all of your help.

how do i make it sense touch? i think the touch command is used.

TOUCH OUT STTM,TX,TY will give the coordinates of the touch in variables TX and TY, and the number of frames the screen has been touched in STTM. If STTM is 0, that means the screen isn't being touched at all, and TX and TY will be the coordinates of the last touch instead. This program will give you a basic idea of how it works:
ACLS
XSCREEN 2

WHILE TRUE
 VSYNC
 TOUCH OUT STTM,TX,TY
 CLS
 ?STTM,TX,TY
WEND
P.S. This actually works even in screen modes that have the keyboard on the touch screen. It's not all that useful, but you could use it to detect when someone's trying to press some of the keys that normally do nothing when a program is running, like Copy, Paste, Undo, and so on, since those can't be detected with INKEY$().

well, how do you specify an area?

well, how do you specify an area?
You don't; you have to check whether the coordinates are in an area manually. That said, you could put together something like this:
ACLS
XSCREEN 2

DISPLAY 1
WHILE TRUE
 VSYNC
 GCLS
 IF TOUCHED(50,50,100,100) THEN
  GFILL 50,50,100,100,#GREEN
 ELSE
  GBOX 50,50,100,100,#GREEN
 ENDIF
WEND

DEF IN(N,L,H)
 RETURN N>=L && N<=H
END

DEF TOUCHED(X0,Y0,X1,Y1)
 TOUCH OUT STTM,TX,TY
 RETURN STTM && IN(TX,X0,X1) && IN(TY,Y0,Y1)
END