libgdx

Rotation of Orthographic Camera

牧云@^-^@ 提交于 2019-12-21 18:36:43
问题 I am able to rotate camera with this code camera.zoom = 3//in constructor if(camera.zoom>1) { camera.zoom-=0.01f; camera.rotate(15); } this is done in render, Now zooming effect works properly but when zooming completes my screen is stay rotated with current angle. like below. I want that my screen stops after zooming at 0 degree. 回答1: In your code snippet **camera.zoom=3;** and in each iteration you are zooming camera by 0.01 till camera.zoom > 1 so you have total 20 iteration for zooming

how to setup a libGDX project via proxy

喜你入骨 提交于 2019-12-21 17:43:09
问题 I am using the libgdx project creator ( gdx-setup.jar ) to setup a new project. However, I am using a proxy connection on my Windows machine to access the internet and the gdx-setup.jar isn't able to detect the settings, thus I cannot download the required jar files and generate any project. How and where do I change the java proxy settings so that I am able to achieve this? PS: I have already tried to edit the settings under Control Panel->Java->Network Settings but to no avail. 回答1: From

What is the simplest way to make Image touchable in libgdx?

社会主义新天地 提交于 2019-12-21 11:59:05
问题 Here's my code: @Override public void resize(int width, int height) { super.resize(width, height); stage.clear(); // background image Image backImage = new Image(backTexture); backImage.setX(0); backImage.setY(0); backImage.setWidth(800); backImage.setHeight(480); // start game image Image startImage = new Image(startTexture); startImage.setX(415); startImage.setY(180); startImage.setWidth(323); startImage.setHeight(69); stage.addActor(backImage); stage.addActor(startImage); } I'm creating

LIBGDX: How do I draw a filled polygon with the shaperenderer?

拟墨画扇 提交于 2019-12-21 07:56:37
问题 I have defined a shape using an array of vertices: float[] points = new float[]{50,60,50,70,60,70, 60,60,50,60}; And I am drawing this here: shapeRenderer.polygon(floatNew); This just gives an outline of the shape. How do I fill it with colour? Thanks 回答1: Currently, ShapeRenderer supports polygon drawing (by line) but not filling. This code is clipping the polygon on triangles, and then drawing each triangle separately. Edit ShapeRenderer.java like this: EarClippingTriangulator ear = new

Libgdx game crashes on Android

一曲冷凌霜 提交于 2019-12-21 07:02:55
问题 I made a game using libgdx and it runs fine on both desktop and android before. I'm not sure if its because I started using box2d physics engine and liquidfun particles,what basically happens is that when I click play on my game it start loading then after loading it should go to the gameScreen, but it crashes then says "Unfortunately, myGame has stopped". error message: E/AndroidRuntime: FATAL EXCEPTION: GLThread 3764 Process: com.nivekbryan.puffypuff, PID: 8416 java.lang

LibGDX 3D increase perfomance

喜欢而已 提交于 2019-12-21 06:25:24
问题 I'm working on a 3D game. The game requires around 100 cubes to work, all cube have be dynamic. I don't really know how much perfomance is required for a game like this, but i'm testing with a tablet with Mali-400 MP2 GPU, 1 GB ram, 1.5 GHz dual core. I know about rendering all of the cubes in one mesh, but then i can't move all of them separately. This setup gives me a very vacillating fps. Jumping between 20 and 50, mostly under 30. (In emulator 10-15) When the game starts, i build an

Java LibGDX How to parse an JSON?

萝らか妹 提交于 2019-12-21 06:23:03
问题 I have a json file with content like this: { players: [ { name: "", hp: 100 }, { name: "", hp: 120 } ], weapons: [ { name: "Desert Eagle", price: 100 }, { name: "AK-47", price: 150 } ] } How to parse it into an array of weapons? I already get content of this file as String. Then I use libgdx JsonReader: JsonValue json = new JsonReader().parse(text); Also I have a class for Weapons: class Weapon { private String name; private int price; } What should I do next to put all the weapons into an

Java LibGDX How to parse an JSON?

你离开我真会死。 提交于 2019-12-21 06:21:30
问题 I have a json file with content like this: { players: [ { name: "", hp: 100 }, { name: "", hp: 120 } ], weapons: [ { name: "Desert Eagle", price: 100 }, { name: "AK-47", price: 150 } ] } How to parse it into an array of weapons? I already get content of this file as String. Then I use libgdx JsonReader: JsonValue json = new JsonReader().parse(text); Also I have a class for Weapons: class Weapon { private String name; private int price; } What should I do next to put all the weapons into an

Java LibGDX How to parse an JSON?

半腔热情 提交于 2019-12-21 06:21:05
问题 I have a json file with content like this: { players: [ { name: "", hp: 100 }, { name: "", hp: 120 } ], weapons: [ { name: "Desert Eagle", price: 100 }, { name: "AK-47", price: 150 } ] } How to parse it into an array of weapons? I already get content of this file as String. Then I use libgdx JsonReader: JsonValue json = new JsonReader().parse(text); Also I have a class for Weapons: class Weapon { private String name; private int price; } What should I do next to put all the weapons into an

Libgdx first person camera controll

邮差的信 提交于 2019-12-21 05:08:38
问题 I just started playing arround with 3D in libgdx. I allready know how to draw basic Model s and i tryed to play arround with the CameraController . Now i want to create a FirstPersonCamera or FirstPersonCameraController . I thought about extending PerspectiveCamera and adding a MyMovingObject target to it. The MyMovingObject would hold a x, y, z position , where y is a constant value, cause i can't move up/down at the moment. So my movement is basicly in 2D. The MyMovingObject would also