Example #1
0
        public static Vector2 previousWorldMouse()
        {
            Camera l_camera = Game.getInstance().m_camera;

            return(MouseHandler.getPrePos() / l_camera.p_zoom + l_camera.p_position - ((Game.getInstance().getResolution() / 2) / l_camera.p_zoom));
        }
Example #2
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;
     }
 }