Spright
Active Member
I'm wondering how to get immersive in libGDX? I have the code to get imerisve from forum for the pages system. But I do not yet understand how it relates and converts to libgdx? I have succesed in eraseing the menu status bar and include a minimal example to show where i am.
Example in B4A with LiibGDX:
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 Texture As lgTexture
Dim IP As lgInputProcessor
Dim counter As Int
Dim mat2 As lgMathMatrix4
Dim region As lgTextureRegion
Dim SpriteRegions(,) As lgTextureRegion
Dim animregion As lgTextureRegion
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim Config As lgConfiguration
Config.hideStatusBar = False
Config.useImmersiveMode = True
lGdx.Initialize("LG") 'MP
End Sub
Sub Activity_Resume
If lGdx.IsInitialized Then lGdx.Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
If lGdx.IsInitialized Then lGdx.Pause
End Sub
Sub LG_Pause
End Sub
Sub LG_Resume
End Sub
Sub LG_Dispose
Texture.dispose
Batch.dispose
End Sub
Sub LG_Resize(Width As Int, Height As Int)
Camera.Initialize
Camera.SetToOrtho2(False,640,400)
End Sub
Sub IP_TouchDragged(ScreenX As Int, ScreenY As Int, Pointer As Int) As Boolean
Return True
End Sub
Sub IP_TouchDown(ScreenX As Int, ScreenY As Int, Pointer As Int) As Boolean
Log(ScreenX) : Log(ScreenY)
Return True
End Sub
Sub LG_Create
IP.Initialize("IP")
Batch.Initialize
Texture.Initialize("sprite.png") ' Setup a 128x128 spritesheet with 8x8 sprites
Dim region As lgTextureRegion
region.InitializeWithTexture(Texture)
Dim SpriteSize As Int = 8
Dim SpriteRegions(,) As lgTextureRegion = region.Split(SpriteSize, SpriteSize)
animregion.InitializeWithTexture(Texture)
Dim animsplit(,) As lgTextureRegion=animregion.Split(8,8)
counter = 0
End Sub
Sub LG_Render
GL.glClearColor(0,0,1,1)
GL.glClear(GL.GL20_COLOR_BUFFER_BIT)
Texture.SetFilter(Texture.FILTER_Nearest, Texture.FILTER_Nearest)
Camera.Update
mat2 = Camera.Combined
Batch.ProjectionMatrix = mat2
Batch.Begin
For y = 0 To 15
For x = 0 To 15
Dim region As lgTextureRegion = SpriteRegions(2,2) ' Drawing something, draw 16x16 tiles, all the same tile right now.
Batch.DrawRegion(region, counter+x * 8, y * 8)
Next
Next
Batch.End
counter = (counter + 1) Mod 640
End Sub