raylib-cpp
C++ object-oriented wrapper library for raylib.
Mouse.hpp
1 /*
2 * LICENSE: zlib/libpng
3 *
4 * raylib-cpp is licensed under an unmodified zlib/libpng license, which is an OSI-certified,
5 * BSD-like license that allows static linking with closed source software:
6 *
7 * Copyright (c) 2020 Rob Loach (@RobLoach)
8 *
9 * This software is provided "as-is", without any express or implied warranty. In no event
10 * will the authors be held liable for any damages arising from the use of this software.
11 *
12 * Permission is granted to anyone to use this software for any purpose, including commercial
13 * applications, and to alter it and redistribute it freely, subject to the following restrictions:
14 *
15 * 1. The origin of this software must not be misrepresented; you must not claim that you
16 * wrote the original software. If you use this software in a product, an acknowledgment
17 * in the product documentation would be appreciated but is not required.
18 *
19 * 2. Altered source versions must be plainly marked as such, and must not be misrepresented
20 * as being the original software.
21 *
22 * 3. This notice may not be removed or altered from any source distribution.
23 */
24 
25 #ifndef RAYLIB_CPP_INCLUDE_MOUSE_HPP_
26 #define RAYLIB_CPP_INCLUDE_MOUSE_HPP_
27 
28 #include "./raylib.hpp"
29 
30 #include "./Vector2.hpp"
31 
32 namespace raylib {
33 class Mouse {
34  public:
35  inline bool IsButtonPressed(int button) const {
36  return ::IsMouseButtonPressed(button);
37  }
38 
39  inline bool IsButtonDown(int button) const {
40  return ::IsMouseButtonDown(button);
41  }
42 
43  inline bool IsButtonReleased(int button) const {
44  return ::IsMouseButtonReleased(button);
45  }
46 
47  inline bool IsButtonUp(int button) const {
48  return ::IsMouseButtonUp(button);
49  }
50 
51  inline int GetX() const {
52  return ::GetMouseX();
53  }
54 
55  inline int GetY() const {
56  return ::GetMouseY();
57  }
58 
59  inline Mouse& SetX(int x) {
60  ::SetMouseOffset(x, GetY());
61  return *this;
62  }
63 
64  inline Mouse& SetY(int y) {
65  ::SetMouseOffset(GetX(), y);
66  return *this;
67  }
68 
69  inline Vector2 GetPosition() const {
70  return ::GetMousePosition();
71  }
72 
73  inline Mouse& SetPosition(int x, int y) {
74  ::SetMousePosition(x, y);
75  return *this;
76  }
77 
78  inline Mouse& SetOffset(int offsetX, int offsetY) {
79  ::SetMouseOffset(offsetX, offsetY);
80  return *this;
81  }
82 
83  inline Mouse& SetScale(float scaleX, float scaleY) {
84  ::SetMouseScale(scaleX, scaleY);
85  return *this;
86  }
87 
88  inline float GetWheelMove() const {
89  return ::GetMouseWheelMove();
90  }
91 
92  inline int GetCursor() const {
93  return ::GetMouseCursor();
94  }
95 
96  inline Mouse& SetCursor(int cursor) {
97  ::SetMouseCursor(cursor);
98  return *this;
99  }
100 
101  inline int GetTouchX() const {
102  return ::GetTouchX();
103  }
104 
105  inline int GetTouchY() const {
106  return ::GetTouchY();
107  }
108 
109  inline Vector2 GetTouchPosition(int index) const {
110  return ::GetTouchPosition(index);
111  }
112 };
113 } // namespace raylib
114 
115 #endif // RAYLIB_CPP_INCLUDE_MOUSE_HPP_
raylib
Provides all the classes associated with raylib-cpp.
Definition: AudioDevice.hpp:31
raylib::Mouse::GetY
int GetY() const
Definition: Mouse.hpp:55
raylib::Mouse
Definition: Mouse.hpp:33
raylib::Mouse::GetTouchY
int GetTouchY() const
Definition: Mouse.hpp:105
raylib::Mouse::SetPosition
Mouse & SetPosition(int x, int y)
Definition: Mouse.hpp:73
raylib::Mouse::SetOffset
Mouse & SetOffset(int offsetX, int offsetY)
Definition: Mouse.hpp:78
raylib::Mouse::GetTouchX
int GetTouchX() const
Definition: Mouse.hpp:101
raylib::Mouse::SetX
Mouse & SetX(int x)
Definition: Mouse.hpp:59
raylib::Mouse::GetWheelMove
float GetWheelMove() const
Definition: Mouse.hpp:88
raylib::Mouse::IsButtonUp
bool IsButtonUp(int button) const
Definition: Mouse.hpp:47
raylib::Mouse::SetScale
Mouse & SetScale(float scaleX, float scaleY)
Definition: Mouse.hpp:83
raylib::Vector2
Definition: Vector2.hpp:37
raylib::Mouse::IsButtonReleased
bool IsButtonReleased(int button) const
Definition: Mouse.hpp:43
raylib::Mouse::IsButtonPressed
bool IsButtonPressed(int button) const
Definition: Mouse.hpp:35
raylib::Mouse::SetY
Mouse & SetY(int y)
Definition: Mouse.hpp:64
raylib::Mouse::IsButtonDown
bool IsButtonDown(int button) const
Definition: Mouse.hpp:39
raylib::Mouse::GetX
int GetX() const
Definition: Mouse.hpp:51
raylib::Mouse::GetPosition
Vector2 GetPosition() const
Definition: Mouse.hpp:69
raylib::Mouse::GetTouchPosition
Vector2 GetTouchPosition(int index) const
Definition: Mouse.hpp:109
raylib::Mouse::GetCursor
int GetCursor() const
Definition: Mouse.hpp:92
raylib::Mouse::SetCursor
Mouse & SetCursor(int cursor)
Definition: Mouse.hpp:96