package pl.shockah.ts.entities.hud;

import pl.shockah.glib.geom.Rectangle;
import pl.shockah.glib.geom.vector.Vector2i;
import pl.shockah.glib.gl.Graphics;
import pl.shockah.glib.gl.color.Color;
import pl.shockah.glib.logic.standard.EntityRenderable;
import pl.shockah.glib.state.State;
import pl.shockah.ts.gameplay.Game;
import pl.shockah.ts.states.StateGame;

public class HudBlackBorders extends EntityRenderable {
	public HudBlackBorders() {
		baseDepth = -10000;
	}
	
	protected void onRender(Graphics g) {
		Color c1 = Color.Black, c2 = Color.TransparentBlack;
		new Rectangle(0,0,Game.me.tileSize.x*24,32).drawMulticolor(g,true,c1,c1,c2,c2);
		new Rectangle(0,(Game.me.tileSize.y-1)*24-8,Game.me.tileSize.x*24,32).drawMulticolor(g,true,c2,c2,c1,c1);
		new Rectangle(0,0,32,Game.me.tileSize.y*24).drawMulticolor(g,true,c1,c2,c1,c2);
		new Rectangle((Game.me.tileSize.x-1)*24-8,0,32,Game.me.tileSize.y*24).drawMulticolor(g,true,c2,c1,c2,c1);
		
		Vector2i size = State.get().getDisplaySize(), size2 = State.get() instanceof StateGame ? new Vector2i(Game.me.tileSize.x*24,Game.me.tileSize.y*24) : size;
		g.setColor(Color.Black);
		g.draw(new Rectangle(-size.x,-size.y,size.x,size.y*2+size2.y));
		g.draw(new Rectangle(size2.x,-size.y,size.x,size.y*2+size2.y));
		g.draw(new Rectangle(0,-size.y,size2.x,size.y));
		g.draw(new Rectangle(0,size2.y,size2.x,size.y));
	}
}