Jopnal Engine  alpha 0.4
Simple Component Based 2D/3D Game Engine
Public Types | Static Public Member Functions | List of all members
jop::Mouse Class Reference

#include <Mouse.hpp>

Public Types

enum  Button {
  Unknown, Left, Right, Middle,
  X1, X2, X3, X4,
  X5
}
 
enum  Mode { Mode::Visible, Mode::Hidden, Mode::Frozen }
 

Static Public Member Functions

static bool isButtonDown (const Button button)
 Check if a mouse button is down. More...
 
static glm::vec2 getPosition ()
 Get the mouse cursor position. More...
 
static void setMouseMode (const Mode mode)
 Set the mouse mode. More...
 
static void setClipping ()
 Restricts the mouse cursor inside the main window. More...
 
static void setClipping (const glm::ivec2 &min, const glm::ivec2 &max)
 Restricts mouse into a rectangular area inside the main window. More...
 
static const std::pair< glm::ivec2, glm::ivec2 > & getClipping ()
 Get clipping coordinates of the mouse cursor. More...
 
static bool isClipping ()
 Check if the mouse cursor has been clipped. More...
 
static void releaseClipping ()
 Release the mouse cursor if it was previously clipped. More...
 

Detailed Description

Definition at line 36 of file Mouse.hpp.

Member Enumeration Documentation

Mouse buttons

Enumerator
Unknown 
Left 
Right 
Middle 
X1 
X2 
X3 
X4 
X5 

Definition at line 42 of file Mouse.hpp.

enum jop::Mouse::Mode
strong

Mouse modes

Enumerator
Visible 

Visible makes cursor visible and behave normally.

Hidden 

Hidden makes cursor invisible when its not over the client area of the window, but does not restrict it from leaving.

Frozen 

Frozen hides and grabs the cursor, providing virtual and unlimited cursor movement.

Definition at line 57 of file Mouse.hpp.

Member Function Documentation

static const std::pair<glm::ivec2, glm::ivec2>& jop::Mouse::getClipping ( )
static

Get clipping coordinates of the mouse cursor.

Returns
The clipping coordinates (first = minimum, second = maximum)
static glm::vec2 jop::Mouse::getPosition ( )
static

Get the mouse cursor position.

Returns
The mouse position
static bool jop::Mouse::isButtonDown ( const Button  button)
static

Check if a mouse button is down.

Parameters
buttonThe mouse button
Returns
True if button is down
static bool jop::Mouse::isClipping ( )
static

Check if the mouse cursor has been clipped.

Returns
True if the mouse cursor is clipped
static void jop::Mouse::releaseClipping ( )
static

Release the mouse cursor if it was previously clipped.

static void jop::Mouse::setClipping ( )
static

Restricts the mouse cursor inside the main window.

static void jop::Mouse::setClipping ( const glm::ivec2 &  min,
const glm::ivec2 &  max 
)
static

Restricts mouse into a rectangular area inside the main window.

The coordinates are relative to the main window.

Parameters
minThe minimum coordinates of the restriction rectangle (left, top)
maxThe maximum coordinates of the restriction rectangle (right, bottom)
static void jop::Mouse::setMouseMode ( const Mode  mode)
static

Set the mouse mode.

Parameters
modeThe mouse mode

The documentation for this class was generated from the following file: