public void Render(WriteableBitmap screen) { foreach (var asteroid in asteroids) { screen.FillRectangleFixed((int)asteroid.Position.X, (int)asteroid.Position.Y, (int)asteroid.Position.X + asteroid.Size, (int)asteroid.Position.Y + asteroid.Size, Palette.Asteroid); } }
public void Render(WriteableBitmap screen) { foreach (var pellet in Pellets) { int left = (int)pellet.Position.X; int right = (int)(pellet.Position.X + (PelletSize-1)); int top = (int)pellet.Position.Y; int bottom = (int)(pellet.Position.Y + (PelletSize-1)); screen.FillRectangleFixed(left, top, right, bottom, EnergyColor); } }
public void Render(List<Vector2> stars, Color color, int size, WriteableBitmap screen) { if (size <= 1) { foreach (var star in stars) { // TODO: Outside bounds of array error can occur here! Float accuracy adding up? screen.SetPixel((int)star.X, (int)star.Y, color); } } else { foreach (var star in stars) { screen.FillRectangleFixed((int)star.X, (int)star.Y, (int)star.X + size, (int)star.Y + size, color); } } }
public void RenderPlayer(WriteableBitmap screen) { screen.FillRectangleFixed((int)X, Y, (int)X + (PlayerWidth-1), Y + (PlayerHeight-1), Palette.Player); }
public void RenderEnergyBar(WriteableBitmap screen) { if (Energy > 0) { int y1 = EnergyBarBottom - (int)((Energy / EnergyMax) * (float)EnergyBarHeight); if (Energy > 50.0f || barBlink) { screen.FillRectangleFixed(EnergyBarLeft, y1, EnergyBarRight, EnergyBarBottom, Palette.Energy1); } } }