libgdx

LibGDX example game Thrust Copter lags

南笙酒味 提交于 2019-12-11 00:22:57
问题 I have read LibGDX Game Development Essentials book and there you can find Thrust Copter game example. Problem is if you run this game you will see little lags when you look at the stars or obstacles, just look carefully. Can somebody explain me why is this happening? Because I am making a game and I have a similar problem with this issue, when I drawing and moving objects I can see lags. Thanks! 回答1: I probably found out why this is happening. The problem is described and solved here.

ClassNotFound for AppletLoader when exporting a libGDX applet

ⅰ亾dé卋堺 提交于 2019-12-11 00:14:05
问题 I tried following this to export my libGDX game as a Java applet. The guide was a bit confusing so I might have done something wrong here. This is what I did: My libGDX game, in Eclipse, looks like this: Game Game-Android Game-Desktop The desktop game works fine. As the guide says, the desktop project uses the Lwjgl backend. Then I created a GameApplet.java in Game-Desktop/src/my.package.name containing package my.package.name; import com.badlogic.gdx.backends.lwjgl.LwjglApplet; public class

How to properly implement CheckBox in LibGDX

谁说我不能喝 提交于 2019-12-10 23:08:22
问题 I want to implement a checkbox in my game for switching volume on and off. I have this so far, but it's not working properly: MusicOnOff.addListener( new InputListener() { public void touchUp (InputEvent event, float x, float y, int pointer, int button) { MusicOnOff.toggle(); } public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) { System.out.println("Music: " + MusicOnOff.isChecked()); return true; }; }); EDIT: Ok, never mind. It's toggling with the right

calling render method from another class

六月ゝ 毕业季﹏ 提交于 2019-12-10 22:28:15
问题 So I am trying to generate a 5x5 grid with 2d array, but when I try to call render method that is responsible for size it does not work. Furthermore, I using rectangle boxes as my images in grid. They render really small. package ksmd.tiles.Screens; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import ksmd.tiles.Tiles; import ksmd.tiles.UI.Tile;

How can i rotate an image over its x axes in libgdx?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 22:01:56
问题 I'm trying to rotate an image over its x axes but its not working Texture one = new Texture(Gdx.files.internal("img/one.jpg")); oneImg = new Image(one); oneImg.setOrigin(oneImg.getWidth() / 2, oneImg.getHeight() / 2); oneImg.setPosition(stage.getWidth() / 2-32 , stage.getHeight()/2); oneImg.setScale(2f,2f); oneImg.addAction(rotateBy(360, 0.5f)); 回答1: You can rotate your texture right when you draw it on the batch. SpriteBatch.draw(textureRegion.getTexture(), x, y, originX, originY, width,

Numeric keypad by default using libgdx

吃可爱长大的小学妹 提交于 2019-12-10 21:37:06
问题 I have 3 TextField s to introduce the day, month and year. At the moment i show the KeyPad , but the user needs to switch to the numeric KeyPad manually. How can I set up a numeric keypad by default for a textfield in libgdx? 来源: https://stackoverflow.com/questions/22982226/numeric-keypad-by-default-using-libgdx

Android dialog : Is there a way to make background android UI clickable while dialog is displayed?

假装没事ソ 提交于 2019-12-10 21:27:08
问题 Currently, I am using Libgdx for making app with lots of animation. I am trying to use android Dialog for showing paragraph with html tags through Interface. While, I can change dim color of background UI back to normal with following code. paragraphDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND); Is there anything I can do to make background UI work? (Button click, textview focus etc) And, I have tried GlyphLayout of Libgdx for paragraph. It frequently crashes &

3D Model with Diffuse AND Normalmap texture

隐身守侯 提交于 2019-12-10 20:51:22
问题 I want to load a 3D model with a diffuse texture and a normal map using the asset loader of libgdx. As far as I figured out the fbx (and the converted g3dj/g3db) format can contain a diffuse texture, as I could see in the fbx-conv example. (knight.g3db) How do I add a normal map texture to it? Do I have to write my own shader for that or is there a simplified method for that? (like for the diffuse texture) 回答1: Normal map is supported from FBX all the way up to the DefaultShader class. So if

Android LiveWallpaper: start rendering below notification bar

我怕爱的太早我们不能终老 提交于 2019-12-10 20:49:14
问题 I'm doing a Android LiveWallpaper with LibGDX and I want my application to start rendering below the notification bar, and not under it. In the picture: Left is what I get, right what I want. Any advice? Thanks 回答1: You could use this: Height of Android statusbar And simply draw under it. If you are using Worldunit based drawing (not Pixelbased) you can use this: Gdx.gl.glViewport(x, statusbar.height, width, height); To show you what this does look at this link: Keep aspect with black borders

LibGDX: Make all actors on a stage unchecked

自闭症网瘾萝莉.ら 提交于 2019-12-10 19:52:34
问题 I have a stage with multiple buttons on it that basically serves as a toolbox. I want the user to be able to select between the different items that are displayed; therefore when the user selects one item, all others have to be deselected. I thought of doing that with the checked property of libGDX buttons. However, I don't know how to programatically uncheck a button and to acces all actors on a stage in the simplest possible way. I can't provide code becuase as I said, I don't even know how