Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <mouse_state.h>
Classes | |
struct | MouseButtonState |
Public Member Functions | |
bool | GetButton (MouseButton button) |
bool | GetButtonDown (MouseButton button) |
bool | GetButtonPressed (MouseButton button) |
bool | GetButtonReleased (MouseButton button) |
const DirectX::XMFLOAT2 & | GetMousePosition () const |
const DirectX::XMFLOAT2 & | GetMousePositionDelta () const |
const DirectX::XMFLOAT2 & | GetScrollDelta () const |
Protected Member Functions | |
void | SetMouseButtonPressed (MouseButton button) |
void | SetMouseButtonReleased (MouseButton button) |
void | SetMouseButtonModifiers (MouseButton button, int modifiers) |
void | SetMousePosition (const DirectX::XMFLOAT2 &new_mouse_position) |
void | SetScrollDelta (const DirectX::XMFLOAT2 &delta_scroll) |
void | SetMouseInWindow (bool is_mouse_in_window) |
void | Update () |
Private Attributes | |
DirectX::XMFLOAT2 | mouse_position_ |
DirectX::XMFLOAT2 | delta_mouse_position_ |
DirectX::XMFLOAT2 | delta_mouse_position_accumulator_ |
DirectX::XMFLOAT2 | delta_scroll_ |
DirectX::XMFLOAT2 | delta_scroll_accumulator_ |
bool | is_mouse_in_window_ |
Map< MouseButton, MouseButtonState > | mouse_button_states_ |
Friends | |
class | Window |
class | GLFWManager |
class | ImGuiManager |
Keeps track of the state of the mouse.
This class keeps track of the state of the mouse. Normally, you would find access to instances of this class through Window instances, because every Window has different mouse states. Access the MouseState by calling Window::GetMouseState().
bool blowbox::MouseState::GetButton | ( | MouseButton | button | ) |
Find out whether a button is down or not.
[in] | button | The key you want to know the down-state of. |
bool blowbox::MouseState::GetButtonDown | ( | MouseButton | button | ) |
Find out whether a button is down or not.
[in] | button | The key you want to know the down-state of. |
bool blowbox::MouseState::GetButtonPressed | ( | MouseButton | button | ) |
Find out whether a button is pressed or not.
[in] | button | The key you want to know the pressed-state of. |
bool blowbox::MouseState::GetButtonReleased | ( | MouseButton | button | ) |
Find out whether a button is released or not.
[in] | button | The key you want to know the released-state of. |
const DirectX::XMFLOAT2 & blowbox::MouseState::GetMousePosition | ( | ) | const |
const DirectX::XMFLOAT2 & blowbox::MouseState::GetMousePositionDelta | ( | ) | const |
const DirectX::XMFLOAT2 & blowbox::MouseState::GetScrollDelta | ( | ) | const |
|
protected |
Changes the key modifiers of a button to true.
[in] | button | The button to be changed. |
[in] | modifiers | The modifiers that were pressed when the button was pressed. |
|
protected |
Changes the press-state of a button to true.
[in] | button | The button to be changed. |
|
protected |
Changes the release-state of a button to true.
[in] | button | The button to be changed. |
|
protected |
Sets whether the mouse is in the window or not.
[in] | is_mouse_in_window | Whether the mouse is in the window or not. |
|
protected |
Sets the mouse's position.
[in] | new_mouse_position | The mouse's new position. |
|
protected |
Sets the mouse's scroll delta.
[in] | delta_scroll | The delta scroll. |
|
protected |
Updates the MouseState. This makes it so that all accumulators are cleared and mouse states are updated accordingly.
|
private |
The delta of the mouse position over the last frame.
|
private |
An accumulator of delta mouse positions.
|
private |
The delta scroll of the mouse over the last frame.
|
private |
An accumulator of delta scrolls.
|
private |
Whether the mouse is in the window.
|
private |
All the different mouse states.
|
private |
The current position of the mouse.