Sub Process_Globals
Dim timer1 As Timer
End Sub
Sub Globals
Dim lGdx As LibGDX
Dim GL As lgGL
Dim Camera As lgOrthographicCamera
Dim Batch As lgSpriteBatch
Dim BackGroundTexture As lgTexture
Dim backgroundRegion As lgTextureRegion
Dim VIEWPORT_WIDTH As Int = 800
Dim VIEWPORT_HEIGHT As Int = 400
Dim X,Y As Float
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim config As lgConfiguration
config.useWakelock = True
If FirstTime Then
timer1.Initialize("timer1",10)
End If
Activity.AddView(lGdx.InitializeView2(config, "LG"), 0, 0, 100%x, 100%y)
End Sub
Sub Activity_Resume
If lGdx.IsInitialized Then lGdx.Resume
timer1.Enabled = True
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If lGdx.IsInitialized Then lGdx.Pause
End Sub
Sub LG_Create
Batch.Initialize
BackGroundTexture.Initialize("background.png")
backgroundRegion.InitializeWithTexture(BackGroundTexture)
End Sub
Sub LG_Resize(Width As Int, Height As Int)
Camera.Initialize
Camera.SetToOrtho2(False, VIEWPORT_WIDTH, VIEWPORT_HEIGHT)
End Sub
Sub LG_Render
GL.glClearColor(1, 1, 1, 1)
GL.glClear(GL.GL20_COLOR_BUFFER_BIT)
Camera.Update
Batch.ProjectionMatrix = Camera.Combined
Batch.ProjectionMatrix = Camera.projection
Batch.begin
Batch.DrawRegion(backgroundRegion, - Camera.viewportWidth / 2 - X, - Camera.viewportHeight / 2 - Y)
Batch.DrawRegion(backgroundRegion, - Camera.viewportWidth / 2 - X + backgroundRegion.RegionWidth, - Camera.viewportHeight / 2 - Y)
Batch.End
End Sub
Sub LG_Pause
End Sub
Sub LG_Resume
End Sub
Sub LG_Dispose
BackGroundTexture.dispose
Batch.dispose
End Sub
Sub timer1_tick
x = x + 1
If x > 800 Then x = 0
End Sub
"Can't create handler inside thread..." is the generic error message for libGDX problems; the useful message is displayed before that one in your Logs window.
In your code, I don't understand why you do "Batch.ProjectionMatrix = Camera.projection". Apart this, I don't see any obvious error. And I don't understand your question about X and Y. If they are declared in Globals or Process_Globals, you can access them easily from any function in the module. It's not related to libGDX.
hi informatix
Thank you for answer.
Description I'm sorry in shortage.
All of the code here, the error message is as follows.
In this case, what's the problem?
Thank you.
java.lang.ArrayIndexOutOfBoundsException: length = 12; index = -1
java.lang.RuntimeException: Can not create handler inside thread that has not called Looper.prepare ()
at android.os.Handler. <init> (Handler.java:200)
at android.os.Handler. <init> (Handler.java:114)
at android.app.Dialog. <init> (Dialog.java:111)
at android.app.AlertDialog. <init> (AlertDialog.java:114)
at android.app.AlertDialog $ Builder.create (AlertDialog.java:931)
at anywheresoftware.b4a.BA.ShowErrorMsgbox (BA.java:222)
at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:202)
at anywheresoftware.b4a.BA.raiseEvent2 (BA.java:163)
at anywheresoftware.b4a.libgdx.LibGDX $ b.render (SourceFile: 118)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame (SourceFile: 438)
at android.opengl.GLSurfaceView $ GLThread.guardedRun (GLSurfaceView.java:1531)
at android.opengl.GLSurfaceView $ GLThread.run (GLSurfaceView.java:1248)