libgdx

Libgdx rotate ModelInstance

心不动则不痛 提交于 2019-12-05 06:29:14
问题 I am developing my first libgdx 3D game. Until now i can move arround in a maze-like (hardcoded) world, collision detection works. Also i have some enemies with working A* Pathfinding. I also loded my first (pretty ugly) Blender model, using FBX-Conv to get a .g3db file. For some reason the model lise on the floor instead of standing. Maybe i had some wrong settings when i exported it as .fbx . For that i tryed to rotate() him arround the z-Axis by 90 degrees by calling: modelInstance

How to make LibGDX Desktop go fullscreen by default

删除回忆录丶 提交于 2019-12-05 04:52:47
all. Just wondering how to make my desktop app go fullscreen upon start up. I am new to LibGDX and any help is greatly appreciated. Thank you. Just define fullscreen field in your LwjglApplicationConfiguration : LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration(); cfg.title = "yourGame"; cfg.width = 1024; cfg.height = 768; cfg.fullscreen = true; new LwjglApplication(new ...(), cfg); To start your game with fullscreen mode set the following flags in LwjglApplicationConfiguration in your Desktop launcher (the main() function) public static void main(String[] args) {

Showing trajectory indicator

烂漫一生 提交于 2019-12-05 04:50:17
问题 From the image you can see that the ball fired on the left that fire behind it, does not match the calculated trajectory. Im drawing the ball trajectory using an equation from a SO question, this is modified to take into consideration the box2d steps of 30 frames per second. This does calculate a valid trajectory but it does not match the actual trajectory of the ball, the ball has a smaller trajectory. I am applying a box2d force to the ball, this also has a density set and a shape. The

Proper using of scene2d's Stage in a game with a huge world

人盡茶涼 提交于 2019-12-05 03:46:09
If the whole "game world" is thousands of times wider than a viewport, and if I want to use scene2d to manage game objects as Actor s, should I create Stage object as wide as the whole world, or should the Stage be some area around current viewport but not the whole world? In other words, does a Stage with greater width and height consume more memory itself, even if I render objects only on a small viewport-sized part of it? I think you misunderstood what exactly a Stage is. A Stage doesn't really have a size itself. You don't specify a width or height or the Stage , you only specify the width

LibGDX - properly using Polygon class

妖精的绣舞 提交于 2019-12-05 03:05:34
问题 I have created Polygon object to wrap my airplane (size of airplane's TextureRegion is 256x74, but size of this one in a game is 70x20). So: TextureRegion[] texRegsAirplane = TextureRegion.split(textureAirplane, 256, 74); Rectangle bounds = new Rectangle(0, 0, 70, 20); Polygon polygon = new Polygon(new float[]{0,0,bounds.width,0,bounds.width,bounds.height,0,bounds.height,0,0}); After that in my update function I update position of it: public void update(float delta){ Vector2 v = getPosition()

Android Intent and startActivity in Libgdx (non Activity or AndroidApplication class)

让人想犯罪 __ 提交于 2019-12-05 02:54:25
问题 Please help me how to run the below code in Libgdx thread - in render(),create(),etc... public class MyGame implements ApplicationListener, InputProcessor { ... Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 300); startActivity(discoverableIntent); ..... Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse( "http://market.android.com/details?id=" + getPackageName()));

Can't add gdx-tools to libgdx gradle project

◇◆丶佛笑我妖孽 提交于 2019-12-05 02:09:08
I'm new in Gradle. I'm trying to add gdx-tools to my project: project(":desktop") { apply plugin: "java" dependencies { compile project(":core") compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-tools:$gdxVersion" } } I open my Desktop project, folder "Gradle Dependecies" and see "gdx-tools-1.0.1.jar". As I try to open it - nothing shows. So, when I try to use it ( I want to try pack images to

Click through an Actor in libGDX

心不动则不痛 提交于 2019-12-05 02:00:36
I have an overlay in my game that consists of an image of a screen, and a set of buttons that are "on" the screen. Screenshot: My Screen has one Stage . The Stage has a set of Group objects, which I think of as layers. The first group has the backgrounds, the groups in the middle has the game elements, and the frontmost group has the screen overlay. The overlay layer consists of one Image , the screen itself, and four TextButton (one in each corner). This would work great, if it weren't for the fact that I can't click on anything in the game layer as long as the image in the overlay layer is

How to change the size of an existing scene2d.ui widget in a window/table?

萝らか妹 提交于 2019-12-05 01:47:57
I'm attempting to resize a scene2d.ui window (which is basically a table that can be moved around) and its contents. So far I can only successfully change the window size itself, but not its contents. I'm doing it like this: window.setWidth(newTableWidth); textField.setWidth(newFieldWidth); window.invalidate(); <--- New size of window is drawn properly when invalidate() is called textField.invalidate(); <--- New textField size is NOT drawn, however In this case, the window contains a text field which I'm trying to resize along with the window, but only the window gets redrawn with its new size

LibGDX . draw multiline text

你离开我真会死。 提交于 2019-12-05 01:39:50
I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically and show whole text on the screen ? noone Either use \n for manual new lines and render the font via font.drawMultiLine(...) . Or use font.drawWrapped(...) with a wrap width to let libgdx wrap it automatically (manually added \n are still supported). Update: With libGDX 1.6 the draw methods were enhanced , and there is no further need for drawMultiLine and drawWrapped, so those were removed. Draw