libgdx

libgdx my first triangle tutorial not working?

六月ゝ 毕业季﹏ 提交于 2019-12-13 04:29:55
问题 Following the My First Triangle tutorial from this link: My First Triangle the desktop version works perfectly fine, however when i deploy the android emulator version i get this error: Unfortunately, MyFirstTriangleAndroid has stopped. Any suggestions to help fix this problem? I'm using libgdx-0.9.4. here is the catlog: 06-10 15:32:00.623: D/dalvikvm(528): Not late-enabling CheckJNI (already on) 06-10 15:32:01.653: E/dalvikvm(528): Could not find class 'com.test.myfirsttriangle

BluetoothAdapter.getDefaultAdapter() throws exception

二次信任 提交于 2019-12-13 04:16:53
问题 I try to add Bluetooth to my libgdx android project. I added the following to the Android manifest: <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.BLUETOOTH" /> I tried to run mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); in non activity class - exception . I have read that the class should be activity class. Okay. I have created public class BluetoothServer extends Activity { ... public void

LibGdx What is the proper way to copy an Actor?

偶尔善良 提交于 2019-12-13 04:07:02
问题 I have a custom implementation of Image that animates. I want to make multiple copies of an instance of this class using the minimum memory and processor time for rendering and copying. How do I go about it? Is it just easiest to recreate it whenever I need another one or is there some proper or suggested method for copying Image instances. I ask this because I can't find a copy constructor and I don't know if .clone() is implemented in Image. 回答1: If you really want to take care about Memory

Box2D via libGDX: How to create one MouseJoint per body for separate Android touches?

落爺英雄遲暮 提交于 2019-12-13 03:59:05
问题 What's up everyone, Thanks for your time. I am making a Pong clone, and I want to restrict Box2D to two MouseJoints maximum; one MouseJoint maximum per paddle. The MouseJoints should be created only if one of the user's two touches lands within either of the two paddle's boundaries. I am getting a weird result with my code. If my first touch lands within the left paddle and my second touch lands outside of either paddle, a second MouseJoint is created on the left paddle (see attached image).

error with loading screen assetmanager libgdx java

喜夏-厌秋 提交于 2019-12-13 03:42:05
问题 I currently have 2 classes, an Assets class and a loading screen class: Assets class: public class Assets { public static AssetManager manager = new AssetManager(); public static void queueLoading() { (..) manager.load("sound/startScreen.mp3", Music.class); (..) while(!manager.update()) { System.out.println("Loaded: " + manager.getProgress() *100 + "%"); } } public static boolean isLoaded() { if(manager.getProgress() >= 1) return true; return false; //return manager.update(); } } Loading

Libgdx Camera - Setting position having no effect

落花浮王杯 提交于 2019-12-13 03:37:35
问题 I cannot for the life of me figure out why my setting the camera position (both in the create method and the update method) have no effect. The update is being called by my main class I already checked. Here is code: package com.moneylife.zombietown; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; public class GameManager { SpriteBatch spriteBatch; float deltaTime;

Move a shape to place where my finger is touched

三世轮回 提交于 2019-12-13 03:15:08
问题 @Override public void create() { batch = new SpriteBatch(); shape = new ShapeRenderer(); velocity = new Vector2(100, 0); position = new Rectangle(0, 5, 100, 100); font = new BitmapFont(); font.setColor(Color.BLACK); font.getData().scale(3f); camera = new OrthographicCamera(); confCamera(); } @Override public void render() { if(Gdx.input.isTouched()) position.x = Gdx.input.getX() - position.width/2; position.y = (Gdx.input.getY() - position.height/2); shape.begin(ShapeRenderer.ShapeType.Filled

Why does an Admob banner ad doesn't show to me? [Android, libGDX]

最后都变了- 提交于 2019-12-13 03:12:06
问题 I have a problem: I've installed an Admob ad banner in my app and when I'm using this command to builder: builder.addTestDevice( "0277F42DBB49E3FD56F9EFFE3C4380B4" ) Everything works (I mean, I see banner with similar text "congrats, bla-bla-bla, etc". But. In published game, which of course has disabled this line (addTestDevice) it doesn't show. Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hypeofpipe

libgdx/assets What counts as “non static”?

邮差的信 提交于 2019-12-13 03:09:55
问题 Recently i have been working to get some libgdx projects working on Android. I have read that AssetManager should never be declared static as this causes issues on pause/resume. But what exactly can you get away with? public AssetManager assetsmanager; static public AssetManager assets; private void setup() { assetsmanager = new AssetManager(); assets=assetsmanager; .... seems to easy ? 回答1: If you don't make it static, then you have to do one of two things: Create the AssetManager and then

Libgdx how to set textfield based on inputs from keyboard?

一曲冷凌霜 提交于 2019-12-13 03:01:02
问题 Just started to use libgdx recently and i want to check how can i get the input from my keyboard to be displayed on the textfield ? Thanks. 回答1: If you are looking for the keyboard, then that link from Kumar will do, if you are trying to get Text to be displayed, then you need to grab the input from the Keyboard with an InputProcessor LibGDX InputProcessor However, to get input from the keyboard and still have input to any other items on your screen, you need to combine that with an