private void DrawTile(string drawId, int frame, int x, int y, BitsyGame.Color c, IRenderSurface context) { GfxTileSheet gfx; if (_env.ImageStore.TryGetValue(drawId, out gfx)) { gfx.Draw(frame, x * BitsyGame.TILESIZE * BitsyGame.PIXEL_SCALE, y * BitsyGame.TILESIZE * BitsyGame.PIXEL_SCALE, c, context, BitsyGame.PIXEL_SCALE); } }
public static void FillArea(this IRenderSurface surface, BitsyGame.Color c, int x, int y, int width, int height) { if (surface == null) { return; } for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { surface.SetPixel(c, x + i, y + j); } } }
public void FillTile(BitsyGame.Color color, int x, int y, IRenderSurface context) { if (context == null) { return; } for (int i = 0; i < BitsyGame.TILESIZE * BitsyGame.PIXEL_SCALE; i++) { for (int j = 0; j < BitsyGame.TILESIZE * BitsyGame.PIXEL_SCALE; j++) { context.SetPixel(color, x + i, y + j); } } }
public void Draw(int frame, int x, int y, BitsyGame.Color c, IRenderSurface context, int pixelScale = 1) { if (context == null) { return; } if (frame < 0 || frame >= frameCount) { return; } int offset = frame * width * height; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { if (_pixels[offset + j * width + i]) { int px = x + i * pixelScale; int py = y + j * pixelScale; if (pixelScale == 1) { context.SetPixel(c, px, py); } else { for (int sx = 0; sx < pixelScale; sx++) { for (int sy = 0; sy < pixelScale; sy++) { context.SetPixel(c, px + sx, py + sy); } } } } } } }