Example #1
0
 protected override void updateMouse()
 {
     if (m_bounds.contains(MouseHandler.getCurPos()))
     {
         m_currentState = State.Hover;
         m_text.p_color = m_hoverColor;
         if (MouseHandler.lmbPressed())
         {
             m_currentState = State.Pressed;
             playDownSound();
             m_text.p_color = m_pressedColor;
         }
         if (MouseHandler.lmbUp())
         {
             playUpSound();
             if (m_clickEvent != null)
             {
                 m_clickEvent(this);
             }
             m_text.p_color = m_hoverColor;
         }
     }
     else if (!m_bounds.contains(MouseHandler.getCurPos()) && m_bounds.contains(MouseHandler.getPrePos()))
     {
         m_currentState = State.Normal;
         m_text.p_color = m_normalColor;
     }
 }
Example #2
0
        public static Vector2 worldMouse()
        {
            Camera l_camera = Game.getInstance().m_camera;

            return(MouseHandler.getCurPos() / l_camera.p_zoom + l_camera.p_position - ((Game.getInstance().getResolution() / 2) / l_camera.p_zoom));
        }
Example #3
0
        public static void cameraDrag()
        {
            Vector2 l_difference = (MouseHandler.getCurPos() - Game.getInstance().getResolution() / 2) / 20 / Game.getInstance().m_camera.p_zoom;

            Game.getInstance().m_camera.setPosition(Game.getInstance().m_camera.p_position + l_difference);
        }