Exemplo n.º 1
0
        public CameraController(KeyboardInput keyboard, MouseInput mouse)
        {
            this.Keyboard = keyboard;
            this.Mouse    = mouse;

            this.forward = Vector3.Forward;
            this.left    = Vector3.Left;
            this.up      = Vector3.Up;
        }
Exemplo n.º 2
0
        public UIManager(Game game, SpriteBatch spriteBatch, ImGuiRenderer gui, RenderTargetDescriber renderTargetDescriber, SceneSelector sceneSelector, CameraController cameraController, Editors editors, IList <IMenu> menus, EntityWindow entityWindow, KeyboardInput keyboardInput, MouseInput mouseInput)
        {
            this.Gui                   = gui;
            this.KeyboardInput         = keyboardInput;
            this.MouseInput            = mouseInput;
            this.GameLoop              = game;
            this.SpriteBatch           = spriteBatch;
            this.CameraController      = cameraController;
            this.RenderTargetDescriber = renderTargetDescriber;

            this.Menus        = menus;
            this.EntityWindow = entityWindow;
            this.Editors      = editors;

            this.State = UIState.Deserialize();

            if (!string.IsNullOrEmpty(this.State.EditorState.Scene))
            {
                var scene = sceneSelector.Scenes.FirstOrDefault(s => s.Name.Equals(this.State.EditorState.Scene, System.StringComparison.OrdinalIgnoreCase));
                if (scene != null && sceneSelector.CurrentScene != scene)
                {
                    sceneSelector.SwitchScenes(scene);
                }
            }

            if (sceneSelector.CurrentScene == null)
            {
                sceneSelector.SwitchScenes(sceneSelector.Scenes.First());
            }

            this.setCamera = true;

            for (var i = 0; i < this.Menus.Count; i++)
            {
                this.Menus[i].State = this.State;
            }
            this.EntityWindow.State = this.State;
        }