Skip to content

Commit 73ca3f7

Browse files
committed
Update keyboard/mouse/touch to use maybe_unused
1 parent aee606b commit 73ca3f7

File tree

3 files changed

+38
-39
lines changed

3 files changed

+38
-39
lines changed

include/Keyboard.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,49 +11,49 @@ namespace Keyboard {
1111
/**
1212
* Detect if a key has been pressed once
1313
*/
14-
static bool IsKeyPressed(int key) {
14+
[[maybe_unused]] RLCPPAPI inline bool IsKeyPressed(int key) {
1515
return ::IsKeyPressed(key);
1616
}
1717

1818
/**
1919
* Detect if a key has been pressed again (Only PLATFORM_DESKTOP)
2020
*/
21-
static bool IsKeyPressedRepeat(int key) {
21+
[[maybe_unused]] RLCPPAPI inline bool IsKeyPressedRepeat(int key) {
2222
return ::IsKeyPressedRepeat(key);
2323
}
2424

2525
/**
2626
* Detect if a key is being pressed
2727
*/
28-
static bool IsKeyDown(int key) {
28+
[[maybe_unused]] RLCPPAPI inline bool IsKeyDown(int key) {
2929
return ::IsKeyDown(key);
3030
}
3131

3232
/**
3333
* Detect if a key has been released once
3434
*/
35-
static bool IsKeyReleased(int key) {
35+
[[maybe_unused]] RLCPPAPI inline bool IsKeyReleased(int key) {
3636
return ::IsKeyReleased(key);
3737
}
3838

3939
/**
4040
* Detect if a key is NOT being pressed
4141
*/
42-
static bool IsKeyUp(int key) {
42+
[[maybe_unused]] RLCPPAPI inline bool IsKeyUp(int key) {
4343
return ::IsKeyUp(key);
4444
}
4545

4646
/**
4747
* Get key pressed (keycode), call it multiple times for keys queued, returns 0 when the queue is empty
4848
*/
49-
static bool GetKeyPressed() {
49+
[[maybe_unused]] RLCPPAPI inline bool GetKeyPressed() {
5050
return ::GetKeyPressed();
5151
}
5252

5353
/**
5454
* Get char pressed (unicode), call it multiple times for chars queued, returns 0 when the queue is empty
5555
*/
56-
static bool GetCharPressed() {
56+
[[maybe_unused]] RLCPPAPI inline bool GetCharPressed() {
5757
return ::GetCharPressed();
5858
}
5959
};

include/Mouse.hpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,83 +12,83 @@ namespace Mouse {
1212
/**
1313
* Detect if a mouse button has been pressed once
1414
*/
15-
static bool IsButtonPressed(int button) {
15+
[[maybe_unused]] RLCPPAPI inline bool IsButtonPressed(int button) {
1616
return ::IsMouseButtonPressed(button);
1717
}
1818

1919
/**
2020
* Detect if a mouse button is being pressed
2121
*/
22-
static bool IsButtonDown(int button) {
22+
[[maybe_unused]] RLCPPAPI inline bool IsButtonDown(int button) {
2323
return ::IsMouseButtonDown(button);
2424
}
2525

2626
/**
2727
* Detect if a mouse button has been released once
2828
*/
29-
static bool IsButtonReleased(int button) {
29+
[[maybe_unused]] RLCPPAPI inline bool IsButtonReleased(int button) {
3030
return ::IsMouseButtonReleased(button);
3131
}
3232

33-
static bool IsButtonUp(int button) {
33+
[[maybe_unused]] RLCPPAPI inline bool IsButtonUp(int button) {
3434
return ::IsMouseButtonUp(button);
3535
}
3636

37-
static int GetX() {
37+
[[maybe_unused]] RLCPPAPI inline int GetX() {
3838
return ::GetMouseX();
3939
}
4040

41-
static int GetY() {
41+
[[maybe_unused]] RLCPPAPI inline int GetY() {
4242
return ::GetMouseY();
4343
}
4444

45-
static void SetX(int x) {
45+
[[maybe_unused]] RLCPPAPI inline void SetX(int x) {
4646
::SetMousePosition(x, GetY());
4747
}
4848

49-
static void SetY(int y) {
49+
[[maybe_unused]] RLCPPAPI inline void SetY(int y) {
5050
::SetMousePosition(GetX(), y);
5151
}
5252

53-
static Vector2 GetPosition() {
53+
[[maybe_unused]] RLCPPAPI inline Vector2 GetPosition() {
5454
return ::GetMousePosition();
5555
}
5656

57-
static void SetPosition(int x, int y) {
57+
[[maybe_unused]] RLCPPAPI inline void SetPosition(int x, int y) {
5858
::SetMousePosition(x, y);
5959
}
6060

61-
static void SetPosition(::Vector2 position) {
61+
[[maybe_unused]] RLCPPAPI inline void SetPosition(::Vector2 position) {
6262
::SetMousePosition(static_cast<int>(position.x), static_cast<int>(position.y));
6363
}
6464

6565
/**
6666
* Get mouse delta between frames
6767
*/
68-
static Vector2 GetDelta() {
68+
[[maybe_unused]] RLCPPAPI inline Vector2 GetDelta() {
6969
return ::GetMouseDelta();
7070
}
7171

72-
static void SetOffset(int offsetX = 0, int offsetY = 0) {
72+
[[maybe_unused]] RLCPPAPI inline void SetOffset(int offsetX = 0, int offsetY = 0) {
7373
::SetMouseOffset(offsetX, offsetY);
7474
}
7575

76-
static void SetOffset(::Vector2 offset) {
76+
[[maybe_unused]] RLCPPAPI inline void SetOffset(::Vector2 offset) {
7777
::SetMouseOffset(static_cast<int>(offset.x), static_cast<int>(offset.y));
7878
}
7979

80-
static void SetScale(float scaleX = 1.0f, float scaleY = 1.0f) {
80+
[[maybe_unused]] RLCPPAPI inline void SetScale(float scaleX = 1.0f, float scaleY = 1.0f) {
8181
::SetMouseScale(scaleX, scaleY);
8282
}
8383

84-
static void SetScale(::Vector2 scale) {
84+
[[maybe_unused]] RLCPPAPI inline void SetScale(::Vector2 scale) {
8585
::SetMouseScale(scale.x, scale.y);
8686
}
8787

8888
/**
8989
* Get mouse wheel movement for X or Y, whichever is larger
9090
*/
91-
static float GetWheelMove() {
91+
[[maybe_unused]] RLCPPAPI inline float GetWheelMove() {
9292
return ::GetMouseWheelMove();
9393
}
9494

@@ -97,7 +97,7 @@ namespace Mouse {
9797
*
9898
* @see ::GetMouseWheelMoveV()
9999
*/
100-
static Vector2 GetWheelMoveV() {
100+
[[maybe_unused]] RLCPPAPI inline Vector2 GetWheelMoveV() {
101101
return GetMouseWheelMoveV();
102102
}
103103

@@ -106,42 +106,42 @@ namespace Mouse {
106106
*
107107
* @see ::MouseCursor
108108
*/
109-
static void SetCursor(int cursor = MOUSE_CURSOR_DEFAULT) {
109+
[[maybe_unused]] RLCPPAPI inline void SetCursor(int cursor = MOUSE_CURSOR_DEFAULT) {
110110
::SetMouseCursor(cursor);
111111
}
112112

113113
/**
114114
* Get touch position X for touch point 0 (relative to screen size)
115115
*/
116-
static int GetTouchX() {
116+
[[maybe_unused]] RLCPPAPI inline int GetTouchX() {
117117
return ::GetTouchX();
118118
}
119119

120120
/**
121121
* Get touch position Y for touch point 0 (relative to screen size)
122122
*/
123-
static int GetTouchY() {
123+
[[maybe_unused]] RLCPPAPI inline int GetTouchY() {
124124
return ::GetTouchY();
125125
}
126126

127127
/**
128128
* Get touch position XY for a touch point index (relative to screen size)
129129
*/
130-
static Vector2 GetTouchPosition(int index) {
130+
[[maybe_unused]] RLCPPAPI inline Vector2 GetTouchPosition(int index) {
131131
return ::GetTouchPosition(index);
132132
}
133133

134134
/**
135135
* Get a ray trace from mouse position
136136
*/
137-
static Ray GetRay(::Vector2 mousePosition, const ::Camera& camera) {
137+
[[maybe_unused]] RLCPPAPI inline Ray GetRay(::Vector2 mousePosition, const ::Camera& camera) {
138138
return ::GetMouseRay(mousePosition, camera);
139139
}
140140

141141
/**
142142
* Get a ray trace from mouse position
143143
*/
144-
static Ray GetRay(const ::Camera& camera) {
144+
[[maybe_unused]] RLCPPAPI inline Ray GetRay(const ::Camera& camera) {
145145
return ::GetMouseRay(::GetMousePosition(), camera);
146146
}
147147
};

include/Touch.hpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,45 +7,44 @@ namespace raylib {
77
/**
88
* Input-related functions: touch
99
*/
10-
class Touch {
11-
public:
10+
namespace Touch {
1211
/**
1312
* Get touch position X for touch point 0 (relative to screen size)
1413
*/
15-
static int GetX() {
14+
[[maybe_unused]] RLCPPAPI inline int GetX() {
1615
return ::GetTouchX();
1716
}
1817

1918
/**
2019
* Get touch position Y for touch point 0 (relative to screen size)
2120
*/
22-
static int GetY() {
21+
[[maybe_unused]] RLCPPAPI inline int GetY() {
2322
return ::GetTouchY();
2423
}
2524

2625
/**
2726
* Get touch position XY for a touch point index (relative to screen size)
2827
*/
29-
static Vector2 GetPosition(int index) {
28+
[[maybe_unused]] RLCPPAPI inline Vector2 GetPosition(int index) {
3029
return ::GetTouchPosition(index);
3130
}
3231

3332
/**
3433
* Get touch point identifier for given index
3534
*/
36-
static int GetPointId(int index) {
35+
[[maybe_unused]] RLCPPAPI inline int GetPointId(int index) {
3736
return ::GetTouchPointId(index);
3837
}
3938

4039
/**
4140
* Get number of touch points
4241
*/
43-
static int GetPointCount() {
42+
[[maybe_unused]] RLCPPAPI inline int GetPointCount() {
4443
return ::GetTouchPointCount();
4544
}
4645
};
4746
} // namespace raylib
4847

49-
using RTouch = raylib::Touch;
48+
namespace RTouch = raylib::Touch;
5049

5150
#endif // RAYLIB_CPP_INCLUDE_TOUCH_HPP_

0 commit comments

Comments
 (0)