libgdx

how do I drag an object in libgdx using box2d?

我们两清 提交于 2019-12-06 13:38:06
I have added objects to a box2d world in libgdx . I am wondering if it was possible to drag objects with the mouse? If so, how? thanks! There are a couple of options here. You can use a mouse joint or you can use a kinematic body and set it's position manually. A good example of how to use a mouse joint check this out: http://code.google.com/p/libgdx-backend-android-livewallpaper/source/browse/gdx-backend-android-livewallpaper-example/src/com/badlogic/gdx/tests/box2d/Box2DTest.java?r=ba02aaf34a8ca07daa0c30493bab993067c652f9 If you want to use a kinematic body you would do this: in render():

Can I have Android Views overlayed on top of the libgdx GL surface?

南楼画角 提交于 2019-12-06 12:54:23
问题 I would like to display some custom views ( e.g. TextViews with Arabic/Asian text) on top of everything that happens in libgdx's OpenGL Surface (<--I assume it's a surface view). Is this possible? How? The motivation is that I have a proven component for displaying text in my existing code and I would like to keep using this. I have used other GLSurfaceViews with View hierarchies before. Just wondering how/if this can be done in libgdx. Performance doesn't matter all to much because the "game

libGDX - Google Play Game Services in Android Studio

泄露秘密 提交于 2019-12-06 11:54:26
问题 After migrating to Android Studio from Eclipse, I was struggling at best with it. Problem was that most guides and tutorials you could find are for Eclipse , but if you can find one for Android Studio, it is missing most important parts - implementing libraries or 3rd party code. After week of problems and errors here is a guide 回答1: Requirements: Google play services and Google Repostory (under Extras in SDK manager), BaseGameUtils Firstly we need to add BaseGameUtils as Module: then select

libgdx - ShapeRenderer in Group.draw renders in wrong colour

二次信任 提交于 2019-12-06 10:20:12
问题 MyGroup : public class GShape extends Group{ private ShapeRenderer shape; public GShape() { super(); shape = new ShapeRenderer(); } @Override public void draw(SpriteBatch batch, float parentAlpha) { super.draw(batch, parentAlpha); shape.begin(ShapeType.Line); Gdx.gl10.glLineWidth(5); shape.setColor(1, 1f, 1f, 1f); shape.line(0, 0, 200, 100); shape.end(); } } Main : public class GameControl implements ApplicationListener { private Stage stage; private GShape gShape; @Override public void

Libgdx tween not working on Android

。_饼干妹妹 提交于 2019-12-06 09:51:40
I'm developing my first android game with libgdx, using as a base this amazing tutorial ( http://www.kilobolt.com/day-11-supporting-iosandroid--splashscreen-menus-and-tweening.html ). Everything works properly except for the tweening that I’m using in the splash screen to show the logo of my “company”. The weird part is that the logo works just fine in the desktop version, but in the android version is not being showed. I’m using the same class that they used in the app developed in the tutorial. By the way, this app’s splash screen works fine in both versions. I have compared my app and the

LuaJ and Android: cannot bind class

被刻印的时光 ゝ 提交于 2019-12-06 09:46:02
问题 I am currently writing a game engine in Java using the LibGDX framework. For several months now, I have successfully used LuaJ 3.0 with my engine. I have had no problems getting scripts to run on Android (tested on two devices) or Desktop (in and out of Eclipse). However, when I tried to deploy to Android today, I got the following error: org.luaj.vm2.LuaError: script:2 vm error: java.lang.ClassNotFoundException: com.javamon.console.ScriptPlayerCreate The line of the script causing this error

Is it possible to skew actor in libgdx

半世苍凉 提交于 2019-12-06 09:06:23
Is it possible to skew/shear actor (image) in libgdx ? I have found that skew is possible for sprites, as discussed here What about an actor? this worked for me: class SkewActor extends Actor { private TextureRegion tex; private Affine2 affine = new Affine2(); public SkewActor(TextureRegion textureRegion) { this.tex = textureRegion; } @Override public void draw(Batch batch, float parentAlpha) { Color color = getColor(); batch.setColor(color.r, color.g, color.b, color.a * parentAlpha); affine.setToTranslation(getX(), getY()); affine.shear(0.5f, 0); // <- modify skew here batch.draw(tex,getWidth

How do I use the Android compass orientation to aim an opengl camera?

被刻印的时光 ゝ 提交于 2019-12-06 08:53:09
问题 I'm using libgdx to develop a basic 3d game for android and I'm having difficulty properly orienting the camera given three rotation angles provided from the compass (azimuth - rotation about Z, roll - rotation about Y, pitch - rotation about X). I've had some slight success with the following code in that I can properly aim the virtual camera down the Z-axis and X-axis as I expected. (Angles are in degrees [-180,180]) camera.direction.x = 0; camera.direction.y = 0; camera.direction.z = 1;

Cannot load a TextureAtlas file in IOS using libgdx while loading through AssetManager

独自空忆成欢 提交于 2019-12-06 08:47:51
问题 I started porting my LIBGDX appliction to IOS. I Used Xamarin studio port of libgdx to run my application on IOS. I was successful in porting but the application failed to load the TextureAtlas File & BitmapFont File in Iphone Simulator. the code I tried was ... AssetManager assetManager = new AssetManager(); assetManager.load("packer/help.txt", TextureAtlas.class); if (assetManager.update()) { } ... The above code is running fine for me on Desktop and android but while running it on Iphone

Collision detection between a BoundingBox and a Sphere in libgdx

南笙酒味 提交于 2019-12-06 08:46:24
In my libgdx game I have 3D BoundingBoxes and Spheres for map and player objects. I want to calculate whether they collide with each other in order to properly simulate the motion of these objects. What method can I use to calculate whether these objects collide/intersect? You can use the following method: public static boolean intersectsWith(BoundingBox boundingBox, Sphere sphere) { float dmin = 0; Vector3 center = sphere.center; Vector3 bmin = boundingBox.getMin(); Vector3 bmax = boundingBox.getMax(); if (center.x < bmin.x) { dmin += Math.pow(center.x - bmin.x, 2); } else if (center.x > bmax