Search in sources :

Example 1 with MiniMapObject

use of net.catacombsnatch.game.entity.components.MiniMapObject in project Catacomb-Snatch by Catacomb-Snatch.

the class MiniMap method render.

@Override
public void render(Scene scene) {
    sprite.draw(scene.getBatch());
    vp.set(view.getViewport());
    vp.x += view.offset.x;
    vp.y += view.offset.y;
    for (int x = 0; x < level.width; x++) {
        for (int y = 0; y < level.height; y++) {
            final Entity tile = level.getTile(x, y);
            if (tile == null) {
                continue;
            }
            final MiniMapObject icon = Entities.miniMap.get(tile);
            if (icon != null) {
            // TODO add entity icons
            //        for (Entity tile : level.getTiles()) {
            //            if (tile == null) continue;
            //
            //            float px = sprite.getX() + 7f;
            //            px += 2 * (int)((tile.getPosition().x - (vp.x / Tile.WIDTH) + (vp.width / 2f / Tile.WIDTH)));
            //            float py = sprite.getY() + 7f;
            //            py += 2 * (int)((-tile.getPosition().y + (vp.height / Tile.HEIGHT) - (vp.y / Tile.HEIGHT) - (vp.height / 2f / Tile.HEIGHT)));
            //
            //            if (px >= sprite.getX() + 7f && py >= sprite.getY() + 7f &&
            //                    px < sprite.getX() + 82f && py < sprite.getY() + 82f) {
            //                int color = tile.getMinimapColor();
            //                scene.getSpriteBatch().setColor(
            //                        ((color & 0xff000000) >>> 24) / 255f,
            //                        ((color & 0x00ff0000) >>> 16) / 255f,
            //                        ((color & 0x0000ff00) >>> 8) / 255f,
            //                        1f);
            //                scene.getSpriteBatch().draw(pixel, px, py, 2f, 2f);
            //            }
            //        }
            }
        }
    }
    scene.getSpriteBatch().setColor(1f, 1f, 1f, 1f);
}
Also used : Entity(com.badlogic.ashley.core.Entity) MiniMapObject(net.catacombsnatch.game.entity.components.MiniMapObject)

Aggregations

Entity (com.badlogic.ashley.core.Entity)1 MiniMapObject (net.catacombsnatch.game.entity.components.MiniMapObject)1