Tag Info

Hot answers tagged

3

glClearColor expects color values to be in 0 .. 1 range, everything outside of this range gets clamped to it. In your case numbers are getting clamped to (1, 1, 0, 0) which is indeed yellow. Try setting glClearColor(60/255.0, 181/255.0, 0.0, 0.0); instead.


2

All of the atlas regions are automatically available through the skin as TextureRegions. I just tried it, and works without modifying the json file. You can just call skin.get(name, TextureRegion.class); or skin.getRegion(name); Unfortunately, the skin docs are not very clear about this. libGdx docs


1

You have a translate function outside of the if statement. . . . if(!turn){ bug.translate(v.x * Gdx.graphics.getDeltaTime(), v.y * Gdx.graphics.getDeltaTime()); } else{ bug.translate(-(v.x * Gdx.graphics.getDeltaTime()), -(v.y * Gdx.graphics.getDeltaTime())); } bug.draw(spriteBatch); ...


1

Input.setCursorImage() will do that for you. Something like this: Pixmap pm = new Pixmap(Gdx.files.internal("cursorImage.png")); Gdx.input.setCursorImage(pm, 0, 0); pm.dispose(); The hotspot parameters represent the "tip" of the cursor. For example, the operating system cursor has the hotspot at the top-left corner, but a crosshair cursor might have the ...


1

LET THIS BE A CAUTIONARY TALE ABOUT BOX2D! Haha! Here's the solution I came up with The problem I amrunning into is due to the fact that Box2D uses meters instead of pixels for the scale, in my game a screen that is 1920x1080 would be 1920 meters wide and if I am using sprites a small sprite will be only as many meters wide as it is in pixels. The reason ...


1

The distance moved does not take the delta time into account, so if you get updates coming at an irregular interval you'll get jerky motion. Scale your speed by the elapsed time, dt; public void update(float dt){ if(cont == true){ vec = makeVec(); x += vec.x * speed * dt; y += vec.y * speed * dt; } } This might mean you'll ...


1

Dialog is better suited for modal pop-up windows, and it includes a "button" and "content" table already in the window (as the docs say). You can grab these tables with getButtonTable() or getContentTable(). The dialog makes it easy to work with pop up windows. For example, here is a confirmation dialog: Dialog diag = new Dialog("Warning", skin, "dialog") ...


1

Had a similar problem. Couldnt find anywhere the solution, only in libgdx irc channel. Huge thanks to jeffol on #libgdx @ freenode So to change text colors the text outputted from Hiero (i used BMFont) should be white. This is done in export settings - you need to set higher bit depth, and then you can tinker with r g b values. What worked for me was the ...



Only top voted, non community-wiki answers of a minimum length are eligible