finger event (?)

Just starting out? Need help? Post your questions and find answers here.
AZJIO
Posts: 73
Joined: Wed Dec 14, 2022 1:13 pm

finger event (?)

Post by AZJIO »

I wanted to make events for the movement of the fingers up, down, right, left, but this does not work. Is this procedure only for specific tasks?

Code: Select all

Procedure RenderFrame()
	Static Finger = -1
	
	If ExamineTouchScreen()
		
		For i = 0 To 4
			If TouchScreenPushed(i) And Finger = -1
				Finger = i
				Break
			EndIf
		Next
		If Finger <> -1 And TouchScreenPushed(Finger)
			If TouchDeltaX(Finger) > 0
				Debug "+x"
				ChangeMonth(1)
			ElseIf TouchDeltaX(Finger) < 0
				Debug "-x"
				ChangeMonth(0)
			EndIf
			If TouchDeltaY(Finger) > 0
				Debug "+y"
				ChangeMonth(1)
			ElseIf TouchDeltaY(Finger) < 0
				Debug "-y"
				ChangeMonth(0)
			EndIf
		Else
			Finger = -1
		EndIf
	EndIf
EndProcedure 

BindEvent(#PB_Event_RenderFrame, @RenderFrame())
plouf
Posts: 196
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: finger event (?)

Post by plouf »

first try online demo
https://www.spiderbasic.com/showcase/on ... creen.html

this works ? (works in my phone)
Christos
AZJIO
Posts: 73
Joined: Wed Dec 14, 2022 1:13 pm

Re: finger event (?)

Post by AZJIO »

plouf wrote: Tue Jan 03, 2023 1:41 pm this works ?
does not work (I have version 5.1)
plouf
Posts: 196
Joined: Tue Feb 25, 2014 6:01 pm
Location: Athens,Greece

Re: finger event (?)

Post by plouf »

android 5.1 ?
tricky since the "documented" absolute minimun...
Christos
User avatar
useful
Posts: 116
Joined: Tue Feb 25, 2014 1:15 pm

Re: finger event (?)

Post by useful »

Here is the simplest template, which shows that there is a response as stated for 5 simultaneous touches.
But I couldn't get anything without screen, and I didn't even hope to.
If it were possible, at least it would be mentioned in documentation and examples.
Tested on Android 5.1 MEIZU M3S.
Ie all this as well as many other 2d games with sprites.
p.s. And even on Android 4.2.2 works, but catches only 1 (one) touch.
p.p.s. And on Android 11go and BQ5031G only 2(two).
So in addition to the version of the OS affects the sensitivity of the equipment.

Code: Select all

EnableExplicit
#Desktop    = 0
Global DW   = 0
Global DH   = 0
Declare EventSD()
Declare EventRF()
ExamineDesktops()
DW = DesktopWidth(#Desktop)
DH = DesktopHeight(#Desktop)
OpenScreen(DW,DH,-1,"TestTS")
BindEvent(#PB_Event_SizeDesktop, @EventSD())
BindEvent(#PB_Event_RenderFrame, @EventRF())
FlipBuffers()
Procedure EventSD()
  DW = DesktopWidth(#Desktop)
  DH = DesktopHeight(#Desktop)
  ResizeScreen(DW,DH)
EndProcedure
Procedure EventRF()
  ExamineTouchScreen()
  ClearDebugOutput()
  Debug "Tsp0 " + Str(TouchScreenPushed(0))
  Debug "Tsp1 " + Str(TouchScreenPushed(1))
  Debug "Tsp2 " + Str(TouchScreenPushed(2))
  Debug "Tsp3 " + Str(TouchScreenPushed(3))
  Debug "Tsp4 " + Str(TouchScreenPushed(4))
  FlipBuffers()
EndProcedure 
2B or not 2B = FF
Post Reply