libgdx

Fullscreen Libgdx HTML5 not working on mobile

别来无恙 提交于 2019-12-11 17:24:58
问题 My function to toggle fullscreen: public void toggleFullScreen() { if(!Gdx.graphics.isFullscreen()) Gdx.graphics.setFullscreenMode(Gdx.graphics.getDisplayMode()); else Gdx.graphics.setWindowedMode(App.WIDTH, App.HEIGHT); } Works on desktop but not on mobile, why? 回答1: Does not work because the functionality is not supported by libgdx' HTML backend. Could be changed, you should open an issue or PR. EDIT: After checking the backend source code, I must change my statement on SO. The code is in

Need to know when collision is begin and end box2d

懵懂的女人 提交于 2019-12-11 17:08:51
问题 public class Contact implements ContactListener { @Override public void beginContact(Contact contact) { Fixture fa = contact.getFixtureA(); Fixture fb = contact.getFixtureB(); if (fa.getFilterData().categoryBits==16){ ((Gamescreen)fa.getUserData()).starttouch(fa,fb); } @Override public void endContact(Contact contact) { Fixture fa = contact.getFixtureA(); Fixture fb = contact.getFixtureB(); if (fa.getFilterData().categoryBits==16) { ((Gamescreen)fa.getUserData()).endtouch(); } This code works

How to make a box2d Body object collidable with the other Body

不想你离开。 提交于 2019-12-11 16:17:18
问题 How to make a com.badlogic.gdx.physics.box2d.Body object collidable with the other Body in Scene2d(libgdx) while working with the Box2d extension, when both the body types are Dynamic.? 回答1: if I understand correctly, your question can this helps where to create the Body2, add this example in your code: .// YourBody2 = YourWorld.createBody(bd); YourBody2.createFixture(fixDef).setUserData("YourBody2"); where to create the Body1, add this example in your code: .// YourBody1 = YourWorld

Blank black screen while shifting between activities android

回眸只為那壹抹淺笑 提交于 2019-12-11 16:16:59
问题 Hi Guys I have 2 activities, 1 is in Android Native(Extends Activity) and 2 is in LIBGdx extends AndroidApplication. I go from activity 1 to activity 2 and then come back to activity 1 by pressing the back key, then I come back to activity 2 again. This time activity 2 is black and black in color. Does it has anything to do with libgdx or its an android issue? Thanks 回答1: This sounds like libGdx is losing the openGL context. libgdx will get this back automatically when the app goes out of

How can i add 'java.awt.geom' class in android?

浪尽此生 提交于 2019-12-11 16:07:11
问题 I am making a game in LibGDX. When i run in libgdx-desktop, than it works fine. But when i run it in libgex-android than i get this error: ERROR: Could not find class 'java.awt.geom.Line2D$Float[]', referenced from method com.ia.Entity.Player.hit So libgdx-android can't seem to find line2d class. Any idea how can i fix this? Is there way i can just add a jar file or some thing in my libgdx-android project? I really want to use 'java.awt.geom.line2d.flot[]' in android, but if answer is no,

LibGDX Android blackscreens at a certain screen

孤人 提交于 2019-12-11 14:56:36
问题 To explain the Situation: I've got a LibGDX Game runnig without Problems as Desktop Project... But as soon as I install the App onto my Android device, It only shows the first screen... In this case, it is a Menu-Screen which obviously needn't much resouces...The Textures are not in resolutions of powers of two but I'm using OpenGl2.0. When I'm now changing the Screen to the actual Game-Screen, my device just blackscreens. This Screen contains a Box2d World with lots of Objects, a big Texture

Libgdx rotate an actor on its Y axis

最后都变了- 提交于 2019-12-11 14:52:49
问题 I'm trying to do a card flip animation in Libgdx. Sprites and Actors support only rotation clockwise/counter-clockwise. So I thought that I can achieve that by using the Rotate function in the camera object. The problem is that it affects the whole stage and not just the actor. How can I achieve this affect without creating a new stage? 回答1: Well you have never defined what the back side of a card looks like, since actors are just images ;) What you could do is to use two images, one for the

How to add external library dependency to libgdx project?

╄→尐↘猪︶ㄣ 提交于 2019-12-11 14:48:12
问题 I am trying to add a simple library like json.org to my libgdx project. The dependencies were properly configured in the gradle file. The project is not compiling any longer. I think the problem is because the GWT compiler is not able to find the source code. Did this happen to someone else before? Any possible solution? Thanks. 回答1: What errors are you getting ? Try to issue the command from the command line: gradlew --refresh-dependencies Got this one from the Universal Tween Engine

FATAL EXCEPTION: GLThread 84: FileNotFoundException Android logcat errors [duplicate]

我与影子孤独终老i 提交于 2019-12-11 14:27:34
问题 This question already has answers here : FileNotFoundException Android logcat errors (3 answers) Closed 5 years ago . My game runs correctly when I test the desktop version, but when I launch an android emulator and and try to run the game on the emulator the game closes and I get the logcat errors: 10-28 08:00:53.528: E/AndroidRuntime(1203): FATAL EXCEPTION: GLThread 84 10-28 08:00:53.528: E/AndroidRuntime(1203): Process: com.mkgame.game1.android, PID: 1203 10-28 08:00:53.528: E

LibGDX : Detecting where a Ray hits a 3D object

橙三吉。 提交于 2019-12-11 13:57:35
问题 I am building a 3D game in LibGDX, I have used the following code to work out if I touch a object, but how do I find out at what point it collides. I am not using Bullet as I want to make a HTML5 port public int getObject (int screenX, int screenY) { int result = -1; float distance = -1; Ray ray = camera.getPickRay(screenX, screenY); Vector3 pos = new Vector3(camera.position); for (int i = 0; i < boxInstance.size; i++) { GameObject instance = boxInstance.get(i); instance.transform