libgdx

Libgdx NESTED ShapeRenderer not drawing lines

柔情痞子 提交于 2019-12-13 05:48:47
问题 In the code below I retrieve an arraylist of vertices (I've debugged and they are in fact there) and then attempt to render them in this nest loop arrangement which is hosted in the render method. For some reason, the ShapeRenderer cannot connect all the lines if this is nested? Can someone tell me what I'm doing wrong? Nothing is being drawn to the screen; I get no errors. shapeRenderer.setProjectionMatrix(camera.combined); shapeRenderer.begin(ShapeType.Line); for(int i = 0;i<tmpBodies.size

Draw order changes strangely as camera moves?

霸气de小男生 提交于 2019-12-13 05:06:57
问题 I am currently developing a 3D gui system in libgdx, with the goal of making a library useful for anyone who wants true 3d interfaces in their application. (that is, an interface constructed from model-instances) This means in a lot of cases there will be transparent objects overlapping. For example, a label object in a container. The label has a distance field shader (working nicely) and the container a outlined rectangle shader (working nicely). Both shaders have a transparent, or semi

LIBGDX White textures in the first run on android

自作多情 提交于 2019-12-13 05:03:48
问题 I created a game using LIBGDX and it works fine in desktop. When I install it and open it using the install wizard(?) It works fine until I go home or lock it and then resume it. Then it shows only white boxes instead of texture and when I go home or lock it the sounds are still running. After I exit completely the sounds stop running. But when I run it again the error doesn't happen again no matter how many times I open the game. It only happens in that case, if i fist close the install

LibGDX GWT - WebSocket Causing Temporary FPS Spikes

会有一股神秘感。 提交于 2019-12-13 04:59:04
问题 BACKGROUND: I'm implementing a client that communicates to a server using a WebSocket. The core of the client application is built ontop of LibGDX and it is deployed solely in browser form using GWT (HTML5/JavaScript). This is for a side-project - a fast-paced (high network traffic), online, browser-based game. Without providing any source - essentially the client code is an empty LibGDX application that provides a correct implementation of gwt-websockets (a commonly recommended GWT wrapper

No uniform with name in shader

∥☆過路亽.° 提交于 2019-12-13 04:50:59
问题 I'm new to all this shader stuff, and right not I'm simply trying to replace the default SpriteBatch renderer in LibGDX. I copy pasted the default shader and tried to add a mouse uniform, but it gives me the 'No uniform with name 'u_mouse' in shader. This is all the related code: String vertexShader = "attribute vec4 " + ShaderProgram.POSITION_ATTRIBUTE + ";\n" // + "attribute vec4 " + ShaderProgram.COLOR_ATTRIBUTE + ";\n" // + "attribute vec2 " + ShaderProgram.TEXCOORD_ATTRIBUTE + "0;\n" //

How to implement LibGDX Json.Serializable with default reader and custom writer

廉价感情. 提交于 2019-12-13 04:44:35
问题 I would like to use the default LibGDX Json deserializer to read in a JSON file, but implement my own method for writing the class back out to a JSON file. When I implement Json.Serializable, it forces me to implement both the read and write methods. How can I call the default deserializer in the read method? 回答1: I was looking for the same thing, finally this implemented read method worked for me, I hope it works for you too: @Override public void read(Json json, JsonValue jsonMap) { json

LibGDX can't access internal image resources

纵然是瞬间 提交于 2019-12-13 04:43:25
问题 I clearly stored my "background.png" in the assets folder under android. I also checked that it was there in Finder. I am working with Android Studio. However, upon trying to access the image: public Background() { textureRegion = new TextureRegion(new Texture("background.png")); textureRegionBounds1 = new Rectangle(0 - Constants.APP_WIDTH / 2, 0, Constants.APP_WIDTH, Constants.APP_HEIGHT); textureRegionBounds2 = new Rectangle(Constants.APP_WIDTH / 2, 0, Constants.APP_WIDTH, Constants.APP

How do you tell libgdx to use a specific color for transparency?

感情迁移 提交于 2019-12-13 04:38:18
问题 I use GraphicsGale and it doesn't support transparency. The easy fix for this problem is to just use a really ugly color (#808040 in my case) and use that for transparency. I haven't been able to find a way how to do this in libgdx though. I can of course just pull it through GIMP and fill in the transparency, but it would be nice to work straight out of GraphicsGale. So my question is, is there a way to make libgdx treat a color as transparency, and if there is, how? 回答1: I modularized my

TextureAtlas issue with libgdx

白昼怎懂夜的黑 提交于 2019-12-13 04:33:29
问题 I keep getting null pointer exceptions when I try and use TextureAtlass with this libgdx project. game.atlas and game.png are under android/assets game.png size: 1024,1024 format: RGBA8888 filter: Nearest,Nearest repeat: none bunny_head rotate: false xy: 2, 44 size: 122, 82 orig: 122, 82 offset: 0, 0 index: -1 Load the atlas with TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("game.atlas")); head = atlas.findRegion("bunny_head"); This is my Exception log Exception in thread "LWJGL

How to verify Google In app purchase in libgdx game?

依然范特西╮ 提交于 2019-12-13 04:31:40
问题 I have Followed Google developers guide to implement In app purchases in my Libgdx game. (I have already implemented Google play game services so I do have an idea how Core code and Android specific code in LIBGdx game sync. ) But I am confused that once I bought an item by clicking on a button, how can I update the game state. For example if I buy extra life in game, how can I update In main code that if (gdx.geType == ApplicationType.Android ) { // successfully bought a life // add +1 life