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

It means desktop. You have two options to deploy your libGDX app to the desktop: Create a self-runnable JAR. This is easier (Eclipse can export it pretty easily). Create an EXE, via launch4j (or some other wrapper). This is possible too (especially with Gradle). I've used both approaches and they work equally well as far as I can tell. Both rely on ...


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

Setting a uniform per sprite is probably not a good idea, as Sean Middleditch already pointed out. Tinting a sprite in OpenGL can easily be done by defining the vertex colors. Since the vertices in this case are defined by SpriteBatch.draw(), you should set the tint with SpriteBatch.setColor(). From the SpriteBatch source code: 200 public void setColor ...


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 ...


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

Imagine the radius is one. That means every point around the circle is exactly one unit away from the center. Now what kind of vectors always have a length of one? Unit vectors of course. You can get a unit vector by normalizing a non-unit vector. Take the vector CA (center to A). Next, normalize CA to make it a unit vector, then scale it by the radius of ...



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