Esempio n. 1
0
	void WireframeActor::drawActor(Graphics2D& g,long gameTime,float x1, float y1,double scale)
	{
		if(relative)
		{
			if(visible)
			{
				g.setColor(color);
				if(filled)
				{
					g.fillRect((x1 - View::x),(y1 - View::y),(float)(width*scale),(float)(height*scale));
				}
				else
				{
					g.drawRect((x1 - View::x),(y1 - View::y),(float)(width*scale),(float)(height*scale));
				}
			}
		}
		else
		{
			if(visible)
			{
				g.setColor(color);
				if(filled)
				{
					g.fillRect((x1),(y1),(float)(width*scale),(float)(height*scale));
				}
				else
				{
					g.drawRect((x1),(y1),(float)(width*scale),(float)(height*scale));
				}
			}
	    }
	}
Esempio n. 2
0
void SnakeGameView::render(Graphics2D& g)
{
#if 0
    g.clearScreen(g.makeRGB(0xFF,0xFF,0xFF));

    for(int y = 0; y < mBoard.height(); ++y) {
        for(int x = 0; x < mBoard.width(); ++x) {
            GameBoard::BoardState st = mBoard.boardStateAt(x,y);
            switch (st) {
            case GameBoard::BoardStateSnake:
                g.fillRect(x << 3, y << 3, 8, 8, g.makeRGB(0, 255, 0));
                break;
            case GameBoard::BoardStateFood:
                g.fillRect(x << 3, y << 3, 8, 8, g.makeRGB(0, 0, 255));
                break;
            case GameBoard::BoardStateBlock:
                g.fillRect(x << 3, y << 3, 8, 8, g.makeRGB(0, 0, 0));
                break;
            default:
                break;
            }
        }
    }
#endif

}