Android Question Gameview Touch and Moving

Yunus ÖZ

Member
Licensed User
Hi dear friends,
i try to move an bitmapdata with my finger,
when i test it, response is soo late the bitmapdata follow the my finger maybe 0.2 second later :p

B4X:
Dim gv As GameView
gv.Initialize("gv")

Dim touchPad As BitmapData
touchPad.Bitmap=LoadBitmap(File.DirAssets,"touchPad.png")
   touchPad.DestRect.Initialize(gaX+wallSize, gaY+wallSize+GetDeviceLayoutValues.Height/2, gaX+wallSize*blockSize, gaY+wallSize*blockSize+GetDeviceLayoutValues.Height/2)
   gv.BitmapsData.Add(touchPad)

Dim handler As BitmapData
handler.Bitmap=LoadBitmap(File.DirAssets,"handler.png")
   handler.DestRect.Initialize(gaX+gaSize/2-collSize/2, gaY+gaSize/2-collSize/2+GetDeviceLayoutValues.Height/2,gaX+gaSize/2+collSize/2,gaY+gaSize/2+collSize/2+GetDeviceLayoutValues.Height/2)
   gv.BitmapsData.Add(handler)



Sub gv_Touch (Action As Int, X As Float, Y As Float)
'check in touchpad
   If X>touchPad.DestRect.Left And X<touchPad.DestRect.Right And Y>touchPad.DestRect.Top And Y<touchPad.DestRect.Bottom Then
   'Handler touch
     If X>handler.DestRect.Left And X<handler.DestRect.Right And Y>handler.DestRect.Top And Y<handler.DestRect.Bottom Then
       If Action=0 Then
         handlerTouched=True
       Else If Action=1 And handlerTouched Then
         handlerTouched=False
       End If
     End If
     If Action=2 And handlerTouched Then
       
       handler.DestRect.Left=X-halfSize
       handler.DestRect.Top=Y-halfSize
       handler.DestRect.Right=X+halfSize
       handler.DestRect.Bottom=Y+halfSize

       
       gv.Invalidate
     End If
   End If
End Sub
Maybe there is another way to move,

Best regards
 

Yunus ÖZ

Member
Licensed User
I read a lot of thread in community and i try everything and i noticed that:

SetApplicationAttribute(android:hardwareAccelerated, "true")
when i change the line above from true to false in manifest file, response time looking better, but all thread say use it with true o_O
When i remove the line its response time is bad too (only with false parameter has nice result)
i couldnt understand what is the mean of that.
meanwhile i'm using lg-g3

SetApplicationAttribute(android:hardwareAccelerated, "true") -> FPS= 7 OR 8
SetApplicationAttribute(android:hardwareAccelerated, "false") -> FPS=15 OR 16
removing the line -> FPS= 8 OR 10

Sincerely
Thank you
 
Last edited:
Top