コード例 #1
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            float cursorX = (float)Math.Floor(((double)((Gears.Cloud.Master.GetInputManager().GetCurrentInputHandler() as Input.CInput).mouseX / Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameWidth)) *
                                              Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameWidth);

            float cursorY = (float)Math.Floor(((double)((Gears.Cloud.Master.GetInputManager().GetCurrentInputHandler() as Input.CInput).mouseY / Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameHeight)) *
                                              Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameHeight);


            //draw the tiles
            layers[0].drawLayer(true);

            Vector2 cursorTile = new Vector2(cursorX, cursorY);
            //draw the selected tiles
            Vector2 sampleTileSize = new Vector2(_selectedTiles[0, 0].Width, _selectedTiles[0, 0].Height);

            for (int i = 0; i < _selectedTiles.GetUpperBound(0) + 1; i++)
            {
                for (int j = 0; j < _selectedTiles.GetUpperBound(1) + 1; j++)
                {
                    spriteBatch.Draw(_tileEditor.sourceSet, cursorTile + new Vector2(i * sampleTileSize.X, j * sampleTileSize.Y), _selectedTiles[i, j], Color.White);
                }
            }

            _controlManager.Draw(spriteBatch);
        }
コード例 #2
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch)
        {
            float cursorX = (float)Math.Floor(((double)((Gears.Cloud.Master.GetInputManager().GetCurrentInputHandler() as Input.CInput).mouseX / Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameWidth)) *
                                              Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameWidth);

            float cursorY = (float)Math.Floor(((double)((Gears.Cloud.Master.GetInputManager().GetCurrentInputHandler() as Input.CInput).mouseY / Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameHeight)) *
                                              Graphics.CTextures.textures[_tileEditor.defaultTileSet].FrameHeight);

            Vector2 cursorTile = new Vector2(cursorX, cursorY);

            //draw the interface
            spriteBatch.Draw(_tileEditor.sourceSet, cursorTile, _selectedTiles[0], Color.White);

            _controlManager.Draw(spriteBatch);

            //draw the selected rectangle in the top left for now
            spriteBatch.Draw(_tileEditor.sourceSet, new Vector2(5, 25), _selectedTiles[0], Color.White);


            //draw the tiles
            layers[0].drawLayer();
        }