1 #ifndef RAYLIB_CPP_INCLUDE_MOUSE_HPP_
2 #define RAYLIB_CPP_INCLUDE_MOUSE_HPP_
4 #include "./raylib.hpp"
5 #include "./Vector2.hpp"
17 return ::IsMouseButtonPressed(button);
24 return ::IsMouseButtonDown(button);
31 return ::IsMouseButtonReleased(button);
34 static inline bool IsButtonUp(
int button) {
35 return ::IsMouseButtonUp(button);
38 static inline int GetX() {
42 static inline int GetY() {
46 static inline void SetX(
int x) {
47 ::SetMousePosition(x, GetY());
50 static inline void SetY(
int y) {
51 ::SetMousePosition(GetX(), y);
54 static inline Vector2 GetPosition() {
55 return ::GetMousePosition();
58 static inline void SetPosition(
int x,
int y) {
59 ::SetMousePosition(x, y);
62 static inline void SetPosition(::Vector2 position) {
63 ::SetMousePosition(
static_cast<int>(position.x),
static_cast<int>(position.y));
70 return ::GetMouseDelta();
73 static inline void SetOffset(
int offsetX = 0,
int offsetY = 0) {
74 ::SetMouseOffset(offsetX, offsetY);
77 static inline void SetOffset(::Vector2 offset) {
78 ::SetMouseOffset(
static_cast<int>(offset.x),
static_cast<int>(offset.y));
81 static inline void SetScale(
float scaleX = 1.0f,
float scaleY = 1.0f) {
82 ::SetMouseScale(scaleX, scaleY);
85 static inline void SetScale(::Vector2 scale) {
86 ::SetMouseScale(scale.x, scale.y);
93 return ::GetMouseWheelMove();
102 return GetMouseWheelMoveV();
110 static inline void SetCursor(
int cursor = MOUSE_CURSOR_DEFAULT) {
111 ::SetMouseCursor(cursor);
118 return ::GetTouchX();
125 return ::GetTouchY();
132 return ::GetTouchPosition(index);
139 return ::GetMouseRay(mousePosition, camera);
146 return ::GetMouseRay(::GetMousePosition(), camera);
Input-related functions: mouse.
static int GetTouchX()
Get touch position X for touch point 0 (relative to screen size)
static bool IsButtonDown(int button)
Detect if a mouse button is being pressed.
static int GetTouchY()
Get touch position Y for touch point 0 (relative to screen size)
static Vector2 GetTouchPosition(int index)
Get touch position XY for a touch point index (relative to screen size)
static void SetCursor(int cursor=MOUSE_CURSOR_DEFAULT)
Sets the current mouse cursor icon.
static bool IsButtonReleased(int button)
Detect if a mouse button has been released once.
static Ray GetRay(const ::Camera &camera)
Get a ray trace from mouse position.
static bool IsButtonPressed(int button)
Detect if a mouse button has been pressed once.
static Ray GetRay(::Vector2 mousePosition, const ::Camera &camera)
Get a ray trace from mouse position.
static Vector2 GetWheelMoveV()
Get mouse wheel movement for both X and Y.
static Vector2 GetDelta()
Get mouse delta between frames.
static float GetWheelMove()
Get mouse wheel movement for X or Y, whichever is larger.
Ray type (useful for raycast)
All raylib-cpp classes and functions appear in the raylib namespace.