libgdx

Multiple cameras in libgdx ( probably similar in other frameworks )

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have been trying to solve this problem for two days and I have given up trying to find an existing solution. I have started learning libgdx and finished a couple of tutorials. And now I have tried to use all that I have learned and create a simple side scrolling game. Now, I know that there are libgdx examples of this, but I haven't found a one that incorporates Box2d with scene2d and actors as well as tiled maps. My main problem is with the cameras. You need a camera for the Stage (which as far as I know is used for the projection matrix

Background transparency in libgdx

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How can I make background of screen transparent if I use libgdx in Android? The code I tried to use doesn't work. Gdx . gl . glClearColor ( 0 , 0 , 0 , 0 ); Gdx . gl . glClear ( GL10 . GL_COLOR_BUFFER_BIT | GL10 . GL_DEPTH_BUFFER_BIT ); 回答1: Just found a solution! Just add this code to the class that extends AndroidApplication. AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration (); cfg . r = cfg . g = cfg . b = cfg . a = 8 ; cfg . useGL20 = false ; View view = initializeForView ( new LineDrawing (), cfg ); if

Mockito + PowerMock + TestNG + Libgdx

匿名 (未验证) 提交于 2019-12-03 01:06:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying add the powermock library to the working project, but I'm getting errors. How I add it: 1) AbsTest extends PowerMockTestCase 2) Build.gradle dependencies 3) In some test add @PrepareForTest({SomeClass.class}) . After this step this error occured. In build.gradle all libraries are included. Error occured in a place where initialize HeadlessApplication for use Gdx.* static vars. All tests in project extend this class: abstract public class AbsTest extends PowerMockTestCase { static { initGdx(); } protected static void initGdx() { //

LibGDX: Android SpriteBatch not drawing

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having a hard time getting a spriteBatch to render in LibGDX. It shows when I run it for the desktop, but not on Android. I sprite I'm trying to render is the star background. Desktop: http://i.stack.imgur.com/6a4m5.png Android: http://i.stack.imgur.com/mOvo2.png Here's my code: @Override public void render(float delta) { Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT); Gdx.gl.glClearColor(0, 0, 0, 1); update(delta); spriteBatchBack.begin(); sprite.draw(spriteBatchBack); spriteBatchBack.end(); stage.act(delta); stage

Libgdx setup UI gives 2 unexpected errors in new GWT project

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have run the setup ui, however, I get two different errors in the -html project than what is described in the tutorial: libgdx tutorial The tutorial error stated is as follows (which is an error I do not see): To fix the error of the HTML5/GWT project, go to the "Problems" view, right click the error message "The GWT SDK JAR gwt-servlet.jar is missing in the WEB-INF/lib directory" and select "Quick Fix". Click "Finish". The errors I have are: The project was not built since its build path is incomplete. Cannot find the class file for com

Libgdx app.exit() on Android not closing application

妖精的绣舞 提交于 2019-12-02 22:53:42
In my Android app developed with libGDX I use Gdx.app.exit() when the user tries to exit the game. This closes the game, but when the user restarts the app all the Textures are scrambled (beyond the point of using the app). I noticed that if I force close the app from a task-manager, then it will restart properly. Why does it happen? You have rediscovered the mismatch between the lifetime of Java objects (tied to the life of the application process) and the lifetime of texture objects (tied to the life of the OpenGL context which is tied to the visibility of the Activity). On app "exit", just

java- libgdx build.gradle is not the same for AdMob

爷,独闯天下 提交于 2019-12-02 22:51:31
问题 i am building an app for android and using libGdx, i checked a million tutorial on how to add Admob, every tutorial requests to adjust the build.gradle file but my file is not the same as theirs, they have Dependencies and different stuff there, any idea how to add admob on my build.gradle? the android build.gradle: android { buildToolsVersion "25.0.2" compileSdkVersion 25 sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript

Google Sign-In with LibGDX

非 Y 不嫁゛ 提交于 2019-12-02 22:49:29
问题 I've a problem. I'm making a game with LibGDX. Now I want to implement Google Sign-In. I searched everywhere, but can't find anything. What I need is a Resolver to abstract code for specific platform, but I don't know how to do it. Can someone help? EDIT Here's the code, this is my Android Resolver: public GoogleResolverAndroid(final Context context) { handler = new Handler(); this.context = context; GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN

How to change Sprite texture to Animation

爷,独闯天下 提交于 2019-12-02 22:12:03
问题 I have a Sprite that spawns every second, what I wan't to do is change the sprite texture to animation, and the when it's touched it will be back to a normal texture. public void draw(SpriteBatch batch){ enemyIterator=enemies.iterator(); //arraylist iterator boolean touched=Gdx.input.justTouched(); float touchX=Gdx.input.getX(); //rendering and making the current sprite move while(enemyIterator.hasNext()){ Sprite sprite=enemyIterator.next(); sprite.draw(batch); sprite.translateY(deltaTime

Particle System libGDX [closed]

久未见 提交于 2019-12-02 19:26:31
Can anyone give me a good example of where to start with making a particle system in libGDX? I have looked at the test example in the libGDX source but I am still having trouble getting my head around it. Maybe just a good explanation of it will help. I'm thinking I want to make some sort of explosion with a lot of colorful particles. Any help is greatly appreciated! Define a particle effect in your game class: public ParticleEffect particleEffect; Initialize it: particleEffect = new ParticleEffect(); particleEffect.load(Gdx.files.internal("data/particleEffect.p"), Gdx.files.internal("data"));