Android Tutorial Introduction to the libGDX library

persianpowerman1

Active Member
Licensed User
Longtime User
You can use the log() command to send information to the log in B4A to see more information from your game.
yes.. i got that...
but is it possible... to go step by step... like how we generally debug... so unless i press F8 the program doesnt go to the next step.. got it?
i want to do this so i can see exactly how the collision is being detected etc.. etc... step by step..
any way possible?
 

Informatix

Expert
Licensed User
Longtime User
Rather than running code step by step (which can be long and boring when there are many loops in the middle), my own method is to place a few Log() at strategic places. The goal is to know whether I pass through a particular branch or not, and what's the value at this point. And if I need to detect when my variable reaches a particular value, I add a condition where the value is changed.
 
Last edited:

persianpowerman1

Active Member
Licensed User
Longtime User
hmmm... i get it...
ok... cool... am going to try it..
... Just that a few codes in the examples got a little heavy to understand...
but fine... will give it a go ... as you said... i'll add a few conditions here and there!

thanx buddy
 

ilan

Expert
Licensed User
Longtime User
thanx informatix, the problem with lgsound is that i dont know how to make an endless loop
with lgmusic its easy only looping = true
lgsound you put the times how much it should loop but i cannot find an endless looping option

will it effect in any way my game if i use lgsound instead of lgmusic with larger files??
 

ilan

Expert
Licensed User
Longtime User
i have one more question i have developed my first libgdx game and i have now uploaded it to my google play account but i see that the game required only open gl 1.0 and i saw you wrote it need at least open gl 2.0 so do i need to write something in the manifest editor?

i set the minsdk to 8 is this correct?
 

Informatix

Expert
Licensed User
Longtime User
thanx informatix, the problem with lgsound is that i dont know how to make an endless loop

The Loop function does not work?

will it effect in any way my game if i use lgsound instead of lgmusic with larger files??

You will use more memory as the sounds are entirely loaded before being played contrary to the music which is streamed from the media. And large files take some time to be loaded.

i set the minsdk to 8 is this correct?

It works with 8, but a recent discussion led to the conclusion that 9 is better (so only devices with Gingerbread are allowed for Android versions < 3).
 

ilan

Expert
Licensed User
Longtime User
thank you i will set the min sdk to 8, what about the opengl ? do i need to set anything more in the menifest editor?
 

wahyuway

Member
Licensed User
Longtime User
is there any chance in future to release lib with 3d classes? i need to load my 3d object
 

ilan

Expert
Licensed User
Longtime User
i'm trying to call a sub from the render but its not working what am i doing wrong

B4X:
lGdx.CallSubUI("submsg",Null)

Sub submsg
If fireb.Visible = True Then fireb.Visible = False
End Sub
 

Informatix

Expert
Licensed User
Longtime User
is there any chance in future to release lib with 3d classes? i need to load my 3d object
It is not planned in the near future.
The current owner of the wrapped library is Anywhere Software (Erel) so I won't take big decisions about it and, personally, I don't have neither the time nor the desire to work on these classes.
Please note that it already exists a library for 3D objects: jPCT-AE.
 

ilan

Expert
Licensed User
Longtime User
thanx informatix i will test it when i get home...
do i need to pause the lGdx? and then do what i would like to do?
 

wahyuway

Member
Licensed User
Longtime User
in live wallpaper example, i combine with gifdecoder lib,to decode gif

i made a sub event and call it with CallSubUI("loadLWP,"")
B4X:
Sub loadLWP(Param As Object)

    Dim gif As GifDecoder
   
    gif.DisposeFrames
    gif.load(File.DirAssets, "winter.gif")
   
    ToastMessageShow(gif.FrameCount & " frames", True)
   
    MyDirectory = File.DirRootExternal & "/LWP" 
    If File.Exists(MyDirectory, "") = False Then 
        File.MakeDir(File.DirRootExternal, "LWP") 
    End If
   
    For Frame = 0 To (gif.FrameCount-1)
        gif.SaveFrame(Frame, MyDirectory, "frame"&Frame&".jpg", "J", 90)
       
    Next
End Sub

But it seems not working. I called it inside LG_Create

1. How to handle files and directory inside libgdx?
2. Is there any tick event to animate background?

Thanks
 

Informatix

Expert
Licensed User
Longtime User
But it seems not working. I called it inside LG_Create

What does not work? The call to your sub or the sub itself?
In your case, I see no reason to call this sub from libGDX. What it does is not supposed to be done during the game, but before, and does not involve libGDX, so call that before initializing libGDX and that will be fine.

1. How to handle files and directory inside libgdx?
2. Is there any tick event to animate background?

You should read the following chapters in the first posts of this thread: "The libGDX life-cycle", "Rendering" and "File handling".
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…