Exemplo n.º 1
0
 public void Draw(Viewport viewport, TileSet tileSet, SpriteBatch spriteBatch)
 {
     for (int y = 0; y < MapHeight; y++) {
         for (int x = 0; x < MapWidth; x++) {
             spriteBatch.Draw (
                 tileSet.TileSetTexture,
                 new Rectangle(x * tileSet.TileWidth, y * tileSet.TileHeight, tileSet.TileWidth, tileSet.TileHeight),
                 tileSet.GetSourceRectangle (Rows[y].Columns[x].TileID),
                 Color.Gray);
         }
     }
 }
Exemplo n.º 2
0
 public void Render(Viewport viewport, TileSet tileSet, SpriteBatch spriteBatch)
 {
     if (Map != null) {
         Map.Draw (viewport, tileSet, spriteBatch);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch (GraphicsDevice);
            systemFont = Content.Load<SpriteFont>("SystemFont");
            bannerFont = Content.Load<SpriteFont>("BannerFont");

            //TODO: use this.Content to load your game content here
            tileSet = new TileSet(Content.Load<Texture2D>("Tiles"));
            mobTileSet = new TileSet(Content.Load<Texture2D>("Tiles"), BlendState.NonPremultiplied);
            Console.WriteLine("{0}, {1}, {2}, {3}", GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height, 0, 0);
        }