Tag Info

Hot answers tagged

10

The PNG files are small because they are compressed. When the images are loaded into memory they are uncompressed and therefore take up more space.


2

This is an old question, so I'm guessing that tom37 may have moved on by now, but I think I have an answer for anyone else with the same problem. For reference, here is a view of a surface grid using a perspective camera. Now let's say that we want to render a portion of this current view, but to the entire screen. Let's render the top-left quarter of ...


2

Not sure if this is the best way for detecting gestures, but this is how I would do it: On touchDown() I would set two member variables to store where the touch began. int xStart; int yStart; int xDrag; int yDrag; boolean gestureStarted = false; public boolean touchDown(int screenX, int screenY, int pointer) { xStart = screenX; yStart = screenY; ...


1

Can't speak to the exact implementation details (and if I could it would be off-topic), but here's some obvious ingredients to put together: The camera is using an orthographic projection. You can tell this because a vertical wall is exactly vertical on-screen no matter where it is — if the camera were perspective then they would be "leaning outward" from ...


1

If you have read access to the audio wave, there are a few ways to do it. I will cover an accurate, and a fast method. If you do not have read access to the audio wave, you need to get access to the audio wave. I'm not familiar with libGDX, but I highly doubt it has built-in functionality for this. It's not functionality that is typically needed, or asked ...


1

I think you need to find the needed ratio between Texture size and meters. I would probably use 100px:1m. Then, when you are setting the fixture sizes, multiply the texture size with the ratio. Try something like this: //RATIO private float ratio = 1/100; // TEXTURE private Texture texture = new Texture(YOUR TEXTURE PATH); private float fixtureHeight = ...


1

You are loading textures and models from files on disk, that's your problem. File I/O is very expensive and should be avoided as much as possible. Preload your model and whenever you need to add a badger, clone one from the preloaded and just alter the properties that you need to.


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



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