Beispiel #1
0
 public virtual void DragStartCallback(Vector2 point, InputState.MouseButton button)
 {
 }
Beispiel #2
0
 public virtual void Update(InputState inputs)
 {
 }
Beispiel #3
0
 public virtual void ClickCallback(Vector2 point, InputState.MouseButton button)
 {
 }
Beispiel #4
0
        public override void DragStartCallback(Vector2 point, InputState.MouseButton button)
        {
            if (button == InputState.MouseButton.Left)
            {
                drag_selection = true;

                drag_origin = point;
                drag_last = point;
            }
        }
Beispiel #5
0
 public override void ClickCallback(Vector2 point, InputState.MouseButton button)
 {
     if (button == InputState.MouseButton.Left)
     {
         Vector2 mapped_pos = camera.InverseMouseMap(point - pos);
         if (ui.mode == UI.ControlMode.Observe)
         {
             Physical new_phys = universe.PhysAtPoint(mapped_pos);
             if (new_phys != null)
             {
                 ui.FocusPhys(new_phys);
             }
         }
     }
 }
Beispiel #6
0
        public override void Update(InputState inputs )
        {
            base.Update(inputs);

            
            if (focus_entity != null)
            {
                camera.SetPos(focus_entity.pos);
            }
        }
Beispiel #7
0
        public void ButtonEventManager(Widget focused, InputState.MouseButton button)
        {
            InputState.ButtonEvent evt = inputs.MouseButtonEvent(button);
            if ( evt == InputState.ButtonEvent.Pressed )
            {
                if (drag_button == InputState.MouseButton.None)
                {
                    drag_button = button;
                    drag_origin = inputs.pos;
                    drag_widget = focused;
                }
                //drag_widget.DragStartCallback(inputs.pos, button);
            }
            else if ( evt == InputState.ButtonEvent.Released )
            {
                if (drag_button == button)
                {
                    drag_button = InputState.MouseButton.None;

                    if (dragging)
                    {
                        dragging = false;
                        drag_widget.DragReleaseCallback(inputs.pos);
                    }
                }
                if (!dragging)
                {
                    focused.ClickCallback(inputs.pos, button);
                }
            }

            if (drag_button == button)
            {
                if ( !dragging && drag_origin != inputs.pos )
                {
                    dragging = true;
                    drag_widget.DragStartCallback(drag_origin, button);
                }
                if (dragging)
                {
                    drag_widget.DragCallback(inputs.pos);
                }
            }
        }
Beispiel #8
0
        public UI( GraphicsDevice arg_device, SpriteBatch arg_batch, int width, int height )
        {
            widgets = new List<Widget>();

            batch = arg_batch;
            device = arg_device;

            camera_widget = new WidgetCamera( this, new RenderCamera(arg_device, arg_batch, width, height, GameConst.upsample) ); // UPSAMPLE_MULTILIER
            status_widget = new WidgetShipStatus(arg_device, arg_batch);
            status_widget.pos.Y = height - status_widget.size.Y;
            
            widgets.Add(camera_widget);
            widgets.Add(status_widget);
            
            inputs = new InputState();
        }