libgdx

Libgdx - Making a drop-down menu/settings screen

懵懂的女人 提交于 2019-12-11 02:48:21
问题 I'm looking to make a drop-down menu and drop-down settings screen but I couldn't find any resources for making these in Libgdx. Would like some pointers to good resources for this specific type of interface or a quick example. Thanks! 回答1: SelectBox is in LibGDX can be used for drop-down list, it allows one of a number of values to be chosen from a list. And for pop-up window you can use Dialog . stage=new Stage(); Skin skin=new Skin(Gdx.files.internal("skin/glassy-ui.json")); dialog=new

FATAL EXCEPTION : main - My app doesn't work on android devices anymore, but works on desktop

独自空忆成欢 提交于 2019-12-11 02:45:49
问题 This is the first time I have this problem and I absolutely don't know what to do. I used to test my app on both virtual devices and on my phone and tablet. I tested it very often, like every 1-2h. And at one point, it just stopped working on every android devices, but it still works on desktop. On the android devices, it crashes as soon as I start the app, and I obtain this message : "Unfortunately, MyApp has stopped." And in the logcat, the stack trace shows a "FATAL EXCEPTION: main", I

LibGdx TouchInput gives strange numbers for position on the screen

我的未来我决定 提交于 2019-12-11 02:25:32
问题 have a small problem. Cannot understand how to solve it. I am implementing user touch input in my LibGdx game. My screenSize is next: width = 408 and height = 272; When I am trying to print values I get from method touchDown, I get absolutely weird numbers for positions on the screen. They can be even bigger than 1000... How is it even possible if my screenSize is 408x272? @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { System.out.println(screenX + " "

LibGDX: Android SpriteBatch not drawing

亡梦爱人 提交于 2019-12-11 02:14:45
问题 I'm having a hard time getting a spriteBatch to render in LibGDX. It shows when I run it for the desktop, but not on Android. I sprite I'm trying to render is the star background. Desktop: http://i.stack.imgur.com/6a4m5.png Android: http://i.stack.imgur.com/mOvo2.png Here's my code: @Override public void render(float delta) { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glClearColor(0, 0, 0, 1); update(delta); spriteBatchBack.begin(); sprite.draw(spriteBatchBack

How to combine Box2d bodies?

可紊 提交于 2019-12-11 01:54:06
问题 I have a texture which is not just a box or circle and my body needs to be the same of this shape so I was thinking to combine multiple bodies to achieve my desired shape, is it even possible? or there are better ways to do it? I'm using java with libgdx framework. 回答1: The shape of body is being defined by Fixture instance. Since body can have multiple fixtures you can combine many shapes as you wish. To create many fixtures you jest call createFixture method many times with others

Code in Java(Android Studio) libgdx, how to calculate for a projectile [closed]

不羁岁月 提交于 2019-12-11 01:37:02
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 2 years ago . Code in Java(Android Studio) libgdx,... how to calculate for a projectile for a circle(like a ball) when you click/touch the screen and how would you display it? like shooting a basketball ....for example circle is in 0,0(x,y) with an angle of 50 degrees... THANKS!! 回答1: If you're

FrameBuffer to file inside libgdx or OpenGL

孤者浪人 提交于 2019-12-11 01:16:57
问题 I am trying to take screenshots in the most efficient way. I thing using a FrameBuffer is the most efficient way of taking screenshots because i can process the data in different thread than rendering thread. How can i get the information from FrameBUffer and transfer it to a file? FrameBuffer m_fbo; render(){ m_fbo = new FrameBuffer(Format.RGB565, (int)(w * m_fboScaler), (int)(h * m_fboScaler), false); m_fboRegion = new TextureRegion(m_fbo.getColorBufferTexture()); m_fboRegion.flip(false,

LibGDX fonts with mipmapping drawn as black squares

雨燕双飞 提交于 2019-12-11 00:54:12
问题 I've encountered some issues with LibGDX's filtering. Fonts work fine without using mipmaps, but when I add them the text renders as a series of black boxes. Here's the method I use to generate a font. public static BitmapFont generateFont(String fontPath, int size, String chars){ FileHandle fontFile = Gdx.files.internal(fontPath); FreeTypeFontGenerator generator = new FreeTypeFontGenerator(fontFile); FreeTypeFontGenerator.FreeTypeFontParameter params = new FreeTypeFontGenerator

(libGDX android in eclipse) unable to instantiate activity ComponentInfo

无人久伴 提交于 2019-12-11 00:28:34
问题 I just started Android Game Development and I ran into a stupid problem. I want to run an application on my phone or virtual machine and I'm getting this error: 01-11 21:16:45.362: E/AndroidRuntime(19063): FATAL EXCEPTION: main 01-11 21:16:45.362: E/AndroidRuntime(19063): Process: com.mygdx.game, PID: 19063 01-11 21:16:45.362: E/AndroidRuntime(19063): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.mygdx.game/com.mygdx.game.AndroidLauncher}: java.lang

LibGdx GLES2.0 cube texel stretching

◇◆丶佛笑我妖孽 提交于 2019-12-11 00:25:25
问题 I've been programming OpenGL on Windows/SDL for a few years and am able to do quite a lot of advanced things with it. I've switched over to Android and libgdx and over the past few days have tried to put a simple demo together, just a spinning cube. Using libgdx's ObjLoader and Mesh classes, I loaded a cube mesh exported from blender(with normals and uv coords), and tried to apply a texture, and it draws a cube, but seems to only uses one texel from the texture to cover the whole model. I've