Posts

Showing posts with the label libgdx

Libgdx & Android Studio: Label doesn't show any text

Libgdx & Android Studio: Label doesn't show any text I am trying to add a Label text to the screen but nothing seems to be showing up: This is the code that I have coded and below has the screen that I ended up with, I could still change all colours but nothing shows up import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.utils.Align; import com.badlogic.gdx.utils.viewport.ScreenViewport; import com.badlogic.gdx.utils.viewport.Viewport; public class FiraMain extends ApplicationAdapter { SpriteBatch batch; private Skin mySkin; private Stage stage; @Override pu...

Libgdx, FPS drop down after touch

Libgdx, FPS drop down after touch I've write a very simple test with framework, Here my code : public class AndroidLauncher extends AndroidApplication { private Handler handler; @Override protected void onCreate (Bundle savedInstanceState) { super.onCreate(savedInstanceState); AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); initialize(new GameView(), config); } public static final class GameView implements ApplicationListener { private GLProfiler profiler; @Override public void create() { profiler = new GLProfiler(Gdx.graphics); } @Override public void resize(int width, int height) { } @Override public void render() { DebugLog.d("fps "+ Gdx.graphics.getFramesPerSecond()); } @Override public void pause() { } @Override public void resume() { } @Override public void dispose() { } } } When i run in my Android phone ( android 4.4.2 , Huawei ) ...

LibGDX revolute joint make angle difference between body and joint

Image
LibGDX revolute joint make angle difference between body and joint I been creating tank game that has tank body and tube in separate body and connected together with revolute joint, but this make an angle difference between them There is revolute joint: RevoluteJointDef jointDef = new RevoluteJointDef(); jointDef.bodyA = tankBody; jointDef.bodyB = tankPipeBody; jointDef.localAnchorA.set(tankBody.getLocalCenter().add(0, 1.6f)); jointDef.localAnchorB.set(tankTubeBody.getLocalCenter().add(3.2f, 0)); jointDef.collideConnected = false; jointDef.enableMotor = false; jointDef.referenceAngle = 0; jointDef.enableLimit = true; jointDef.lowerAngle = (isLeftPlayer ? -180 : 0) * MathUtils.degRad; jointDef.upperAngle = (isLeftPlayer ? -180 : 0) * MathUtils.degRad; But when I was shooting from tube position, bomb body appear from end of green line (joint line) By clicking "Post Your An...