예제 #1
0
파일: Ui.cs 프로젝트: polytronicgr/larx
        public bool Update()
        {
            State.MouseRepeat  = State.MousePressed;
            State.Hover        = page.Intersect(Larx.State.Mouse.Position * uiScale, new Vector2(0.0f, 0.0f));
            State.Click        = State.MousePressed && !Larx.State.Mouse.LeftButton ? State.Hover : null;
            State.MousePressed = Larx.State.Mouse.LeftButton;

            if (State.MousePressed)
            {
                State.Focused = State.Hover != null ? State.Hover : null;
            }

            applicationInfo.Update();

            if (modal != null)
            {
                if (Ui.State.Click != null)
                {
                    if (Ui.State.Click.Key.StartsWith(UiKeys.Modal.Submit))
                    {
                        modal.Submit();
                    }
                    if (Ui.State.Click.Key == UiKeys.Modal.Cancel)
                    {
                        CloseModals();
                    }
                }
                return(true);
            }

            mainMenu.Update();
            rightMenu.Update();

            State.Click = null;
            return(State.Hover != null);
        }