libgdx

bugs in eclipse after installing LibGDX

ぐ巨炮叔叔 提交于 2019-12-24 08:39:08
问题 i had no project in eclipse, and i just followed the steps in this toturial: https://www.youtube.com/watch?v=S9fs1PVTyUc&src_vid=6i78aqugqds&feature=iv&annotation_id=annotation_4141831685 and it opened for me a few projects named: project, project-android, project-core, project-desktop, project-ios. and the project-android had an error. here is the code: package com.ak01.projext.android;* import android.os.Bundle;** import com.badlogic.gdx.backends.android.AndroidApplication; import com

Limit touch area to Texture area in libgdx

╄→гoц情女王★ 提交于 2019-12-24 08:28:20
问题 I load textures and convert them to sprites. The image below shows how typical sprite looks like. The shapes varies from sprites to sprite. I wont to move these sprites when user touches just the surface area. Currently I am using rectangle bounds to detect if user touched it or not. This approach is not clean becuase the texture is not a rectangle. As a consequence users can drag it without precisely touching it. The question is how to create a touch area just to represent the texture area

libgdx - How to set model rotation pivot?

拥有回忆 提交于 2019-12-24 08:04:05
问题 By default, the modelInstance is rotated by its centre (0,0,0), I want it to rotate by (0,2,2). I know that in other game engines, there is method like model.setRotationPivot(float) , is there any similar method in libgdx? // how to set rotation pivot? modelInstance.transform.set(position, rotation, scale); Thanks! 回答1: Late answer: As I know there is no method to set the pivot. I use a workaround for this. Vector3 vec3 = new Vector3(0, 2, 2); vec3.rotate(Vector3.Y, rotation); modelInstance

LibGDX - how to catch a backbutton inside a TextField with Android Keyboard visible?

自作多情 提交于 2019-12-24 07:29:43
问题 I'm trying to catch the Back button while the TextField is focused (keyboard is visible). I have already tried with Multiplexer - setting the ' BackProcessor ' on the top of the stages - it doesn't work: InputProcessor backProcessor = new InputAdapter() { @Override public boolean keyDown(int keycode) { if ((keycode == Input.Keys.BACK) ) { Gdx.app.log("INPUT", "BACK"); } return false; } }; InputMultiplexer multiplexer = new InputMultiplexer(backProcessor, loginStage,registerStage); Gdx.input

LibGDX - The window is not being cleaned every frame

柔情痞子 提交于 2019-12-24 07:14:47
问题 I am using LibGDX to build a simple game for android (based on flappy bird). It happens that when the bird (actor) moves it keeps the old images on the screen, something like this: I have no idea why this is happening... Here is my GameplayScreen class (that represents the game screen) public class GameplayScreen extends ScreenAdapter{ private FlappyBird _game; private OrthographicCamera _camera; private Stage _gameplayStage; private Bird _bird; private Image _background; public

How to draw rotated image on pixmap (LibGDX)

喜欢而已 提交于 2019-12-24 07:06:29
问题 How can I draw an image to Pixmap, but rotated by some angle, like I can do when drawing on Batch? There is no Pixmap method that has an angle as parameter, like batch drawing methods have. 回答1: Ok, here is the code I managed to make (actually to borrow and adjust from here: Rotate Bitmap pixels ): public Pixmap rotatePixmap (Pixmap src, float angle){ final int width = src.getWidth(); final int height = src.getHeight(); Pixmap rotated = new Pixmap(width, height, src.getFormat()); final double

Running my new code runs my old code?

谁说胖子不能爱 提交于 2019-12-24 07:04:12
问题 Somehow, whatever code I add to my program it does not run on my android device. It just runs my old code. I am constantly deleting my app from my phone in the App Manager. If I add new or change functionality the old code still runs. I even delete complete blocks of code that should obliterate functionality. But somehow all the old functionality remains in the app after reinstall. Simple example: On a TextButton click i shift some UI element by 200. This works great. When i delete the

ProGuard SimException

主宰稳场 提交于 2019-12-24 06:04:11
问题 I'm trying to get ProGuard to work, after roughly 4 hours of randomly trying options to try and get this amazing software to work. My project is using LibGDX and KryoNet. This is my current ProGuard configuration: -verbose -dontobfuscate -dontwarn android.support.** -dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication -dontwarn com.badlogic.gdx.utils.GdxBuild -dontwarn com.badlogic.gdx.jnigen.BuildTarget* -dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild

Assetmanager and Skin dispose of Font(/Skin)

冷暖自知 提交于 2019-12-24 05:54:54
问题 I am using the libgdx AssetManager to load a skin with a custom font. When I call assetmanager.dispose() it throws an Exception: com.badlogic.gdx.utils.GdxRuntimeException: Pixmap already disposed! at com.badlogic.gdx.graphics.Pixmap.dispose(Pixmap.java:315) at com.badlogic.gdx.graphics.g2d.PixmapPacker$Page$1.dispose(PixmapPacker.java:384) at com.badlogic.gdx.graphics.g2d.BitmapFont.dispose(BitmapFont.java:315) at com.badlogic.gdx.scenes.scene2d.ui.Skin.dispose(Skin.java:416) at com.badlogic

Libgdx Screen NullPointerException when referencing another class

老子叫甜甜 提交于 2019-12-24 05:49:10
问题 I have clicked every Google result I could find that might help me with no success. I have built a game that I would like to implement a full UI with. In my game I have separate classes for my sprites, so while doing several tutorials for making screens I tried to implement something where I could use those separate classes for getting textures, current frames, etc. I have gotten to the point where I can switch between two screens if they are not referring to anything outside themselves, but