libgdx

Intellij 14 the supplied javaHome seems to be invalid

我只是一个虾纸丫 提交于 2019-12-08 15:55:53
问题 When first launching IntelliJ IDEA Community Edition 14.0.2 on Windows 7 x64 I received the following error when trying to import the sample libGDX gradle config: Intellij 14 the supplied javaHome seems to be invalid The IDE is looking in C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0.2\jre for the java runtime, but the files exist in a sub directory off this one: C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.0.2\jre\jre . My solution was to copy

How to get ttf font data from system fonts in java

℡╲_俬逩灬. 提交于 2019-12-08 15:28:35
问题 I have some ttf fonts installed on system. I get that list using GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames() This is not only ttf fonts but all fonts I guess. Eventually if I use: Font.decode(fontName) I can get awt.Font instance. As far as I know Font is not connected to actual PhysicalFont, so how can I retrieve either ttf font file, or byte data from that ttf file for a font from that list or from awt.Font ? I am trying to retrieve a physical font data

Non-continuous Rendering in Loading screen not working as it supposed to work - Multithreading LIBGDX

亡梦爱人 提交于 2019-12-08 15:16:31
I'm using Non-continuous Rendering in my loading screen so I can update it as I INIT different parts of my code in a secondary thread. That way I can manually increase the Animation counter that I use to draw a Sprite which shows a filling hourglass in tune with the loading of my assets. So, I load my game screen with the help of another thread (atlases, textures, init variables,etc) : Runnable load_game_screen = new Runnable(){ public void run(){ new_game_screen.load_all(); } }}; Thread thread_load_game = new Thread(load_game_screen); thread_load_game.start(); In my game screen load_all

LIBGDX: How can i tell when a sound has finished playing?

℡╲_俬逩灬. 提交于 2019-12-08 14:44:12
问题 The Sound API seems to be missing a function to indicate that a sound is finished playing. Is there some other way of finding out if the sound is done? 回答1: Not without submitting a patch to libgdx as far as I know the underlying Sound Backends for both OpenAL and Android don't even track the information internally, though the Music API has an isPlaying() function and getPosition() function as per the documentation. 回答2: just set this sound.setLooping(false); this way it will not run again

How can I draw text using Libgdx/Java?

和自甴很熟 提交于 2019-12-08 14:28:00
问题 I've been having a lot of trouble Googling how to draw simple 2D text with Libgdx. Here is the code that I've put together so far: SpriteBatch spriteBatch; BitmapFont font; CharSequence str = "Hello World!"; spriteBatch = new SpriteBatch(); font = new BitmapFont(); spriteBatch.begin(); font.draw(spriteBatch, str, 10, 10); spriteBatch.end(); The code does draw the Hello World string, however, it messes up all my other drawings. They are there, only brutally mutilated, and move and all that. I

How to extend the background in LibGdx for top down game?

为君一笑 提交于 2019-12-08 13:31:19
问题 What is the proper way to extend the background in top down game? I used LibGdx framework. Any idea or tutorial for top down game.My background is in PNG format and screen of 720x1280 portrait.I had a problem in extending the background.I want the camera follow the character and the background will extend. How could I do that? Here is the Screen shot of https://i.stack.imgur.com/jl03R.png Here is my code To display background I used this //background Background = new Texture(Gdx.files

Render BitmapFont in 3D libgdx with ModelBatch

寵の児 提交于 2019-12-08 13:28:52
问题 I want to render a BitmapFont within a libgdx ModelBatch. I've only found samples with "SpriteBatch". Of course I can move the SpriteBatch around in 3D space, but it is either rendered before or after the "ModelBatched" objects. But I'd like to have it rendered in the correct z position. E.g. Render modelInstanceA (z=20) Render Font (z=30) Render modelInstanceB (z=40) Then modelInstanceB should cover Render Font should cover modelInstanceB. In other words I'd like to render a font within a

libgdx world to screen pos and factors

怎甘沉沦 提交于 2019-12-08 13:02:03
问题 I want to draw a texture on a body, which is a box. How do I convert the coordinates of the body to screen coordinates? I know that the other way around is with camera.unproject(pos), is it similar to this? I see a lot of people using constants such as WORLD_TO_SCREEN = 32, but I currently don't have that in my game. Is that a problem, and how can I implement it now? Because it seems like people that are using these factors can convert world to screen positions easily. I currently have a

Scaling a ModelInstance in libgdx 3D and Bullet engine

拟墨画扇 提交于 2019-12-08 12:56:21
问题 Everytime I try to add a resized ModelInstance of a Model (made in 3ds max) to a Bullet world, I keep getting the same model, with no modified scale. This is my current code: Objeto objmat = mapaactu.nameAndPutObjetos(obj.getMaterias().get(0).nombreasoci,(int)obj.getMaterias().get(0).cantidad); world.addConstructor(objmat.nombreinterno, objmat.constructor); Vector3 objmatpos = new Vector3(obj.entidadbody.getWorldTransform().getTranslation(Vector3.Zero)); Vector3 scala = new Vector3(obj

How to correctly rotate and move a 3D perspective camera in LibGDX

主宰稳场 提交于 2019-12-08 12:25:00
问题 I have been trying on and off now for a few weeks to correctly handle object and camera rotation in LibGDX. I have the below move and yrotate methods in a custom class for my objects, 'this' being a ModelInstance: public void move(float i) { // TODO Auto-generated method stub this.instance.transform.translate(0, 0, i); this.instance.calculateTransforms(); } public void yrotate(float i) { // TODO Auto-generated method stub this.instance.transform.rotate(Vector3.Y, -i); this.instance