Gamedev Framework (gf)  0.17.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 "Path.h"
30 #include "Portability.h"
31 #include "Vector.h"
32 
33 struct SDL_Cursor;
34 struct SDL_Surface;
35 
36 namespace gf {
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38 inline namespace v1 {
39 #endif
40 
41  class Image;
42 
63  class GF_API Cursor {
64  public:
65 
69  enum Type {
72  Wait,
73  Text,
74  Hand,
81  NotAllowed
82  };
83 
89  Cursor();
90 
113  Cursor(const uint8_t* pixels, Vector2i size, Vector2i hotspot);
114 
121  Cursor(const Image& image, Vector2i hotspot);
122 
129  Cursor(const Path& path, Vector2i hotspot);
130 
136  Cursor(Type type);
137 
141  Cursor(const Cursor&) = delete;
142 
146  Cursor& operator=(const Cursor&) = delete;
147 
151  Cursor(Cursor&& other) noexcept;
152 
156  Cursor& operator=(Cursor&& other) noexcept;
157 
164  ~Cursor();
165 
166  private:
167  friend class Window;
168  SDL_Cursor *m_cursor;
169  };
170 
171 #ifndef DOXYGEN_SHOULD_SKIP_THIS
172 }
173 #endif
174 }
175 
176 #endif // GF_CURSOR_H
Vertical double arrow cursor.
Definition: Cursor.h:76
Arrow cursor (default)
Definition: Cursor.h:70
Type
Enumeration of the native system cursor types.
Definition: Cursor.h:69
Double arrow cursor going from bottom-left to top-right.
Definition: Cursor.h:78
Busy arrow cursor.
Definition: Cursor.h:71
Horizontal double arrow cursor.
Definition: Cursor.h:75
Crosshair cursor.
Definition: Cursor.h:80
Combination of SizeHorizontal and SizeVertical.
Definition: Cursor.h:79
Busy cursor.
Definition: Cursor.h:72
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:73
Pointing hand cursor.
Definition: Cursor.h:74
Double arrow cursor going from top-left to bottom-right.
Definition: Cursor.h:77
boost::filesystem::path Path
A path in the filesystem.
Definition: Path.h:44
A mouse cursor.
Definition: Cursor.h:63