libgdx

No OpenGL context found in the current thread

萝らか妹 提交于 2021-02-20 06:29:31
问题 I am using LibGDX to make a game. I want to simultaneously load/unload assets on the fly as needed. However, waiting for assets to load in the main thread causes lag. In order to remedy this, I've created a background thread that monitors which assets need to be loaded (textures, sounds, etc.) and loads/unloads them appropriately. Unfortunately, I get the following error when calling AssetManager.update() from that thread. com.badlogic.gdx.utils.GdxRuntimeException: java.lang.RuntimeException

Screen recording within android using libgdx or not

点点圈 提交于 2021-02-19 04:48:07
问题 I managed to do this by taking a series of screenshots and convert them to video using ffmpeg (ffmpeg compiled for android and include all *so to asserts, copy them all to to data/data/my.package/ and execute ffmpeg from there) But the main problem is the taking screenshots have big impact on screen rendering, it freezes a while (~0.1sec) when the app is executing this line of code: Gdx.gl.glReadPixels(x, y, w, h, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixels); I tried to take screenshots from

How to set assets folder of libgdx without creating an android project?

妖精的绣舞 提交于 2021-02-16 16:19:43
问题 Is there anyway of doing it? I can't find any tutorial related to it on google. 回答1: Libgdx doesn't enforce any particular hierarchy or folder naming conventions for keeping your assets such that Gdx.files.internal("myassets/libgdx.png") would work just fine on Desktop. However, Android projects do have a specific folder in its root named assets. The folder has to be strictly named "assets" as enforced by the Android project [1]. Therefore, it would be a better idea to lay your folder

How to set assets folder of libgdx without creating an android project?

坚强是说给别人听的谎言 提交于 2021-02-16 16:19:39
问题 Is there anyway of doing it? I can't find any tutorial related to it on google. 回答1: Libgdx doesn't enforce any particular hierarchy or folder naming conventions for keeping your assets such that Gdx.files.internal("myassets/libgdx.png") would work just fine on Desktop. However, Android projects do have a specific folder in its root named assets. The folder has to be strictly named "assets" as enforced by the Android project [1]. Therefore, it would be a better idea to lay your folder

Sound makes app lags on Android - any solution?

帅比萌擦擦* 提交于 2021-02-11 18:12:28
问题 So my game runs smoothly on PC (win 10), but lags on android phone (Mi 9T pro, SD 855, 6GB of ram). I don't mean that only sound lags, but graphics also. When I disable sounds it runs perfectly smooth (as it should). Yes I know that this question is asked and answered many times. And I tried all offered "solutions", but nothing helps. Tried using 22KHz samples, 44.1Khz, 48Khz. Tried adding 1 second of silence at end of each sample. Didn't help. I'm loading samples with this method: private

Sound makes app lags on Android - any solution?

∥☆過路亽.° 提交于 2021-02-11 18:09:11
问题 So my game runs smoothly on PC (win 10), but lags on android phone (Mi 9T pro, SD 855, 6GB of ram). I don't mean that only sound lags, but graphics also. When I disable sounds it runs perfectly smooth (as it should). Yes I know that this question is asked and answered many times. And I tried all offered "solutions", but nothing helps. Tried using 22KHz samples, 44.1Khz, 48Khz. Tried adding 1 second of silence at end of each sample. Didn't help. I'm loading samples with this method: private

Invalid Filepath on TmxMapLoader.load()

久未见 提交于 2021-02-11 13:22:11
问题 I am following a youtube tutorial on how to make an android (probably not but I can hope for compatability) and iOS game using LibGDX and I have encountered a problem accessing a .tmx file from my res folder. tileMap = new TmxMapLoader().load("res/level1.tmx"); using the above code I figured that the application would find my .tmx file in my res folder but I must be giving it incorrect information on how to find a file I have open in another tab. here is a screenshot of the search method

Invalid Filepath on TmxMapLoader.load()

梦想的初衷 提交于 2021-02-11 13:21:11
问题 I am following a youtube tutorial on how to make an android (probably not but I can hope for compatability) and iOS game using LibGDX and I have encountered a problem accessing a .tmx file from my res folder. tileMap = new TmxMapLoader().load("res/level1.tmx"); using the above code I figured that the application would find my .tmx file in my res folder but I must be giving it incorrect information on how to find a file I have open in another tab. here is a screenshot of the search method

LibGDX Array's internal array is not type safe

穿精又带淫゛_ 提交于 2021-02-11 07:50:05
问题 I am extending Array from LibGDX in a generic fashion which extends Array<MyClass> but when I access its items array directly, I get an error that Object can not be cast to class MyClass . I don't see exactly why I'm getting an error with this. public class MyArray extends Array<MyClass> { public void method() { for (MyClass myItem : items)//throws java.lang.Object; cannot be cast to class error on this line System.out.println(myItem); } } I noticed also that if I try to do a similar thing

rendering video on a texture in LibGDX

本秂侑毒 提交于 2021-02-07 13:39:14
问题 i am new to LibGDX i'm building a game and i have an animated background that has about 10 seconds of animation (250 frames aprox.) since it's useless to try and build a sprite sheet for this (large background of course) is there a way to render video files are png sequence to a texture so i can have my animated background drawn in the game? 回答1: There is now an extension for video playback gdx-video. 回答2: If your idea is to put a texture on background and render the image and timely replace