Beispiel #1
0
        static SelectionScreen()
        {
            _transformMouseDown = Transform.Translation(Vector3d.ZAxis * -1);
            _transformMouseOver = Transform.Translation(Vector3d.ZAxis * 1);

            var menuTitle = new SelectableObject(ElementType.Drawable);
            menuTitle.AddGeoemtry(Serialized.Meshes.Menu.TitleBigBackground, Settings.MaterialOrange);
            menuTitle.AddGeoemtry(Serialized.Meshes.Menu.TitleBigBorder, Settings.MaterialRed);
            menuTitle.AddGeoemtry(Serialized.Meshes.Menu.TitleBigLetters, Settings.MaterialYellow);

            var menuOptions = new SelectableObject(ElementType.MenuOptions);
            menuOptions.AddGeoemtry(Serialized.Meshes.Menu.OptionsBackground, Settings.MaterialOrange);
            menuOptions.AddGeoemtry(Serialized.Meshes.Menu.OptionsBorder, Settings.MaterialRed);
            menuOptions.AddGeoemtry(Serialized.Meshes.Menu.OptionsLetters, Settings.MaterialYellow);

            var menuStart = new SelectableObject(ElementType.MenuStart);
            menuStart.AddGeoemtry(Serialized.Meshes.Menu.StartBacbground, Settings.MaterialOrange);
            menuStart.AddGeoemtry(Serialized.Meshes.Menu.StartBorder, Settings.MaterialRed);
            menuStart.AddGeoemtry(Serialized.Meshes.Menu.StartLetters, Settings.MaterialYellow);

            var menuExit = new SelectableObject(ElementType.MenuExit);
            menuExit.AddGeoemtry(Serialized.Meshes.Menu.ExitBacground, Settings.MaterialOrange);
            menuExit.AddGeoemtry(Serialized.Meshes.Menu.ExitBorder, Settings.MaterialRed);
            menuExit.AddGeoemtry(Serialized.Meshes.Menu.ExitLetters, Settings.MaterialYellow);

            _menuObjects = new[] { menuTitle, menuOptions, menuStart, menuExit };

            _mouseController = new MouseController(new[] { menuOptions, menuStart, menuExit });
            _mouseController.OnChange += _mouseController_OnChange;
            _mouseController.OnMouseClick += _mouseController_OnMouseClick;
            _mouseController.OnMouseRelease += _mouseController_OnMouseRelease;

            _box = new BoundingBox(-400, -400, -100, 400, 400, 100);
        }
Beispiel #2
0
        protected override void OnMouseMove(MouseCallbackEventArgs e)
        {
            e.View.ActiveViewport.GetFrustumLine(e.ViewportPoint.X, e.ViewportPoint.Y, out _frustrum);

            var currentObject = GetObject();
            if (currentObject != _lastObject)
            {
                e.Cancel = true;
                OnChange?.Invoke(this, new MouseControllerEventArgs(currentObject));
            }

            _lastObject = currentObject;

            base.OnMouseMove(e);
        }
 public MouseControllerEventArgs(SelectableObject gameObject)
 {
     GameObject = gameObject;
 }
Beispiel #4
0
 internal MouseController(SelectableObject[] objects)
 {
     _objects = objects;
 }