Gamedev Framework (gf)  0.16.0
A C++14 framework for 2D games
Cursor.h
1 /*
2  * Gamedev Framework (gf)
3  * Copyright (C) 2016-2019 Julien Bernard
4  *
5  * This software is provided 'as-is', without any express or implied
6  * warranty. In no event will the authors be held liable for any damages
7  * arising from the use of this software.
8  *
9  * Permission is granted to anyone to use this software for any purpose,
10  * including commercial applications, and to alter it and redistribute it
11  * freely, subject to the following restrictions:
12  *
13  * 1. The origin of this software must not be misrepresented; you must not
14  * claim that you wrote the original software. If you use this software
15  * in a product, an acknowledgment in the product documentation would be
16  * appreciated but is not required.
17  * 2. Altered source versions must be plainly marked as such, and must not be
18  * misrepresented as being the original software.
19  * 3. This notice may not be removed or altered from any source distribution.
20  *
21  * Part of this file comes from SFML, with the same license:
22  * Copyright (C) 2007-2015 Laurent Gomila (laurent@sfml-dev.org)
23  */
24 #ifndef GF_CURSOR_H
25 #define GF_CURSOR_H
26 
27 #include <cstdint>
28 
29 #include "Portability.h"
30 #include "Vector.h"
31 
32 struct SDL_Cursor;
33 struct SDL_Surface;
34 
35 namespace gf {
36 #ifndef DOXYGEN_SHOULD_SKIP_THIS
37 inline namespace v1 {
38 #endif
39 
40  class Image;
41 
62  class GF_API Cursor {
63  public:
64 
68  enum Type {
71  Wait,
72  Text,
73  Hand,
80  NotAllowed
81  };
82 
88  Cursor();
89 
112  Cursor(const uint8_t* pixels, Vector2i size, Vector2i hotspot);
113 
120  Cursor(const Image& image, Vector2i hotspot);
121 
127  Cursor(Type type);
128 
132  Cursor(const Cursor&) = delete;
133 
137  Cursor& operator=(const Cursor&) = delete;
138 
142  Cursor(Cursor&& other) noexcept;
143 
147  Cursor& operator=(Cursor&& other) noexcept;
148 
155  ~Cursor();
156 
157  private:
158  friend class Window;
159  SDL_Cursor *m_cursor;
160  };
161 
162 #ifndef DOXYGEN_SHOULD_SKIP_THIS
163 }
164 #endif
165 }
166 
167 #endif // GF_CURSOR_H
Vertical double arrow cursor.
Definition: Cursor.h:75
Arrow cursor (default)
Definition: Cursor.h:69
Type
Enumeration of the native system cursor types.
Definition: Cursor.h:68
Double arrow cursor going from bottom-left to top-right.
Definition: Cursor.h:77
Busy arrow cursor.
Definition: Cursor.h:70
Horizontal double arrow cursor.
Definition: Cursor.h:74
Crosshair cursor.
Definition: Cursor.h:79
Combination of SizeHorizontal and SizeVertical.
Definition: Cursor.h:78
Busy cursor.
Definition: Cursor.h:71
Class for loading, manipulating and saving images.
Definition: Image.h:80
The namespace for gf classes.
Definition: Action.h:35
An OS window.
Definition: Window.h:81
I-beam, cursor when hovering over a field allowing text entry.
Definition: Cursor.h:72
Pointing hand cursor.
Definition: Cursor.h:73
Double arrow cursor going from top-left to bottom-right.
Definition: Cursor.h:76
A mouse cursor.
Definition: Cursor.h:62