Search in sources :

Example 11 with Batch

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

the class MatchOneState method initialize.

@Override
public void initialize() {
    entitas = new Entitas();
    EntityIndexExtension.addEntityIndices(entitas);
    // Input
    World physics = engine.getManager(BasePhysicsManager.class).getPhysics();
    BodyBuilder bodyBuilder = engine.getManager(BasePhysicsManager.class).getBodyBuilder();
    Camera camera = engine.getManager(BaseSceneManager.class).getDefaultCamera();
    Batch batch = engine.getManager(BaseSceneManager.class).getBatch();
    EmitInputSystem emitInputSystem = new EmitInputSystem(entitas.input, physics, camera);
    systems.add(new ProcessInputSystem(entitas)).add(new GameBoardSystem(entitas.game)).add(new FallSystem(entitas.game)).add(new FillSystem(entitas.game)).add(new ScoreSystem(entitas)).add(new RemoveViewSystem(entitas.game, physics)).add(new AddViewSystem(entitas.game, assetsManager, bodyBuilder)).add(new AnimatePositionSystem(entitas.game)).add(new DestroySystem(entitas.game)).add(new RendererSystem(entitas, camera, batch, physics));
}
Also used : BaseSceneManager(com.ilargia.games.entitas.egdx.base.managers.BaseSceneManager) World(com.badlogic.gdx.physics.box2d.World) BodyBuilder(com.ilargia.games.entitas.egdx.base.util.BodyBuilder) Batch(com.badlogic.gdx.graphics.g2d.Batch) BasePhysicsManager(com.ilargia.games.entitas.egdx.base.managers.BasePhysicsManager) Camera(com.badlogic.gdx.graphics.Camera) Entitas(com.ilargia.games.entitas.core.Entitas)

Example 12 with Batch

use of com.badlogic.gdx.graphics.g2d.Batch in project bladecoder-adventure-engine by bladecoder.

the class SceneList method getBgIcon.

public TextureRegion getBgIcon(String atlas, String region) {
    // context lost in new project thread
    if (disposeBgCache) {
        dispose();
        disposeBgCache = false;
    }
    String s = atlas + "#" + region;
    TextureRegion icon = bgIconCache.get(s);
    if (icon == null) {
        Batch batch = getStage().getBatch();
        batch.end();
        try {
            icon = createBgIcon(atlas, region);
        } catch (Exception e) {
            EditorLogger.error("Error creating Background icon: " + atlas + "." + region);
        }
        if (icon == null) {
            EditorLogger.error("Error creating Background icon: " + atlas + "." + region);
            icon = Ctx.assetManager.getIcon("ic_no_scene");
        }
        bgIconCache.put(s, icon);
        batch.begin();
    }
    return icon;
}
Also used : TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) Batch(com.badlogic.gdx.graphics.g2d.Batch) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) IOException(java.io.IOException)

Example 13 with Batch

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

the class VStage method draw.

public void draw() {
    if (bgList.size() != 0) {
        Batch batch = getBatch();
        batch.begin();
        batch.setColor(1, 1, 1, 1);
        for (Actor bg : bgList) {
            float prefx = bg.getX();
            float prefy = bg.getY();
            bg.setPosition(bg.getX() + getRoot().getX() - cutWidth, bg.getY() + getRoot().getY() - cutHeight);
            bg.draw(batch, getRoot().getColor().a);
            bg.setPosition(prefx, prefy);
        }
        batch.end();
    }
    super.draw();
}
Also used : Batch(com.badlogic.gdx.graphics.g2d.Batch) Actor(com.badlogic.gdx.scenes.scene2d.Actor)

Example 14 with Batch

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

the class ChainedStage 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) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) Batch(com.badlogic.gdx.graphics.g2d.Batch) Matrix4(com.badlogic.gdx.math.Matrix4)

Example 15 with Batch

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

the class EmitterController method add.

public void add(String presetPath, String imagePath) {
    EmitterActor actor = null;
    try {
        actor = new EmitterActor(presetPath, true) {

            @Override
            public void draw(Batch batch, float parentAlpha) {
                act(Gdx.graphics.getDeltaTime());
                // Vector2 v = GridMaster.getMouseCoordinates();
                // setPosition(v.x, v.y);
                super.draw(batch, parentAlpha);
            }
        };
    } catch (Exception e) {
        main.system.ExceptionMaster.printStackTrace(e);
        return;
    }
    if (imagePath != null) {
        actor.getEffect().setImagePath(imagePath);
    }
    add(actor, null);
}
Also used : Batch(com.badlogic.gdx.graphics.g2d.Batch) EmitterActor(eidolons.libgdx.anims.particles.EmitterActor)

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