Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
        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);
                }
            }
        }
Exemplo n.º 4
0
        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);
                                }
                            }
                        }
                    }
                }
            }
        }