private void InitializeGraphics() { bitmap = new Bitmap( mm.GetTileSize() * mm.GetMapSize()[0], mm.GetTileSize() * mm.GetMapSize()[1]); gfx_details = Graphics.FromImage(bitmap); }
public void Draw(MapManager mm, Graphics gfx) { Tile tile = mm.GetTileWithItem(this); if (tile != null) { gfx.DrawImage(snakeImg, tile.X * mm.GetTileSize(), tile.Y * mm.GetTileSize(), snakeImg.Width, snakeImg.Height); } }
public void Draw(MapManager mm, Graphics gfx) { if (!MIsEaten) { Tile tile = mm.GetTileWithItem(this); if (tile != null) { gfx.DrawImage(foodImg, tile.X * mm.GetTileSize(), tile.Y * mm.GetTileSize(), mm.GetTileSize(), mm.GetTileSize()); } else { MIsEaten = true; } } }
private void DrawUI(MapManager mm, Graphics gfx) { Tile center = mm.GetCenterTile(); int tileSize = mm.GetTileSize(); gfx.DrawString("Food eaten: " + score.ToString(), new Font("Arial", 10), new SolidBrush(Color.Black), center.X * tileSize, 0); if (GetGameState() == GameState.Over) { gfx.DrawString("GAME OVER", new Font("Arial", 20), new SolidBrush(Color.Black), center.X * tileSize, center.Y * tileSize); } if (GetGameState() == GameState.Pausing) { gfx.DrawString("PAUSED", new Font("Arial", 20), new SolidBrush(Color.Black), center.X * tileSize, center.Y * tileSize); } }