use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class ContainerTest method create.
@Override
public void create() {
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage();
Gdx.input.setInputProcessor(stage);
TextureRegionDrawable logo = new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("data/badlogic.jpg"))));
Table root = new Table();
root.setFillParent(true);
root.debug().defaults().space(6).size(110);
stage.addActor(root);
root.add(new Container(label("center")));
root.add(new Container(label("top")).top());
root.add(new Container(label("right")).right());
root.add(new Container(label("bottom")).bottom());
root.add(new Container(label("left")).left());
root.row();
root.add(new Container(label("fill")).fill());
root.add(new Container(label("fillX")).fillX());
root.add(new Container(label("fillY")).fillY());
root.add(new Container(label("fill 75%")).fill(0.75f, 0.75f));
root.add(new Container(label("fill 75% br")).fill(0.75f, 0.75f).bottom().right());
root.row();
root.add(new Container(label("padTop 5\ntop")).padTop(5).top());
root.add(new Container(label("padBottom 5\nbottom")).padBottom(5).bottom());
root.add(new Container(label("padLeft 15")).padLeft(15));
root.add(new Container(label("pad 10 fill")).pad(10).fill());
root.add(new Container(label("pad 10 tl")).pad(10).top().left());
root.row();
root.add(new Container(label("bg")).background(logo));
root.add(new Container(label("bg height 50")).background(logo).height(50));
Container transformBG = new Container(label("bg transform")).background(logo);
transformBG.setTransform(true);
transformBG.setOrigin(55, 55);
transformBG.rotateBy(90);
root.add(transformBG);
Container transform = new Container(label("transform"));
transform.setTransform(true);
transform.setOrigin(55, 55);
transform.rotateBy(90);
root.add(transform);
Container clip = new Container(label("clip1clip2clip3clip4"));
clip.setClip(true);
root.add(clip);
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class CpuSpriteBatchTest method create.
public void create() {
Batch batch = new CpuSpriteBatch();
// batch = new SpriteBatch();
stage = new Stage(new ExtendViewport(500, 500), batch);
Gdx.input.setInputProcessor(stage);
texture = new Texture("data/bobargb8888-32x32.png");
texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
TextureRegionDrawable drawable = new TextureRegionDrawable(new TextureRegion(texture));
for (int i = 0; i < NUM_GROUPS; i++) {
Group group = createActorGroup(drawable);
stage.addActor(group);
}
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class CustomShaderSpriteBatchTest method create.
@Override
public void create() {
batch = new SpriteBatch(10);
ShaderProgram.pedantic = false;
shader = new ShaderProgram(Gdx.files.internal("data/shaders/batch.vert").readString(), Gdx.files.internal("data/shaders/batch.frag").readString());
batch.setShader(shader);
texture = new Texture("data/badlogic.jpg");
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class DecalTest method create.
@Override
public void create() {
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
Gdx.gl.glDepthFunc(GL20.GL_LESS);
egg = new Texture(Gdx.files.internal("data/egg.png"));
egg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
egg.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
wheel = new Texture(Gdx.files.internal("data/wheel.png"));
wheel.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
wheel.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
w = Gdx.graphics.getWidth() / 0.8f;
h = Gdx.graphics.getHeight() / 0.8f;
for (int i = 0; i < INITIAL_RENDERED; i++) {
toRender.add(makeDecal());
}
cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
cam.near = 0.1f;
cam.far = 10f;
cam.position.set(0, 0, 0.1f);
cam.direction.set(0, 0, -1f);
batch = new DecalBatch(new CameraGroupStrategy(cam));
Gdx.gl.glClearColor(1, 1, 0, 1);
}
use of com.badlogic.gdx.graphics.Texture in project libgdx by libgdx.
the class DownloadTest method create.
@Override
public void create() {
batch = new SpriteBatch();
HttpRequest request = new HttpRequest(HttpMethods.GET);
request.setUrl("https://www.google.at/images/srpr/logo11w.png");
Gdx.net.sendHttpRequest(request, new HttpResponseListener() {
@Override
public void handleHttpResponse(HttpResponse httpResponse) {
final byte[] bytes = httpResponse.getResult();
Gdx.app.postRunnable(new Runnable() {
@Override
public void run() {
Pixmap pixmap = new Pixmap(bytes, 0, bytes.length);
texture = new Texture(new PixmapTextureData(pixmap, pixmap.getFormat(), false, false, true));
}
});
}
@Override
public void failed(Throwable t) {
t.printStackTrace();
Gdx.app.log("EmptyDownloadTest", "Failed", t);
}
@Override
public void cancelled() {
Gdx.app.log("EmptyDownloadTest", "Cancelled");
}
});
}
Aggregations