B4A Library libGDX - Game Engine

Discussion in 'Additional libraries, classes and official updates' started by Informatix, Sep 12, 2013.

  1. sterlingy

    sterlingy Active Member Licensed User

    I did not include Activity.Finish.
     
  2. Informatix

    Informatix Expert Licensed User

    I just tried to play the demo sound and it worked fine. Is your sound file smaller than 1 MB (once uncompressed)?
     
  3. sterlingy

    sterlingy Active Member Licensed User

    The file is 65k, and I tried a different file just to make sure. Also, If I load the file without using Asset Manager, it works just fine.
     
  4. Informatix

    Informatix Expert Licensed User

    Could you post your project?
     
  5. sterlingy

    sterlingy Active Member Licensed User

    The lines for the audio begin on line 1991 in LGS2_SHOW
     

    Attached Files:

  6. Informatix

    Informatix Expert Licensed User

    I have to admit that's a complete mystery to me. I'm unable to explain why there's no sound played.
     
  7. sterlingy

    sterlingy Active Member Licensed User

    I have to admit, that while we don't have a solution, as of yet, at least I've stumped the genius, makes me feel like less of an idiot, though I am one and you are not.

    This isn't a critical issue for me. I wanted the horse sound to trigger after all the assets are loaded. If I do it the old school way, which you can see towards the end of LG_Create, you will see several other sounds being loaded. For some reason, LGS1_Show would never play the horseSFX, but LGS2_Show would. I always assumed this was because it hadn't finished loading.

    Oddly, even when I put the "horseSFX.Initialize("audio/horse_neigh.mp3")" at the top of the list of sounds being loaded, it still wouldn't play.

    -S
     
  8. Informatix

    Informatix Expert Licensed User

    It seems there's a delay between the moment where you load the file and the moment where you can play it. It's not related at all to libGDX but to the SoundPool class of the Android API. You can reproduce the same issue with the SoundPool library.
    Suggestions:
    - use lgMusic for the sounds to play after their loading or use my OpenSL Player library, which is not based at all on SoundPool (it plays only WAV files)
    - play your sounds with lgSound only after a user action (in an event).

    Thank you for reporting these problems.
     
    Last edited: Jul 2, 2014
    sterlingy likes this.
  9. sterlingy

    sterlingy Active Member Licensed User

    Thanks Inormatix. I will convert my file to a wave and try your OpenSL Player lib.
     
  10. Chrrris

    Chrrris Member Licensed User

    I also had this SoundPool issue in my (in development...) game. I worked around it by creating a sound effects class that loads the main sfx used by the game during app start-up/initialisation. By the time everything else is loaded and the title screen is displayed, all the sound effects are good to go.

    I was previously loading the effects each time "Start Game" was selected (and disposing them after Game Over) and they weren't always ready in time for the start of the game. In the end, I figured this was not the ideal way to do it because, as well as the SoundPool issue, it just creates delays during the start of the game while OGGs are uncompressed, etc.
     
  11. sterlingy

    sterlingy Active Member Licensed User

    I was able to prove that the sounds were loaded, so that was not the problem in my case. I think Informatix has it right that there has to be an event triggered by the user before playing the first sound. Using his sound lib did solve this problem.

    -S
     
  12. Chrrris

    Chrrris Member Licensed User

    Okay, maybe multiple issues are being discussed here, but soundpool does decompress ogg files asynchronously, so attempting to play a sample too soon after loading it is something that must be avoided with libgdx.
     
    Informatix likes this.
  13. Informatix

    Informatix Expert Licensed User

    Here is the final version of the library. After this 1.0 there will be no new features, no new functions or properties, just bug fixes. This version provides all what you need to create a 2D or 2.5D game and seems to be very stable so I don't feel the need to continue to work on it.

    Among new things, I added in this version a profiler and a scene2d debug renderer (see the Scene2D_Table demo) and the possibility to create your own mipmap chain. I also wrote a MipMaps section in the guide to give you some insight about this useful feature (demonstrated by the Filters project).

    Now Box2D is isolated from the rest of the C library (.so) so it is possible to create your own "lite" version of the library. To remove the unneeded code, first duplicate the JAR file and open this copy with an archiver (.jar are zipped files).

    To remove Box2D:
    - remove all libgdx-box2d.so files in the subfolders of "lib";
    - remove the folder "anywheresoftware\b4a\libgdx\box2d";
    - remove the folder "aurelienribon";
    - remove the folder "com\badlogic\gdx\physics".
    You'd save about 300 Kb.

    To remove Scene2D:
    - remove the folder "anywheresoftware\b4a\libgdx\scene2d";
    - remove the folder "com\badlogic\gdx\scenes".
    You'd save about 270 Kb.

    To remove the support for x86 CPU (uncommon in the Android world):
    - remove the "lib/x86" folder.
    You'd save about 500 Kb.

    To remove the bitmap font generator (useless if you don't create fonts from otf/ttf files at runtime):
    - remove all libgdx-freetype.so files in the subfolders of "lib";
    - remove the file "anywheresoftware\b4a\libgdx\utils\lgFontGenerator.class";
    - remove the folder "com\badlogic\gdx\graphics\g2d\freetype".
    You'd save about 900 Kb.
     
    Last edited: Jul 4, 2014
    stanks and Peter Simpson like this.
  14. sterlingy

    sterlingy Active Member Licensed User

    Informatix,

    Can you confirm that ScaleBy and ScaleTo as an Actions method works?

    I have the following line:
    Dim AnimationGoal As lgScn2DAction = Actions.ScaleBy2(2, 2, 3)

    And it does nothing, but other Actions, like Fade and MoveTo are working

    -Sterling
     
  15. Informatix

    Informatix Expert Licensed User

    Hello,
    ScaleBy and ScaleTo work but you need to set also Transform of the group to True (same thing for rotations).

    EDIT: I updated the documentation with this information (in the Widgets section).
     
    Last edited: Jul 10, 2014
  16. ilan

    ilan Expert Licensed User

    hi,

    how can i draw a text in libGDX?
     
  17. sorex

    sorex Expert Licensed User

    Informatix: funny to read you clean up post now, I checked it out myself 2 days ago and noticed the x86 stuff aswell.

    when I removed it the smileyfps app didn't seem to work right. Was under genymotion tho.

    there is also an armsomething_v7 there with a few hundred K of data, what is this exactly?

    should give it another try tonight.
     
  18. Informatix

    Informatix Expert Licensed User

    Something that you should not remove. :)
    The arm*.so are the C libraries providing critical functions to libGDX.
     
  19. Informatix

    Informatix Expert Licensed User

    There are many examples provided with the library showing this (the BitmapFont demo in the first place).
     
  20. ilan

    ilan Expert Licensed User

    hi,

    does the libGDX contains the possiblity to control the accelerometer or the gyroscope?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice