use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class AtlasIssueTest method create.
public void create() {
batch = new SpriteBatch();
batch.setProjectionMatrix(new Matrix4().setToOrtho2D(0, 0, 855, 480));
atlas = new TextureAtlas(Gdx.files.internal("data/issue_pack"), Gdx.files.internal("data/"));
sprite = atlas.createSprite("map");
font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);
Gdx.gl.glClearColor(0, 1, 0, 1);
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class NoncontinuousRenderingTest method create.
@Override
public void create() {
batch = new SpriteBatch();
texture = new Texture("data/badlogic.jpg");
region = new TextureRegion(texture);
stage = new Stage(new ScreenViewport(), batch);
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
skin.add("default", font = new BitmapFont(Gdx.files.internal("data/arial-32.fnt"), false));
populateTable();
Gdx.graphics.setContinuousRendering(false);
Gdx.graphics.requestRendering();
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class ParallaxTest method create.
@Override
public void create() {
Texture texture = new Texture(Gdx.files.internal("data/layers.png"));
layers = new TextureRegion[3];
layers[0] = new TextureRegion(texture, 0, 0, 542, 363);
layers[1] = new TextureRegion(texture, 0, 363, 1024, 149);
layers[2] = new TextureRegion(texture, 547, 0, 224, 51);
camera = new ParallaxCamera(480, 320);
controller = new OrthoCamController(camera);
Gdx.input.setInputProcessor(controller);
batch = new SpriteBatch();
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class ParticleEmittersTest method create.
@Override
public void create() {
spriteBatch = new SpriteBatch();
effect = new ParticleEffect();
effect.load(Gdx.files.internal("data/singleTextureAllAdditive.p"), Gdx.files.internal("data"));
effect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
effectPool = new ParticleEffectPool(effect, 20, 20);
setupUI();
InputProcessor inputProcessor = new InputAdapter() {
public boolean touchDragged(int x, int y, int pointer) {
if (latestEffect != null)
latestEffect.setPosition(x, Gdx.graphics.getHeight() - y);
return false;
}
public boolean touchDown(int x, int y, int pointer, int newParam) {
latestEffect = effectPool.obtain();
latestEffect.setEmittersCleanUpBlendFunction(!skipCleanup.isChecked());
latestEffect.setPosition(x, Gdx.graphics.getHeight() - y);
effects.add(latestEffect);
return false;
}
};
InputMultiplexer multiplexer = new InputMultiplexer();
multiplexer.addProcessor(ui);
multiplexer.addProcessor(inputProcessor);
Gdx.input.setInputProcessor(multiplexer);
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class PathTest method create.
@Override
public void create() {
renderer = new ImmediateModeRenderer20(false, false, 0);
spriteBatch = new SpriteBatch();
obj = new Sprite(new Texture(Gdx.files.internal("data/badlogicsmall.jpg")));
obj.setSize(40, 40);
obj.setOriginCenter();
obj2 = new Sprite(new Texture(Gdx.files.internal("data/bobrgb888-32x32.png")));
obj2.setSize(40, 40);
obj2.setOriginCenter();
// 96DP
ZIGZAG_SCALE = Gdx.graphics.getDensity() * 96;
float w = Gdx.graphics.getWidth() - obj.getWidth();
float h = Gdx.graphics.getHeight() - obj.getHeight();
paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, h)));
paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(0, h), new Vector2(w, h)));
paths.add(new Bezier<Vector2>(new Vector2(0, 0), new Vector2(w, 0), new Vector2(0, h), new Vector2(w, h)));
Vector2[] cp = new Vector2[] { new Vector2(0, 0), new Vector2(w * 0.25f, h * 0.5f), new Vector2(0, h), new Vector2(w * 0.5f, h * 0.75f), new Vector2(w, h), new Vector2(w * 0.75f, h * 0.5f), new Vector2(w, 0), new Vector2(w * 0.5f, h * 0.25f) };
paths.add(new BSpline<Vector2>(cp, 3, true));
paths.add(new CatmullRomSpline<Vector2>(cp, true));
pathLength = paths.get(currentPath).approxLength(500);
avg_speed = speed * pathLength;
Gdx.input.setInputProcessor(this);
}
Aggregations