libgdx

Libgdx Quiz- Using SQLite Database?

你。 提交于 2019-11-29 18:05:13
I have been learning Android development and using the Libgdx framework for over a month now and want to create a test app. The app i want to create is a quiz and im stuck on the situation on how i am going to store all the questions, answers. Being a web developer for many years i of course thought of a database but libgdx doesn't have much support for sqlite which leaves me stuck on how to achieve the storing without using a database. Does anyway know any way to use sqlite with libgdx or how i can achieve this another way, i would appreciate the help, thank you. I would not go with SQLite in

Libgdx and Box2d Detect Collision of two specific bodies

喜欢而已 提交于 2019-11-29 16:32:21
I have two bodies, both dynamic, one of them I have turned off the gravity and only want to turn it on when it is hit by my other body. I know I can set my own contact listener but I want to specify an action only if two specific bodies touch. Any one have any guidance? U can set the userdata of the body and use it like that public class GameColiision implements ContactListener { public GameColiision() { } @Override public void beginContact(Contact contact) { // TODO Auto-generated method stub Body a=contact.getFixtureA().getBody(); Body b=contact.getFixtureB().getBody(); a.getUserData(); if(a

Opening LibGDX project in Eclipse (ADT Bundle)

ε祈祈猫儿з 提交于 2019-11-29 16:10:18
Currently using ADT Bundle for Windows for developing Android applications. It has built-in a Eclipse IDE, and is easy and ready to use. (Just extract the .zip, no installing required) However, I want to develop a libGDX project using that Eclipse IDE. I have successfully generated a libGDX project using gdx-setup.jar . To import this generated project to Eclipse, this libGDX wiki says that in Eclipse IDE I should go to File -> Import -> Gradle -> Gradle Project But I don't find any Gradle in the Import window, here's the screenshot: I tried importing it using Existing Android Code Into

android.os.Bundle cannot be resolved in libgdx Android project

微笑、不失礼 提交于 2019-11-29 15:56:39
问题 I've just started using Libgdx to practice making games and I used the project creation .jar provided on the site to create the initial projects. However an error shows up in the Android project which says: android.os.Bundle cannot be resolved. I am using Eclipse for Java IDE. If I put the cursor over AndroidApplication which is underlined in red, it suggests that I configure the build path. I believe I have the Android SDK installed, because it worked a while back on a different workspace on

libgdx drawing arc curve

喜你入骨 提交于 2019-11-29 15:53:38
The arc function of libgdx instead of drawing a arc draws a pie segment (ie. has 2 lines connecting to the arc's origin) shapeRenderer.begin(ShapeType.Line); shapeRenderer.arc(x, y, radius, 30, 120); shapeRenderer.end(); Is there a solution to this problem so that libgdx can draw an arc curve similar to the html5 canvas arc function? Reading the source code, this seems built-in behavior: /** Draws an arc using {@link ShapeType#Line} or {@link ShapeType#Filled}. */ public void arc (float x, float y, float radius, float start, float degrees, int segments) { if (segments <= 0) throw new

libgdx android failed on launch

╄→гoц情女王★ 提交于 2019-11-29 15:40:38
This is my first time using libgdx and I would like to try the default application provided after the setup gdx-setup-ui . It runs fine when I hit the run button on eclipse as it has shown [2014-05-01 21:40:14 - my-gdx-game-android] Uploading my-gdx-game-android.apk onto device 'emulator-5554' [2014-05-01 21:40:15 - my-gdx-game-android] Installing my-gdx-game-android.apk... [2014-05-01 21:40:16 - my-gdx-game-android] Success! [2014-05-01 21:40:16 - my-gdx-game-android] Starting activity com.me.mygdxgame.MainActivity on device emulator-5554 [2014-05-01 21:40:16 - my-gdx-game-android]

How to detect when an actor is touched in libgdx?

不打扰是莪最后的温柔 提交于 2019-11-29 15:24:37
I am using "Gdx.input.isTouched()" in the render method of my Screen method, to know where is touched, but when the touch is dragged in the screen, it also activates the events i want only when an actor is touched. Is there any listener to know when an Actor is touched, but the event is not the dragged one, im doing it with sprites. Ludevik See this wiki page about scene2d in LibGDX. Specifically the part about Input handling. Basically you have to override one or more of these methods in your Actor: public boolean touchDown (float x, float y, int pointer) { return false; } public void touchUp

RayCasting in Libgdx 3d

社会主义新天地 提交于 2019-11-29 15:20:13
Alright so I've been trying for quite some time too Raycast in libgdx for 3d collision detection based on where im looking.. But I've drawn a blank and doesn't seem to be any documentation anywhere. Would someone be kind enough to send me in the right direction? It is actually really easy with libgdx to achieve what you are trying to do. The following is what I'm using to do a ray test and find the closest collision object that my ray would hit. Let's assume it is located in a class called BulletUtil . private static final Vector3 rayFrom = new Vector3(); private static final Vector3 rayTo =

How to track multiple touch events in Libgdx?

痴心易碎 提交于 2019-11-29 14:55:18
问题 I am making a racing game using Libgdx. I want to touch the half right side of screen to speed up, at the same time without removing previous touch point touch again another on the left side of the screen to fire a shot. I am unable to detect later touch points. I have searched and get Gdx.input.isTouched(int index) method, but cannot determin how to use it. My screen touch code is: if(Gdx.input.isTouched(0) && world.heroCar.state != HeroCar.HERO_STATE_HIT){ guiCam.unproject(touchPoint.set

Increasing the width of line drawn using Shape Renderer in LibGDX

浪尽此生 提交于 2019-11-29 14:51:20
I am drawing a line using Shape Renderer in LibGDX and i am using Orthographic Camera in my code, so to increase the width i used camera = new OrthographicCamera(); int lineWidth = 8; // pixels Gdx.gl10.glLineWidth(lineWidth / camera.zoom); Now, I get a wider line. But the problem arises when the screen power goes off and then turns on, the line becomes the normal one again. How to keep the width constant? Airton da Fonseca Granero ShapeRenderer has the method rectLine that is intended to be used to draw thick lines. It draws a rotated filled rectangle with the smaller opposite sides centered