Touch screen commands on Safari Browser

Just starting out? Need help? Post your questions and find answers here.
Russ Srole
Posts: 2
Joined: Thu Nov 10, 2022 10:38 pm

Touch screen commands on Safari Browser

Post by Russ Srole »

Are they supposed to work on a browser? The only touch screen I have is on an iPhone (12 mini, latest os).

The ExamineTouchScreen() function does return true, but the TouchY() and TouchDeltaY() always return 0.
bembulak
Posts: 71
Joined: Wed Feb 26, 2014 9:53 am

Re: Touch screen commands on Safari Browser

Post by bembulak »

Do you have some sort of example code, we can use for testing?
Maybe the code is missing something. If not, we'll be able to do further investigations. I'm sure the commands are supposed to work.
Russ Srole
Posts: 2
Joined: Thu Nov 10, 2022 10:38 pm

Re: Touch screen commands on Safari Browser

Post by Russ Srole »

I tried to dummy up something and the results were odd. I'm not sure it has anything to do with spiderbasic. I added some code like this:

Code: Select all

#TouchTimer = $5000
After creating the window:
  AddWindowTimer(Window_0,#TouchTimer,100)
  BindEvent(#PB_Event_Timer, @TimerEvents())
and the procedure is:

Code: Select all

Procedure TimerEvents()  
  Define finger
  Define a$
  If ExamineTouchScreen() 
    For finger = 0 To 4
      a$ = a$ + " " + Str(TouchY(finger)) + "-" + Str(TouchDeltaY(finger))
    Next    
  EndIf
  SetWindowTitle(Window_0,"timer: " + Hex(EventTimer()) + " " + Str(ExamineTouchScreen()) + "   " + a$)
EndProcedure
What is completely confusing is that if I run either the debug or fully compiled html/js I see the title bar and the timer number ($5000) and one zero which is correct because I don't have any touch devices on my desktop. But when I put this code on the aws bucket, the timer never fires at all, so the title bar never changes. I don't have another way to test it right now, but should at some point.

thanks

// Added Code-Tags (Peter)
User avatar
Paul
Posts: 195
Joined: Wed Feb 26, 2014 6:46 pm
Location: Canada
Contact:

Re: Touch screen commands on Safari Browser

Post by Paul »

Have you tried the TouchScreen.sb example in the help file under "2D Games & Multimedia Libraries/Touch Screen" ?
Post Reply