Example #1
0
        private void DrawToRT(SpriteBatch spr, int x, int y)
        {
            Rectangle pos    = new Rectangle(x * TILE_SIZE, y * TILE_SIZE, TILE_SIZE, TILE_SIZE);
            Rectangle source = TerrainAtlas.GetSprite(GetTypeAt(x, y));

            spr.Draw(TerrainAtlas.Texture, pos, source, GetColourAt(x, y));
        }
Example #2
0
        public void RedrawRT(SpriteBatch spr, int tx, int ty)
        {
            Main.Graphics.GraphicsDevice.SetRenderTarget(this.RT[tx, ty]);
            Main.Graphics.GraphicsDevice.Clear(Color.Black);
            spr.Begin();
            int sx = tx * SectorWidth;
            int sy = ty * SectorHeight;
            int lx = 0, ly = 0;

            for (int x = sx; x < sx + SectorWidth; x++)
            {
                for (int y = sy; y < sy + SectorHeight; y++)
                {
                    Rectangle pos    = new Rectangle(lx * TILE_SIZE, ly * TILE_SIZE, TILE_SIZE, TILE_SIZE);
                    Rectangle source = TerrainAtlas.GetSprite(GetTypeAt(x, y));
                    spr.Draw(TerrainAtlas.Texture, pos, source, GetColourAt(x, y));
                    ly++;
                }
                lx++;
                ly = 0;
            }
            spr.End();
            Main.Graphics.GraphicsDevice.SetRenderTarget(null);
        }