Пример #1
0
        /// <summary>
        /// Draw this layer
        /// </summary>
        public override void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // ---------- Begin drawing from this layer's perspective ----------
            spriteBatch.Begin(
                SpriteSortMode.Deferred,
                BlendState.AlphaBlend,
                null,
                null,
                null,
                null,
                _camTransformation);

            // ---------- Draw TileSystem ----------
            _tileSystem.Draw(gameTime, spriteBatch);

            // ---------- Draw GameObjects ----------
            foreach (GameObject go in _gameObjects)
            {
                GOCDrawable drawableComponent = go.GetComponent<GOCDrawable>();
                if (drawableComponent != null)
                    drawableComponent.Draw(gameTime, spriteBatch);
            }

            // ---------- Drawing complete ----------
            spriteBatch.End();
        }
Пример #2
0
        /// <summary>
        /// Draw all data on this GameLayer
        /// </summary>
        public virtual void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // Begin drawing from this GameLayer's perspective
            spriteBatch.Begin(
                SpriteSortMode.Deferred,
                BlendState.AlphaBlend,
                null,
                null,
                null,
                null,
                _camTransformation);

            // ---------- Start drawing GameObjects ----------

            foreach (GameObject go in _gameObjects)
            {
                GOCDrawable drawableComponent = go.GetComponent<GOCDrawable>();
                if (drawableComponent != null)
                    drawableComponent.Draw(gameTime, spriteBatch);
            }

            // ---------- End drawing GameObjects ----------

            // End drawing
            spriteBatch.End();
        }
Пример #3
0
 /// <summary>
 /// Draw the GameObject at its isometric location
 /// </summary>
 public void DrawIsometric(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     spriteBatch.DrawIsometric(
         _texture,
         _parent.Displacement,
         _drawColor);
 }
Пример #4
0
        /// <summary>
        /// Draw the GameObject at its cartesian location
        /// </summary>
        public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            Vector2 position;
            position.X = _parent.Displacement.X;
            position.Y = _parent.Displacement.Z;

            spriteBatch.Draw(
                _texture,
                position,
                _drawColor);
        }
 /// <summary>
 /// Draw this InterfaceObject
 /// </summary>
 public virtual void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     if (_visible)
     {
         // ---------- Draw this GameInterfaceObject ----------
         spriteBatch.Draw(
             _texture,
             _rectangle,
             Color.White);
     }
 }
Пример #6
0
 /// <summary>
 /// Draw this GameLevel
 /// </summary>
 public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
 {
     // Draw the main layer
     _mainLayer.Draw(gameTime, spriteBatch);
 }
Пример #7
0
        public void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // ---------- Draw all tiles ----------
            for (int i = 0; i < _numRows; i++)
                for (int j = 0; j < _numCols; j++)
                {
                    TileRef currTile = _tiles[i, j];

                    Vector3 tilePosition;
                    tilePosition.X = i * TILE_SIZE;
                    tilePosition.Y = currTile.Elevation * TILE_SIZE;
                    tilePosition.Z = j * TILE_SIZE;

                    spriteBatch.DrawIsometric(
                        TileTypes[currTile.ReferenceID].Texture,
                        tilePosition,
                        Color.White);
                }

            // ---------- Draw selection indicators ----------
            foreach (Vector2 index in _selectedIndices)
            {
                int x = (int)index.X;
                int y = (int)index.Y;
                TileRef currTile = _tiles[x, y];

                Vector3 drawPosition;
                drawPosition.X = x * TILE_SIZE;
                drawPosition.Y = currTile.Elevation * TILE_SIZE;
                drawPosition.Z = y * TILE_SIZE;

                spriteBatch.DrawIsometric(
                    _selectionTexture,
                    drawPosition,
                    Color.White);
            }
        }
        /// <summary>
        /// Draw this window and its components
        /// </summary>
        public override void Draw(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            if (_visible)
            {
                // ---------- Draw the window ----------
                DrawMainWindow(gameTime, spriteBatch);

                // ---------- Draw window components ----------
            }
        }
        /// <summary>
        /// Draws the outline, backdrop and title bar of the window
        /// </summary>
        private void DrawMainWindow(GameTime gameTime, SpriteBatchIsometric spriteBatch)
        {
            // Use the GameInterface's window properties for drawing this window
            Rectangle drawRect;
            Color backdropColor = ApplyFade(WindowBackdropColor);
            Color traceColor = ApplyFade(WindowTraceColor);
            int titleBarThickness = WindowTitleBarThickness;
            int traceThickness = WindowTraceThickness;
            SpriteFont interfaceFont = InterfaceFont;

            // Draw the left and right edges
            for (int i = 0; i < 2; i++)
            {
                drawRect.Width = traceThickness;
                drawRect.Height = _rectangle.Height - traceThickness - titleBarThickness;
                drawRect.X = _rectangle.X + ((i % 2) * (_rectangle.Width - traceThickness));
                drawRect.Y = _rectangle.Y + titleBarThickness;
                spriteBatch.Draw(_texture, drawRect, traceColor);
            }

            // Draw the bottom edge
            drawRect.Width = _rectangle.Width;
            drawRect.Height = traceThickness;
            drawRect.X = _rectangle.X;
            drawRect.Y = _rectangle.Y + _rectangle.Height - traceThickness;
            spriteBatch.Draw(_texture, drawRect, traceColor);

            // Draw the title bar
            drawRect.Height = titleBarThickness;
            drawRect.Y = _rectangle.Y;
            spriteBatch.Draw(_texture, drawRect, traceColor);

            // Draw the window title
            float drawY =
                drawRect.Y + drawRect.Height - (drawRect.Height / 2.0f)
                - interfaceFont.MeasureString(_windowTitle).Y / 2.0f;
            Vector2 drawPos;
            drawPos.X = drawRect.X + 10;
            drawPos.Y = drawY;
            spriteBatch.DrawString(interfaceFont, _windowTitle, drawPos, backdropColor);

            // Draw the backdrop
            drawRect.Width = _rectangle.Width - (traceThickness * 2);
            drawRect.Height = _rectangle.Height - titleBarThickness - traceThickness;
            drawRect.X = _rectangle.X + traceThickness;
            drawRect.Y = _rectangle.Y + titleBarThickness;
            spriteBatch.Draw(_texture, drawRect, backdropColor);
        }