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