Exemplo n.º 1
0
        public DwarfGUI(DwarfGame game, SpriteFont defaultFont, SpriteFont titleFont, SpriteFont smallFont, InputManager input)
        {
            IndicatorManager.DefaultFont = defaultFont;
            EnableMouseEvents            = true;
            IsMouseVisible = true;
            MouseMode      = GUISkin.MousePointer.Pointer;
            SmallFont      = smallFont;
            Graphics       = game.GraphicsDevice;
            this.game      = game;
            RootComponent  = new GUIComponent(this, null)
            {
                LocalBounds = new Rectangle(0, 0, 0, 0)
            };

            DefaultFont = defaultFont;
            Skin        = new GUISkin(TextureManager.GetTexture(ContentPaths.GUI.gui_widgets), 32, 32, TextureManager.GetTexture(ContentPaths.GUI.pointers), 16, 16);
            Skin.SetDefaults();
            TitleFont          = titleFont;
            GlobalOffset       = Vector2.Zero;
            FocusComponent     = null;
            Input              = input;
            DrawAfter          = new List <GUIComponent>();
            DefaultTextColor   = new Color(48, 27, 0);
            DefaultStrokeColor = Color.Transparent;
            DebugDraw          = false;
            ToolTipManager     = new ToolTipManager(this);
            LastScrollWheel    = 0;
            LastMouseX         = 0;
            LastMouseY         = 0;
        }
Exemplo n.º 2
0
 public void PostRender(DwarfTime time)
 {
     if (IsMouseVisible && IsMouseOver())
     {
         MouseState mouse = Mouse.GetState();
         Skin.RenderMouse(mouse.X, mouse.Y, MouseScale, MouseMode, DwarfGame.SpriteBatch, MouseTint);
     }
     ToolTipManager.Render(Graphics, DwarfGame.SpriteBatch, time);
 }
Exemplo n.º 3
0
        public void Update(DwarfTime time)
        {
            RootComponent.LocalBounds = new Rectangle(0, 0, GameState.Game.GraphicsDevice.Viewport.Width, GameState.Game.GraphicsDevice.Viewport.Height);
            ToolTipManager.Update(time);

            if (!IsMouseVisible)
            {
                return;
            }

            if (FocusComponent == null)
            {
                RootComponent.Update(time);
            }
            else
            {
                FocusComponent.Update(time);
            }

            LastScrollWheel = Mouse.GetState().ScrollWheelValue;
        }
Exemplo n.º 4
0
        public DwarfGUI(DwarfGame game, SpriteFont defaultFont, SpriteFont titleFont, SpriteFont smallFont, InputManager input)
        {
            EnableMouseEvents = true;
            IsMouseVisible = true;
            MouseMode = GUISkin.MousePointer.Pointer;
            SmallFont = smallFont;
            Graphics = game.GraphicsDevice;
            this.game = game;
            RootComponent = new GUIComponent(this, null)
            {
                LocalBounds = new Rectangle(0, 0, 0, 0)
            };

            DefaultFont = defaultFont;
            Skin = new GUISkin(TextureManager.GetTexture(ContentPaths.GUI.gui_widgets), 32, 32, TextureManager.GetTexture(ContentPaths.GUI.pointers), 16, 16);
            Skin.SetDefaults();
            TitleFont = titleFont;
            GlobalOffset = Vector2.Zero;
            FocusComponent = null;
            Input = input;
            DrawAfter = new List<GUIComponent>();
            DefaultTextColor = new Color(48, 27, 0);
            DefaultStrokeColor = Color.Transparent;
            DebugDraw = false;
            ToolTipManager = new ToolTipManager(this);
            LastScrollWheel = 0;
        }