예제 #1
0
파일: HUD.cs 프로젝트: zdawson/Marooned
        private Vector2 _v2SelectionBoundInitial = s_v2OutOfBounds; //< Given points are in world-space.

        #endregion Fields

        #region Constructors

        public HUD(ViewRoot root)
            : base(root)
        {
            root.OnResize += () => { Size = Parent.Size; }; //< Force ourselves to remake our layout.

            OnInputButton += (eButton, bReleased) =>
            {
                switch (eButton)
                {
                    // Only interested in MouseA for selection purposes
                    case Buttons.A: Selection (bReleased); break;
                    case Buttons.B: IssueOrder(bReleased); break;
                }
            };

            OnInputKey += (eKey, bRelease) => {
                switch (eKey)
                {
                    case Keys.Escape:
                        {
                            if (!bRelease) break;
                            root.Menu.Visible = true;
                        }
                        break;
                }
            };

            OnInputWheel += delta => root.ViewZoom = MathEx.Clamp(root.ViewZoom + delta / 1440f, 1 / 4f, 1);

            Map  = new Map   (this);
            Crew = new CrewUI(this);
        }
예제 #2
0
파일: Map.cs 프로젝트: zdawson/Marooned
 public Button(Map map, ImageTinted img)
     : base(map, img)
 {
     ColourHovered.ValueInactive = Color.White;
     ColourHovered.ValueActive   = Color.Gray;
     ColourDepressed             = Color.DimGray;
     OnResize += () => Content.Size = Size;
 }