Search in sources :

Example 1 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch in project Entitas-Java by Rubentxu.

the class PongState method initialize.

@Override
public void initialize() {
    // Input
    Camera camera = engine.getManager(BaseSceneManager.class).getDefaultCamera();
    Batch batch = engine.getManager(BaseSceneManager.class).getBatch();
    BitmapFont font = engine.getManager(BaseGUIManager.class).getDefaultFont();
    context.core.createEntity().addBall(false).addView(new Circle(0, 0, 8)).addMotion(MathUtils.clamp(1, 230, 300), 300);
    context.core.createEntity().addPlayer(Player.ID.PLAYER1).addScore("Player 1: ", 180, 470).addView(new Rectangle(-350, 0, Pong.PLAYER_WIDTH, Pong.PLAYER_HEIGHT)).addMotion(0, 0);
    context.core.createEntity().addPlayer(Player.ID.PLAYER2).addScore("Player 2: ", 480, 470).addView(new Rectangle(350, 0, Pong.PLAYER_WIDTH, Pong.PLAYER_HEIGHT)).addMotion(0, 0);
    systems.add(new InputSystem(context.core)).add(new ContactSystem(context.core)).add(new BoundsSystem(context.core)).add(new MoveSystem(context.core)).add(new RendererSystem(context.core, engine.sr, camera, batch, font));
}
Also used : Circle(com.badlogic.gdx.math.Circle) Batch(com.badlogic.gdx.graphics.g2d.Batch) BaseSceneManager(com.ilargia.games.entitas.egdx.base.managers.BaseSceneManager) Rectangle(com.badlogic.gdx.math.Rectangle) BaseGUIManager(com.ilargia.games.entitas.egdx.base.managers.BaseGUIManager) Camera(com.badlogic.gdx.graphics.Camera) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont)

Example 2 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch in project Entitas-Java by Rubentxu.

the class SplashState method initialize.

@Override
public void initialize() {
    // Input
    Camera camera = engine.getManager(BaseSceneManager.class).getDefaultCamera();
    Batch batch = engine.getManager(BaseSceneManager.class).getBatch();
    BitmapFont font = engine.getManager(BaseGUIManager.class).getDefaultFont();
    systems.add(new DelaySystem(context.core)).add(new RendererSystem(context.core, engine.sr, camera, batch, font));
    Texture texture = assetsManager.getTexture(splash);
    context.core.createEntity().addTextureView("Pong", new TextureRegion(texture, 0, 0, texture.getWidth(), texture.getHeight()), new Vector2(), 0, Pong.SCREEN_HEIGHT, Pong.SCREEN_WIDTH).addDelay(3);
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Batch(com.badlogic.gdx.graphics.g2d.Batch) Vector2(com.badlogic.gdx.math.Vector2) BaseSceneManager(com.ilargia.games.entitas.egdx.base.managers.BaseSceneManager) BaseGUIManager(com.ilargia.games.entitas.egdx.base.managers.BaseGUIManager) RendererSystem(com.ilargia.games.entitas.systems.RendererSystem) Camera(com.badlogic.gdx.graphics.Camera) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) Texture(com.badlogic.gdx.graphics.Texture) DelaySystem(com.ilargia.games.entitas.systems.DelaySystem)

Example 3 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch 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);
    }
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Group(com.badlogic.gdx.scenes.scene2d.Group) ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Batch(com.badlogic.gdx.graphics.g2d.Batch) CpuSpriteBatch(com.badlogic.gdx.graphics.g2d.CpuSpriteBatch) Stage(com.badlogic.gdx.scenes.scene2d.Stage) TextureRegionDrawable(com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable) CpuSpriteBatch(com.badlogic.gdx.graphics.g2d.CpuSpriteBatch) Texture(com.badlogic.gdx.graphics.Texture)

Example 4 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch in project libgdx by libgdx.

the class GroupCullingTest method create.

public void create() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    root = new Table();
    root.setFillParent(true);
    stage.addActor(root);
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    Table labels = new Table();
    root.add(new ScrollPane(labels, skin)).expand().fill();
    root.row();
    root.add(drawnLabel = new Label("", skin));
    for (int i = 0; i < count; i++) {
        labels.add(new Label("Label: " + i, skin) {

            public void draw(Batch batch, float parentAlpha) {
                super.draw(batch, parentAlpha);
                drawn++;
            }
        });
        labels.row();
    }
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) Batch(com.badlogic.gdx.graphics.g2d.Batch) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Stage(com.badlogic.gdx.scenes.scene2d.Stage) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin)

Example 5 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch in project Eidolons by IDemiurge.

the class LoadingStage method draw.

@Override
public void draw() {
    final Matrix4 combined = getCamera().combined.cpy();
    getCamera().update();
    final Group root = getRoot();
    if (!root.isVisible())
        return;
    combined.setToOrtho2D(0, 0, GdxMaster.getWidth(), GdxMaster.getHeight());
    Batch batch = this.getBatch();
    batch.setProjectionMatrix(combined);
    batch.begin();
    root.draw(batch, 1);
    batch.end();
}
Also used : Group(com.badlogic.gdx.scenes.scene2d.Group) Batch(com.badlogic.gdx.graphics.g2d.Batch) Matrix4(com.badlogic.gdx.math.Matrix4)

Aggregations

Batch (com.badlogic.gdx.graphics.g2d.Batch)15 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)6 Camera (com.badlogic.gdx.graphics.Camera)4 Texture (com.badlogic.gdx.graphics.Texture)4 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)4 Stage (com.badlogic.gdx.scenes.scene2d.Stage)4 Group (com.badlogic.gdx.scenes.scene2d.Group)3 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)3 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)3 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)3 BaseSceneManager (com.ilargia.games.entitas.egdx.base.managers.BaseSceneManager)3 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)2 Matrix4 (com.badlogic.gdx.math.Matrix4)2 Actor (com.badlogic.gdx.scenes.scene2d.Actor)2 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)2 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)2 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)2 BaseGUIManager (com.ilargia.games.entitas.egdx.base.managers.BaseGUIManager)2 Color (com.badlogic.gdx.graphics.Color)1 OrthographicCamera (com.badlogic.gdx.graphics.OrthographicCamera)1