TouchX / TouchY

Just starting out? Need help? Post your questions and find answers here.
User avatar
_aNdy_
Posts: 14
Joined: Fri Jul 15, 2022 4:56 pm
Contact:

TouchX / TouchY

Post by _aNdy_ »

I'm using an 800x660 windowed screen in a web browser for a simple game.

When using the TouchX / Touch Y commands, do these give you the x-y of the inside of the opened windowed screen, or of the whole web browser window which could obviously be larger?
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

Re: TouchX / TouchY

Post by Peter »

I'm not that familiar with the gaming commands of SpiderBasic, but the documentation on this should be clear:
Returns the finger [...] position (in pixels) on the current screen.
User avatar
_aNdy_
Posts: 14
Joined: Fri Jul 15, 2022 4:56 pm
Contact:

Re: TouchX / TouchY

Post by _aNdy_ »

Thanks for the reply.

I'm testing using an Android tablet with the webpage running using the 'Desktop Site' version.

Dropping in some touch screen commands and printing up some coords using the debug window, the numbers being output suggests that the whole tablet screen is being scanned, not just the windowed screen I've opened which explains why none of my on-screen coords aren't working!

I'll have to investigate more!
User avatar
_aNdy_
Posts: 14
Joined: Fri Jul 15, 2022 4:56 pm
Contact:

Re: TouchX / TouchY

Post by _aNdy_ »

Completed my investigation!

I was opening a window then opening a screen on that window. By doing this, TouchX/Y seems to use the whole mobile device screen and not just the window screen that was opened. Hope that makes sense!

By just using the 'openscreen' command, this is overcome and x/y coords are reported correctly in the debug window!

HOWEVER!!!

With my original open window then screen method, I could detect the device screen size and centre the window/screen nicely in the browser. By using the 'openscreen' command, the 800x600 screen is stuck in the top left of the browser window. How can this be centred on the browswer screen? Please don't tell me I have to start messing around with the CCS files!!!!
User avatar
_aNdy_
Posts: 14
Joined: Fri Jul 15, 2022 4:56 pm
Contact:

Re: TouchX / TouchY

Post by _aNdy_ »

Investigations continue.

TouchX/Y only works 'correctly' when my 800x600 screen is in the top left of the browser window, obviously because the device screen starts in the top corner.

As soon as I center it on the browser window, then it becomes difficult since TouchX/Y seems to be using the whole device display and not my 800x600 screen.

I had just assumed that TouchX/Y would work on whatever size window you opened using the SB commands. Ho-hum! :D
Post Reply