/// <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); } }
/// <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); }