package graphics;
import java.awt.*;
import _main.Game;
import cross.LampCross;
public class DrawLampCross extends Draw implements Drawing {
public DrawLampCross(){
}
/**
* A drawing met�dus rajzolja ki az alakzatot
* @param obj adott Graphics osztaly adott peldanya, ami alapjan rajzolni szeretnenk
* @param gc hova rajzoljunk (altalaban a duplabuffereles miatt a offscreen-re rajzolunk
*/
public void drawing(Object o,Graphics gc)
{
GraphicsLampCross ep = (GraphicsLampCross)o;
gc.setColor(new Color(255,0,0));
gc.drawRect(ep.getPosition().x-12,ep.getPosition().y-12,25,25);
MainGraphics gr = Game.getInstance().getMap().getGraphics();
LampCross lc = Game.getInstance().getMap().getLampCrosses().get(0);
//vegigmegyunk a lampakon
for (int i=0;i<lc.getLamps().size();i++){
// a lampa alapjan rajzoljuk a helyes helyre
int x = ep.getLampPosition(i).x;
int y = ep.getLampPosition(i).y;
//megnezzuk a lampa allapotat, ha zold
if (lc.getLamps().get(i).getState())
{
// zold lampat rajzolunk
ep.getLampIcon(1).paintIcon(MainGraphics.get().getCanvas(), gc, x,y);
}
// ha nem zold
else {
// piros lampat rajzolunk
ep.getLampIcon(2).paintIcon(MainGraphics.get().getCanvas(), gc, x,y);
}
}
}
}