| 1 | /** | 
|---|
| 2 | * Copyright (c) 2006-2023 LOVE Development Team | 
|---|
| 3 | * | 
|---|
| 4 | * This software is provided 'as-is', without any express or implied | 
|---|
| 5 | * warranty.  In no event will the authors be held liable for any damages | 
|---|
| 6 | * arising from the use of this software. | 
|---|
| 7 | * | 
|---|
| 8 | * Permission is granted to anyone to use this software for any purpose, | 
|---|
| 9 | * including commercial applications, and to alter it and redistribute it | 
|---|
| 10 | * freely, subject to the following restrictions: | 
|---|
| 11 | * | 
|---|
| 12 | * 1. The origin of this software must not be misrepresented; you must not | 
|---|
| 13 | *    claim that you wrote the original software. If you use this software | 
|---|
| 14 | *    in a product, an acknowledgment in the product documentation would be | 
|---|
| 15 | *    appreciated but is not required. | 
|---|
| 16 | * 2. Altered source versions must be plainly marked as such, and must not be | 
|---|
| 17 | *    misrepresented as being the original software. | 
|---|
| 18 | * 3. This notice may not be removed or altered from any source distribution. | 
|---|
| 19 | **/ | 
|---|
| 20 |  | 
|---|
| 21 | #ifndef LOVE_MOUSE_SDL_MOUSE_H | 
|---|
| 22 | #define LOVE_MOUSE_SDL_MOUSE_H | 
|---|
| 23 |  | 
|---|
| 24 | // LOVE | 
|---|
| 25 | #include "mouse/Mouse.h" | 
|---|
| 26 | #include "Cursor.h" | 
|---|
| 27 |  | 
|---|
| 28 | // C++ | 
|---|
| 29 | #include <map> | 
|---|
| 30 |  | 
|---|
| 31 | namespace love | 
|---|
| 32 | { | 
|---|
| 33 | namespace mouse | 
|---|
| 34 | { | 
|---|
| 35 | namespace sdl | 
|---|
| 36 | { | 
|---|
| 37 |  | 
|---|
| 38 | class Mouse : public love::mouse::Mouse | 
|---|
| 39 | { | 
|---|
| 40 | public: | 
|---|
| 41 |  | 
|---|
| 42 | // Implements Module. | 
|---|
| 43 | const char *getName() const override; | 
|---|
| 44 |  | 
|---|
| 45 | Mouse(); | 
|---|
| 46 | virtual ~Mouse(); | 
|---|
| 47 |  | 
|---|
| 48 | love::mouse::Cursor *newCursor(love::image::ImageData *data, int hotx, int hoty) override; | 
|---|
| 49 | love::mouse::Cursor *getSystemCursor(Cursor::SystemCursor cursortype) override; | 
|---|
| 50 |  | 
|---|
| 51 | void setCursor(love::mouse::Cursor *cursor) override; | 
|---|
| 52 | void setCursor() override; | 
|---|
| 53 |  | 
|---|
| 54 | love::mouse::Cursor *getCursor() const override; | 
|---|
| 55 |  | 
|---|
| 56 | bool isCursorSupported() const override; | 
|---|
| 57 |  | 
|---|
| 58 | double getX() const override; | 
|---|
| 59 | double getY() const override; | 
|---|
| 60 | void getPosition(double &x, double &y) const override; | 
|---|
| 61 | void setX(double x) override; | 
|---|
| 62 | void setY(double y) override; | 
|---|
| 63 | void setPosition(double x, double y) override; | 
|---|
| 64 | void setVisible(bool visible) override; | 
|---|
| 65 | bool isDown(const std::vector<int> &buttons) const override; | 
|---|
| 66 | bool isVisible() const override; | 
|---|
| 67 | void setGrabbed(bool grab) override; | 
|---|
| 68 | bool isGrabbed() const override; | 
|---|
| 69 | bool setRelativeMode(bool relative) override; | 
|---|
| 70 | bool getRelativeMode() const override; | 
|---|
| 71 |  | 
|---|
| 72 | private: | 
|---|
| 73 |  | 
|---|
| 74 | StrongRef<love::mouse::Cursor> curCursor; | 
|---|
| 75 |  | 
|---|
| 76 | std::map<Cursor::SystemCursor, Cursor *> systemCursors; | 
|---|
| 77 |  | 
|---|
| 78 | }; // Mouse | 
|---|
| 79 |  | 
|---|
| 80 | } // sdl | 
|---|
| 81 | } // mouse | 
|---|
| 82 | } // love | 
|---|
| 83 |  | 
|---|
| 84 | #endif // LOVE_MOUSE_SDL_MOUSE_H | 
|---|
| 85 |  | 
|---|