コード例 #1
0
        public GuiGroup(string name)
        {
            Name        = name;
            Elements    = new List <GuiElement>();
            InputMapped = new InputMapped();
            InputSolver = new InputSolver();

            InitializeInputSolver();
        }
コード例 #2
0
        static Gui()
        {
            //we use deferred dictionary, so we can add gui group at for-each
            //but we only add command at that time, and solve the commands in Flush()
            //the gui group we added will be added at next frame
            Groups = new DeferredDictionary <string, GuiGroup>();

            InputMapped = new InputMapped();
        }
コード例 #3
0
        protected internal override void Input(InputAction action)
        {
            //for char input action, we need to skip the mapped test
            if (action.Type == InputType.Char)
            {
                InputSolver.CharInputAction[GuiProperty.InputText].ForEach(action as CharInputAction);
            }

            var alias = InputMapped.IsMapped(action.Name) ?
                        InputMapped.MappedInput(action.Name) : Gui.InputMapped.MappedInput(action.Name);

            if (!GuiProperty.IsGuiInput(alias))
            {
                return;
            }

            InputSolver.Execute(action);
        }
コード例 #4
0
        internal static void Initialize()
        {
            mRender = new GuiRender(GameSystems.GpuDevice);

            ///auto size, if true means when window size is changed, the canvas size is also changed.
            ///false means we do not change the size when window size changed.
            AutoSize = true;

            ///resize the canvas size
            ReSizeCanvas(GameSystems.EngineWindow.Size);

            GameSystems.EngineWindow.OnSizeChangeEvent += (sender, eventArg) =>
            {
                if (AutoSize == false)
                {
                    return;
                }

                ReSizeCanvas(eventArg.After);
            };

            ///add input mapped
            ///axis input mapped
            InputMapped.Mapped(InputProperty.MouseX, GuiProperty.InputMoveX);
            InputMapped.Mapped(InputProperty.MouseY, GuiProperty.InputMoveY);
            InputMapped.Mapped(InputProperty.MouseWheel, GuiProperty.InputWheel);
            ///button input mapped
            InputMapped.Mapped(InputProperty.LeftButton, GuiProperty.InputClick);
            ///mapped the keycode to input key
            foreach (var keycode in InputProperty.KeyCodeMapped)
            {
                InputMapped.Mapped(keycode.Value, GuiProperty.InputKey);
            }

            LogEmitter.Apply(LogLevel.Information, "[Initialize Gui System Finish] from [Gui]");
        }