use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class SpriteBatchShaderTest method create.
@Override
public void create() {
spriteBatch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("data/badlogicsmall.jpg"));
Pixmap pixmap = new Pixmap(32, 32, Format.RGB565);
pixmap.setColor(1, 1, 0, 0.7f);
pixmap.fill();
texture2 = new Texture(pixmap);
pixmap.dispose();
for (int i = 0; i < coords.length; i += 2) {
coords[i] = (int) (Math.random() * Gdx.graphics.getWidth());
coords[i + 1] = (int) (Math.random() * Gdx.graphics.getHeight());
coords2[i] = (int) (Math.random() * Gdx.graphics.getWidth());
coords2[i + 1] = (int) (Math.random() * Gdx.graphics.getHeight());
}
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class FreeTypeMetricsTest method create.
@Override
public void create() {
spriteBatch = new SpriteBatch();
atlas = new TextureAtlas("data/pack");
smallFont = new BitmapFont();
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 60;
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/arial.ttf"));
font = generator.generateFont(parameter);
generator.dispose();
renderer = new ShapeRenderer();
renderer.setProjectionMatrix(spriteBatch.getProjectionMatrix());
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class FreeTypePackTest method create.
@Override
public void create() {
camera = new OrthographicCamera();
batch = new SpriteBatch();
long start = System.currentTimeMillis();
int glyphCount = createFonts();
long time = System.currentTimeMillis() - start;
text = glyphCount + " glyphs packed in " + regions.size + " page(s) in " + time + " ms";
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class InternationalFontsTest method create.
@Override
public void create() {
FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("data/unbom.ttf"));
FreeTypeFontParameter parameter = new FreeTypeFontParameter();
parameter.size = 18;
parameter.characters = "한국어/조선�?";
koreanFont = generator.generateFont(parameter);
generator.dispose();
parameter.characters = FreeTypeFontGenerator.DEFAULT_CHARS;
generator = new FreeTypeFontGenerator(Gdx.files.internal("data/russkij.ttf"));
cyrillicFont = generator.generateFont(parameter);
generator.dispose();
parameter.characters = "วรณยุ�?ต์";
generator = new FreeTypeFontGenerator(Gdx.files.internal("data/garuda.ttf"));
thaiFont = generator.generateFont(parameter);
generator.dispose();
batch = new SpriteBatch();
cam = new OrthographicCamera();
cam.setToOrtho(false, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.update();
}
use of com.badlogic.gdx.graphics.g2d.SpriteBatch in project libgdx by libgdx.
the class ProgressiveJPEGTest method create.
@Override
public void create() {
batch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("data/g2d/progressive-libgdx.jpg"));
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
drawable = new TextureRegionDrawable(new TextureRegion(texture));
}
Aggregations