Search in sources :

Example 1 with ShapeDrawer

use of space.earlygrey.shapedrawer.ShapeDrawer in project jbump by implicit-invocation.

the class TestBump method create.

@Override
public void create() {
    spriteBatch = new SpriteBatch();
    // Create a TextureRegion containing a single, white pixel to enable rendering with ShapeDrawer.
    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.drawPixel(0, 0);
    texture = new Texture(pixmap);
    pixmap.dispose();
    TextureRegion textureRegion = new TextureRegion(texture, 0, 0, 1, 1);
    shapeDrawer = new ShapeDrawer(spriteBatch, textureRegion);
    camera = new OrthographicCamera();
    gameViewport = new ExtendViewport(10, 10, camera);
    uiViewport = new ScreenViewport();
    shapeDrawer.update();
    font = new BitmapFont();
    mode = POINT;
    world = new World<Entity>(1f);
    entities = new Array<Entity>();
    String[] lines = MAP.split("\n");
    for (int j = 0; j < lines.length; j++) {
        String line = lines[j];
        for (int i = 0; i < line.length(); i++) {
            if (line.charAt(i) == '+') {
                entities.add(new WallEntity(i, lines.length - j));
            } else if (line.charAt(i) == 'p') {
                entities.add(new PlayerEntity(i, lines.length - j));
            }
        }
    }
}
Also used : ExtendViewport(com.badlogic.gdx.utils.viewport.ExtendViewport) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) SpriteBatch(com.badlogic.gdx.graphics.g2d.SpriteBatch) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) ShapeDrawer(space.earlygrey.shapedrawer.ShapeDrawer) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont)

Example 2 with ShapeDrawer

use of space.earlygrey.shapedrawer.ShapeDrawer in project skin-composer by raeleus.

the class Main method create.

@Override
public void create() {
    appFolder = Gdx.files.external(".skincomposer/");
    skin = new FreeTypeSkin(Gdx.files.internal("skin-composer-ui/skin-composer-ui.json"));
    viewport = new ScreenViewport();
    // viewport.setUnitsPerPixel(.5f);
    stage = new Stage(viewport);
    Gdx.input.setInputProcessor(stage);
    shapeDrawer = new ShapeDrawer(stage.getBatch(), skin.getRegion("white"));
    graphDrawer = new GraphDrawer(shapeDrawer);
    initDefaults();
    populate();
    resizeUiScale(projectData.getUiScale());
}
Also used : ShapeDrawer(space.earlygrey.shapedrawer.ShapeDrawer) GraphDrawer(space.earlygrey.shapedrawer.GraphDrawer) Stage(com.badlogic.gdx.scenes.scene2d.Stage) ScreenViewport(com.badlogic.gdx.utils.viewport.ScreenViewport) FreeTypeSkin(com.ray3k.stripe.FreeTypeSkin)

Aggregations

ScreenViewport (com.badlogic.gdx.utils.viewport.ScreenViewport)2 ShapeDrawer (space.earlygrey.shapedrawer.ShapeDrawer)2 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)1 SpriteBatch (com.badlogic.gdx.graphics.g2d.SpriteBatch)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 ExtendViewport (com.badlogic.gdx.utils.viewport.ExtendViewport)1 FreeTypeSkin (com.ray3k.stripe.FreeTypeSkin)1 GraphDrawer (space.earlygrey.shapedrawer.GraphDrawer)1