Gameview - Another Touch problem - SOLVED
I have wide "background" picture ( 960x640 ) and i init it this way:
Dim GG As Bitmap
Dim Xoffset As Int
Dim Yoffset As Int
GG.Bitmap = LoadBitmap(File.DirAssets, "bkg.jpg")
GG.SrcRect.Initialize( Xoffset, Yoffset, 480 + Xoffset, 320 + Yoffset )
GG.DestRect.Initialize( 0, 0, 100%x, 100%y )
Device screen is 480x320
then i handle touch event like this
Sub gv_Touch (Action As Int, X As Float, Y As Float)
If Action = Activity.ACTION_DOWN Then
If X < 33%x Then
Xoffset = Xoffset - 1
If Xoffset < 0 Then Xoffset = 0
End If
If X > 66%x Then
Xoffset = Xoffset + 1
End If
GG.SrcRect.Initialize( Xoffset, Yoffset, 480 + Xoffset, 320 + Yoffset )
gv.Invalidate
End if
End Sub
At first glance it works fine and as expected - when i touch right side of the screen , picture shifts left, when i touch left side - picture shifts right.
BUT STOP! Seems. I need to touch screen every time when i need picture to shift.
I want to touch screen and keep touching and still get this event.
So, when i press, say, right side of the screen, picture will shift until i stop touch.
How to do it with GameView and Touch event ?
Or may be I need to use smth other then Touch to handle single touches and continuos pressing ?
Thank you
I have wide "background" picture ( 960x640 ) and i init it this way:
Dim GG As Bitmap
Dim Xoffset As Int
Dim Yoffset As Int
GG.Bitmap = LoadBitmap(File.DirAssets, "bkg.jpg")
GG.SrcRect.Initialize( Xoffset, Yoffset, 480 + Xoffset, 320 + Yoffset )
GG.DestRect.Initialize( 0, 0, 100%x, 100%y )
Device screen is 480x320
then i handle touch event like this
Sub gv_Touch (Action As Int, X As Float, Y As Float)
If Action = Activity.ACTION_DOWN Then
If X < 33%x Then
Xoffset = Xoffset - 1
If Xoffset < 0 Then Xoffset = 0
End If
If X > 66%x Then
Xoffset = Xoffset + 1
End If
GG.SrcRect.Initialize( Xoffset, Yoffset, 480 + Xoffset, 320 + Yoffset )
gv.Invalidate
End if
End Sub
At first glance it works fine and as expected - when i touch right side of the screen , picture shifts left, when i touch left side - picture shifts right.
BUT STOP! Seems. I need to touch screen every time when i need picture to shift.
I want to touch screen and keep touching and still get this event.
So, when i press, say, right side of the screen, picture will shift until i stop touch.
How to do it with GameView and Touch event ?
Or may be I need to use smth other then Touch to handle single touches and continuos pressing ?
Thank you
Last edited: