libgdx

LibGDX text not rendering properly on larger screens

给你一囗甜甜゛ 提交于 2020-01-06 15:50:14
问题 On my 854 x 480 LG Leon it renders fine, but on a larger screen resolution (2560 x 1440) this happens: http://imgur.com/a/rcbJK. The code for processing the text is: http://imgur.com/a/c316e. I've tried expanding the bounds of the Label because I thought that it might be constricting the text, but it still won't display properly. What could be causing this? 回答1: The different mobile phone has the different aspect ratio in their screen size . that is the reason it shows different different

How to stop drawing a SpriteBatch animation in libgdx?

风格不统一 提交于 2020-01-06 14:38:09
问题 Hi I have a spritebatch animation in Libgdx. It only plays once and when it is finished I want to stop drawing it so it doesn't appear on the screen. I have a boolean that checks if it is still alive i.e. animating and it is set to false when the animation is finished using isAnimationFinished however it stays on the screen and I am not sure why even though a log print shows it changing to false on finish. Does anyone have any idea why this is? Thanks for your help. The following code is from

How to add checkstyle to a libGDX project?

淺唱寂寞╮ 提交于 2020-01-06 07:56:52
问题 I've the following libGDX project: https://github.com/Glusk2/sprouts I've tried adding checkstyle to the entire project in the root build.gradle file, like so: // ... allprojects { apply plugin: "eclipse" apply plugin: "idea" apply plugin: "checkstyle" // ... } // ... and added config/checkstyle/checkstyle.xml to the root project. But it doesn't work. I get this error after running ./gradlew build connectedCheck : :android:compileJava <path-to-project>\sprouts\android\src\com\github\glusk2

How to add checkstyle to a libGDX project?

一曲冷凌霜 提交于 2020-01-06 07:56:26
问题 I've the following libGDX project: https://github.com/Glusk2/sprouts I've tried adding checkstyle to the entire project in the root build.gradle file, like so: // ... allprojects { apply plugin: "eclipse" apply plugin: "idea" apply plugin: "checkstyle" // ... } // ... and added config/checkstyle/checkstyle.xml to the root project. But it doesn't work. I get this error after running ./gradlew build connectedCheck : :android:compileJava <path-to-project>\sprouts\android\src\com\github\glusk2

why DirectionalLight is not casting shadow?

元气小坏坏 提交于 2020-01-06 05:34:35
问题 Code: Color color = new Color(1f,1f,1f,0.9f); DirectionalLight directionalLight = new DirectionalLight(rayHandler,200,color,-90f); directionalLight.setSoftnessLength(0); Result: When light falls directly from above, why it is not casting shadows from boxes? 回答1: This could be caused by a few things. Some things to check: Check if your RayHandler is set to blur. Blurring with small objects can hide shadows. Check the Shadows are enabled in the ray handler. Check the ambient light is off or

Why excatly shouldn't I use LibGDX's createBox or createRect?

烂漫一生 提交于 2020-01-06 04:10:26
问题 I'm currently in the process of creating a voxel engine in order to familiarize myself with many of the concepts involved, It also happens to be an exercise in optimization for me. When searching around I've seen multiple sources across several websites suggust that I not use ModelBuilder().createBox() or createRect() to do anything but troubleshooting. Instead they recommend creating your own cube models in something like blender, than using those in place of createBox. I've just finished

libGDX Pixmap and Texture performance

人走茶凉 提交于 2020-01-06 03:26:30
问题 I have a huge amount of 2d images in my game, with multiple layers. I use spritebatch() and orthographicCamera() . I have some basic questions about performances : Does using Atlas is the faster way to load images ? What is faster to work with, Pixmap (and convert to texture before draw) or Textures? When i make a multiple layer image, should I use Texture.draw (or Pixmap.draw for Pixmap), make a final image and then render it ? Or should i render everything in the spritebatch.begin() and

How do I save and read an integer on android libgdx?

旧城冷巷雨未停 提交于 2020-01-06 03:18:06
问题 How do I save an integer that can be overwritten and then read it on android? I am using libgdx. I know how to do it for my desktop, but I want internal storage. 回答1: You should use libgdx Preferences . That way it will work cross-plattform! (including Android) Since you just want to store some Integer that should be just what you need. See example: //get a preferences instance Preferences prefs = Gdx.app.getPreferences("My Preferences"); //put some Integer prefs.putInteger("score", 99); /

FitViewport doesnt scale properly Libgdx

╄→гoц情女王★ 提交于 2020-01-06 03:12:09
问题 My problem is that my FitViewport where i keep my game world, scales in a way that in the X axis i can see black bars, but the Y axis seems to not mind the Gdx.graphics limits and it goes out of the screen. What seems to be happening is that even though i pass it a World width and world height, it fits itself in a wrong way, not minding the Y axis at all. PlayScreen constructor: gameCamera = new OrthographicCamera(); gameCamera.setToOrtho(false); gameViewport = new FitViewport(MyGame.WORLD

box2d(libgdx) stacked bodies not stable

柔情痞子 提交于 2020-01-06 02:58:42
问题 When I make a lot of bodies (rectangles) stacked on each other they don't stand stable. Even if restitution is set to 0. They are bouncy and fall off each other. I tried setting the density to a very low value, but it didn't change. Is there a possibility to fix that? shape.setAsBox(0.1f, 0.1f, new Vector2(0, 0), 0); bDef = new BodyDef(); bDef.type = BodyDef.BodyType.DynamicBody; bDef.position.set(0, 0); fDef.shape = shape; fDef.density = 0.001f; fDef.friction = 0.5f; fDef.restitution = 0.0f;