libgdx

Libgdx 1.3.0 doesn't build eclipse files

丶灬走出姿态 提交于 2019-12-04 06:43:35
问题 I saw that version 1.3.0 of libgdx was available so I got it and when I use the project setup to setup a project I check advanced > build for eclipse and hit generate but when I try to import it into eclipse it says no projects found. Version 1.2.0 worked perfectly for me before 1.3.0 was released now I can't even get that version to build eclipse files. Any fixes and I don't use gradle. 回答1: Try importing the projects as Gradle projects. To do that, do the following: Opening LibGDX project

Keeping track of unnamed objects

一笑奈何 提交于 2019-12-04 06:28:28
问题 I want to make a top-down 2d shooting game using libgdx. There will be a lot of bullet objects that I want to keep track of and dispose when they go off the screen. I was thinking that I would use something like static ArrayList<Bullet> bullets; to keep track of my bullets in the Bullet class, check this array list for any bullets that are off the screen, dispose of them if they are, and delete that bullet from the ArrayList. I was wondering if this is the best way to do this. It seems like

Libgdx pause/resume not called when window is being dragged (Windows)

三世轮回 提交于 2019-12-04 06:23:58
I am creating a Java game with libgdx. Really liking the engine so far but I noticed an issue when dragging the game window. Rendering seems to stop (which is okay) but I cant find any events that get called during this state. Is there any way I can trap it? It not a big deal for rendering as I cap the deltaTime, but for input the keyUp events don't get fired which messes up my movement code for the player (if you are to release the keys while dragging the window). Is there anything I can do? Thanks! The problem you describe lies in the native window implementation of the LWJGL Display : This

GdxRuntimeException: Couldn't load file

牧云@^-^@ 提交于 2019-12-04 06:17:39
问题 I am following this tutorial on libgdx. What i am trying to do is loading a texture from a copy of badlogic.jpg (copy is called wawa.jpg): public class HelloWorld implements ApplicationListener { SpriteBatch spriteBatch; Texture texture; Texture watched_texture; BitmapFont font; Vector2 textPosition = new Vector2(100, 100); Vector2 textDirection = new Vector2(5, 3); @Override public void create () { font = new BitmapFont(); font.setColor(Color.RED); texture = new Texture(Gdx.files.internal(

Export libgdx project to HTML - did you forget to inherit a required module?

只谈情不闲聊 提交于 2019-12-04 06:06:09
问题 I try to export my libgdx game in HTML. I already export it on Android and desktop, and it works well. But when I execute ./gradlew html:dist , I have many errors like this one: [ERROR] Line 75: No source code is available for type net.spookygames.gdx.gameservices.playtomic.PlaytomicServicesHandler; did you forget to inherit a required module? net.spookygames.gdx.gameservices is a package which is next to my main package in core folder: I saw on documentation and on another question that I

How to build a ResourceManager in libGDX with AssetManager

孤人 提交于 2019-12-04 06:00:49
问题 I want use non static AssetManager In my android game? I have many levels. How should I use AssetManager? I should create for every level a separate AssetManager? Because if I create one AssetManager, it will load all textures, etc, in first screen. 回答1: You should create one AssetManager in your main class which load all assets at the startup of the application. Then for each level you should create a different screen or use one screen, depending on your game. Then you pass a reference of

Java - LibGDX - What is the difference between isKeyPressed and isKeyJustPressed?

僤鯓⒐⒋嵵緔 提交于 2019-12-04 05:37:45
What is the difference between isKeyPressed and isKeyJustPressed?! I searched the docs. for the difference and just found: isKeyPressed: Returns whether the key is pressed. isKeyJustPressed: Returns whether the key has just been pressed. Anybody knows something that explains better?! isKeyPressed detects whether the key is currently pressed. isKeyJustPressed detects whether the key was pressed and released the last frame. 来源: https://stackoverflow.com/questions/40979622/java-libgdx-what-is-the-difference-between-iskeypressed-and-iskeyjustpressed

Libgdx view frustum culling inside actor.draw()

我的未来我决定 提交于 2019-12-04 05:35:47
问题 I am developing a little game using libgdx. It is a 2d top down game with some big maps and many objects on them. So i just want to render things in my view frustum. I have seen the camera.frustum.***inFrustum(Paramter... p) . But i am using scene2d and i set up the camera in the Stage , set the SpriteBatch s projection matrix to camera.combined and my Actor s draw themself in the overridden draw(SpriteBatch batch) method. How can i access the camera or the view frustum there? Is there a way

Trouble loading .png file using LibGDX Gdx.files.internal

拜拜、爱过 提交于 2019-12-04 05:13:35
I'm trying to load a Texture to libGDX and I'm getting a file not found exception. Here's the code that's trying to load the .png file. //Textures private Texture tiles; private TextureRegion grassImage; private TextureRegion dirtImage; private TextureRegion stoneImage; //Entities private Texture entities; private TextureRegion playerImage; public WorldRenderer(World world, boolean debug) { this.world = world; this.camera = new OrthographicCamera(CAMERA_WIDTH, CAMERA_HEIGHT); this.camera.position.set(CAMERA_WIDTH/2f, CAMERA_HEIGHT/2f, 0); this.camera.update(); this.debug = debug; spriteBatch =

LibGDX Saving textures to avoid context loss

纵然是瞬间 提交于 2019-12-04 04:36:33
问题 I have a texture in my LibGDX based Android app that is created procedurally through FrameBuffers that I need to preserve through context loss, and it seems that the only efficient way to do this is to simply save the data, whether as a full image or raw data, out, and load it back in when the time comes. I'm struggling to find any way to achieve this though, as every route I've taken has lead to complete failure in one way or another. I've searched around quite a bit, but nothing I've come