use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class DelaunayTriangulatorTest method create.
public void create() {
renderer = new ShapeRenderer();
triangulate();
System.out.println(seed);
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
seed = MathUtils.random.nextLong();
System.out.println(seed);
triangulate();
return true;
}
public boolean mouseMoved(int screenX, int screenY) {
triangulate();
return false;
}
});
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class Box2DTest method create.
@Override
public void create() {
// setup the camera. In Box2D we operate on a
// meter scale, pixels won't do it. So we use
// an orthographic camera with a viewport of
// 48 meters in width and 32 meters in height.
// We also position the camera so that it
// looks at (0,16) (that's where the middle of the
// screen will be located).
camera = new OrthographicCamera(48, 32);
camera.position.set(0, 16, 0);
// next we setup the immediate mode renderer
renderer = new ShapeRenderer();
// next we create the box2d debug renderer
debugRenderer = new Box2DDebugRenderer();
// next we create a SpriteBatch and a font
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
font.setColor(Color.RED);
textureRegion = new TextureRegion(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
// next we create out physics world.
createPhysicsWorld();
// register ourselfs as an InputProcessor
Gdx.input.setInputProcessor(this);
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class BitmapFontMetricsTest method create.
@Override
public void create() {
spriteBatch = new SpriteBatch();
atlas = new TextureAtlas("data/pack");
smallFont = new BitmapFont();
font = new BitmapFont(Gdx.files.internal("data/verdana39.fnt"), atlas.findRegion("verdana39"), false);
font = new BitmapFont(Gdx.files.internal("data/arial-32-pad.fnt"), false);
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class TiledMapLayerOffsetTest method create.
@Override
public void create() {
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
camera = new OrthographicCamera();
camera.setToOrtho(false, (w / h) * 10, 10);
camera.zoom = 2;
camera.update();
cameraController = new OrthoCamController(camera);
Gdx.input.setInputProcessor(cameraController);
font = new BitmapFont();
batch = new SpriteBatch();
shapeRenderer = new ShapeRenderer();
assetManager = new AssetManager();
assetManager.setLoader(TiledMap.class, new TmxMapLoader(new InternalFileHandleResolver()));
assetManager.load(MAP_ORTHO, TiledMap.class);
assetManager.load(MAP_ISO, TiledMap.class);
assetManager.load(MAP_ISO_STAG, TiledMap.class);
assetManager.load(MAP_HEX_X, TiledMap.class);
assetManager.load(MAP_HEX_Y, TiledMap.class);
assetManager.finishLoading();
map = assetManager.get(MAP_ORTHO);
renderer = new OrthogonalTiledMapRenderer(map, 1f / 32f);
}
use of com.badlogic.gdx.graphics.glutils.ShapeRenderer in project libgdx by libgdx.
the class TextureAtlasTest method create.
public void create() {
batch = new SpriteBatch();
renderer = new ShapeRenderer();
atlas = new TextureAtlas(Gdx.files.internal("data/pack"));
jumpAtlas = new TextureAtlas(Gdx.files.internal("data/jump.txt"));
jumpAnimation = new Animation(0.25f, jumpAtlas.findRegions("ALIEN_JUMP_"));
badlogic = atlas.createSprite("badlogicslice");
badlogic.setPosition(50, 50);
// badlogicSmall = atlas.createSprite("badlogicsmall");
badlogicSmall = atlas.createSprite("badlogicsmall-rotated");
badlogicSmall.setPosition(10, 10);
AtlasRegion region = atlas.findRegion("badlogicsmall");
System.out.println("badlogicSmall original size: " + region.originalWidth + ", " + region.originalHeight);
System.out.println("badlogicSmall packed size: " + region.packedWidth + ", " + region.packedHeight);
star = atlas.createSprite("particle-star");
star.setPosition(10, 70);
font = new BitmapFont(Gdx.files.internal("data/font.fnt"), atlas.findRegion("font"), false);
Gdx.gl.glClearColor(0, 1, 0, 1);
Gdx.input.setInputProcessor(new InputAdapter() {
public boolean keyUp(int keycode) {
if (keycode == Keys.UP) {
badlogicSmall.flip(false, true);
} else if (keycode == Keys.RIGHT) {
badlogicSmall.flip(true, false);
} else if (keycode == Keys.LEFT) {
badlogicSmall.setSize(512, 512);
} else if (keycode == Keys.DOWN) {
badlogicSmall.rotate90(true);
}
return super.keyUp(keycode);
}
});
}
Aggregations