libgdx

Cannot export default Java libGDX project as a jar from Eclipse

梦想的初衷 提交于 2019-12-24 17:04:40
问题 When I export the default libgdx project as a runnable JAR file from eclipse and then run the .jar file, it simply pops up a black screen and then closes. When I run the project code from inside Eclispe, it works fine. The correct red screen with the "bad logic" logo is displayed by the program (this is what is supposed to happen). If I build the project from the command line using gradle with the command gradlew desktop:dist as instructed here and then run the jar that is created, it will

Cannot export default Java libGDX project as a jar from Eclipse

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 17:04:08
问题 When I export the default libgdx project as a runnable JAR file from eclipse and then run the .jar file, it simply pops up a black screen and then closes. When I run the project code from inside Eclispe, it works fine. The correct red screen with the "bad logic" logo is displayed by the program (this is what is supposed to happen). If I build the project from the command line using gradle with the command gradlew desktop:dist as instructed here and then run the jar that is created, it will

TmxMapLoader to use packed tileset

十年热恋 提交于 2019-12-24 16:34:12
问题 In the old libgdx map api, they used to have map = TiledLoader.createMap(Gdx.files.internal("maps/testmap.tmx")); atlas = new TileAtlas(map, Gdx.files.internal("maps")); tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8); However in the new libgdx the rule changes, to load a tilemap there is no longer needed to use map packer first. You can directly use the .tmx file with the tileset png. Something like following will work, and then call render. TiledMap map = new TmxMapLoader().load(

How to use/setup TexturePacker2 libgdx

谁说胖子不能爱 提交于 2019-12-24 15:26:43
问题 I have a difficulty with texturepacker2 from libgdx . I was trying to create textureAtlas using texturepakcer2 so that I can create animated images. However I could not use TexturePacker2.process(Input Directory Path", "Output Directory Path", "texture_file"); Because it could not recognize TexturePacker2. Even thought I import gdx-tool.jar file inside libs and also added libraries through Project -> Properties -> Java Build Path -> Libraries -> Add jars , it still cannot resolve nor

libGDX ApplicationListener not found

三世轮回 提交于 2019-12-24 14:45:15
问题 Hey right now i'm making a 2D game, for the desktop and Android. I installed libGDX because i heard that it made developing a game in java easier. But when i run the desktop code it shows up with this error java: cannot access com.badlogic.gdx.ApplicationListener class file for com.badlogic.gdx.ApplicationListener not found This is the Main code that i'm running: package com.rare.Forms; import com.badlogic.gdx.backends.lwjgl.LwjglApplication; import com.badlogic.gdx.backends.lwjgl

Using interstitials from Admob in a Libgdx game for Android, it's slow when dismissing it

喜你入骨 提交于 2019-12-24 14:18:03
问题 I've been using interstitials from Admob with my libgdx game for Android and my problem is that when I dismiss it after it was shown, it takes quite some time to give the control back to my game (around 4-5 seconds, which is not good at all). I don't know why it does that. Also, when I just leave my game (pressing the Home button) and then come back to it, it also takes around the same time. Maybe it has something to do with the opengl context loss.. 回答1: Run the ad call on a separate UI

LibGDX draw BitmapFont to intermediate location (spritebatch)

会有一股神秘感。 提交于 2019-12-24 14:05:10
问题 I want to draw some text using BitmapFont to some temporary location and then draw a portion of this location to the final spritebatch. I was thinking about drawing to a temporary spritebatch, but it's not possible to draw spritebatch onto another one. How could I accomplish this? 回答1: Have you tried to write it into the pixmap temporarily? When you want to draw it, you can load the pixmap into texture object. https://github.com/libgdx/libgdx/wiki/Pixmaps 回答2: You could use a FrameBuffer. See

Changing time on device => cheating in the game

北城以北 提交于 2019-12-24 13:59:28
问题 In some games people can cheat by changing the time. For example: when they have to wait 30 minutes before a building is built. Can i prevent this, assuming that the devices have connection with my server? I am programming in java using the libGDX library. Any solutions that work both on IOS and Android? 回答1: Store the time they have to wait to on the server (tell the server they perform a task, server will log that time and when they can do it again) and make the client check if the server

How can I fill a circle in libgdx?

雨燕双飞 提交于 2019-12-24 13:44:15
问题 using the ShapeRenderer class, I can only fill rectangles. So how can I fill a circle? and if possible, fill a sector (portion of a circle)? 回答1: As in the example of the shaperender shapeRenderer.begin(ShapeType.Filled); shapeRenderer.setColor(0, 1, 0, 1); shapeRenderer.rect(x, y, width, height); // fills a rect shapeRenderer.circle(x, y, radius);//<--- fills a circle shapeRenderer.end(); should fill the circle. How to get a portion of a cicle i have no clue. Maybe create a mesh and fill it

how to use a sprite as an anchor point of another sprite?

纵然是瞬间 提交于 2019-12-24 13:26:15
问题 I want to know , if you can , join two sprites in libgdx . Let me explain, I have a spaceship that I have to turn in my game ... and is the first sprite . another sprite I would put on the tip of the spacecraft so that when it turns me I through the second sprite I can always know the coordinates and so derive a vector in order to advance my ship . I'm new to libgdx and if anyone had any idea would be grateful. Thank You. EDIT : I would follow that always render the position of the other