nomlib
Toggle main menu visibility
Loading...
Searching...
No Matches
include
nomlib
graphics
Cursor.hpp
1
/******************************************************************************
2
3
nomlib - C++11 cross-platform game engine
4
5
Copyright (c) 2013, 2014 Jeffrey Carpenter <i8degrees@gmail.com>
6
All rights reserved.
7
8
Redistribution and use in source and binary forms, with or without
9
modification, are permitted provided that the following conditions are met:
10
11
1. Redistributions of source code must retain the above copyright notice, this
12
list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright notice,
14
this list of conditions and the following disclaimer in the documentation
15
and/or other materials provided with the distribution.
16
17
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
******************************************************************************/
29
#ifndef NOMLIB_GRAPHICS_CURSOR_HPP
30
#define NOMLIB_GRAPHICS_CURSOR_HPP
31
32
#include <memory>
33
34
#include "export.hpp"
35
#include "nomlib/config.hpp"
36
#include "nomlib/math/Point2.hpp"
37
38
// Forward declarations
39
struct
SDL_Cursor;
40
41
namespace
nom {
42
43
namespace
priv {
44
45
NOM_EXPORT
void
free_cursor( SDL_Cursor* c );
46
47
}
// namespace priv
48
49
struct
NOM_EXPORT
MouseState
50
{
53
Point2i
pos
;
54
56
uint32
state
;
57
};
58
63
class
NOM_EXPORT
Cursor
64
{
65
public
:
66
typedef
Cursor
self_type;
67
68
typedef
self_type* raw_ptr;
69
73
enum
Type
74
{
75
Arrow,
76
Beam
,
77
Wait
,
78
CrossHair
,
79
WaitArrow
,
81
SizeENWSE
,
82
SizeNESW
,
83
SizeWE
,
84
SizeNS
,
85
SizeAll
,
86
No
,
87
Hand
,
88
NumSystemCursors
89
};
90
92
Cursor
(
void
);
93
95
~Cursor
(
void
);
96
104
SDL_Cursor*
cursor
(
void
)
const
;
105
109
SDL_Cursor*
default_cursor
(
void
)
const
;
110
114
NOM_EXPORT
static
MouseState
mouse_state
(
void
);
115
116
Type
system_cursor(
void
)
const
;
117
121
void
set_system_cursor
(
Type
id
);
122
127
bool
cursor_state
(
void
)
const
;
128
132
void
show_cursor
(
bool
state );
133
134
private
:
139
void
set_cursor
( SDL_Cursor*
cursor
);
140
142
Type
system_cursor_
;
143
144
// std::unique_ptr<SDL_Cursor, void(*) (SDL_Cursor*)> cursor_;
145
};
146
147
}
// namespace nom
148
149
#endif
// include guard defined
nom::Cursor::Type
Type
The mouse cursor types.
Definition
Cursor.hpp:74
nom::Cursor::No
@ No
Four pointed arrow pointing north, south, east and west.
Definition
Cursor.hpp:86
nom::Cursor::SizeWE
@ SizeWE
Double arrow pointing northeast and southwest.
Definition
Cursor.hpp:83
nom::Cursor::CrossHair
@ CrossHair
Wait.
Definition
Cursor.hpp:78
nom::Cursor::SizeAll
@ SizeAll
Double arrow pointing north and south.
Definition
Cursor.hpp:85
nom::Cursor::Wait
@ Wait
Infrared-beam.
Definition
Cursor.hpp:77
nom::Cursor::NumSystemCursors
@ NumSystemCursors
Hand.
Definition
Cursor.hpp:88
nom::Cursor::SizeNS
@ SizeNS
Double arrow pointing west and east.
Definition
Cursor.hpp:84
nom::Cursor::Beam
@ Beam
Arrow.
Definition
Cursor.hpp:76
nom::Cursor::WaitArrow
@ WaitArrow
Crosshair.
Definition
Cursor.hpp:79
nom::Cursor::SizeENWSE
@ SizeENWSE
Definition
Cursor.hpp:81
nom::Cursor::SizeNESW
@ SizeNESW
Double arrow pointing northwest and southeast.
Definition
Cursor.hpp:82
nom::Cursor::Hand
@ Hand
Slashed circle or crossbones.
Definition
Cursor.hpp:87
nom::Cursor::cursor
SDL_Cursor * cursor(void) const
Get the active mouse cursor.
nom::Cursor::set_system_cursor
void set_system_cursor(Type id)
Set a platform-dependent system cursor.
nom::Cursor::show_cursor
void show_cursor(bool state)
Toggle the visibility state of the cursor.
nom::Cursor::set_cursor
void set_cursor(SDL_Cursor *cursor)
Set the active cursor.
nom::Cursor::system_cursor_
Type system_cursor_
Track the active system cursor in use.
Definition
Cursor.hpp:142
nom::Cursor::cursor_state
bool cursor_state(void) const
Get the state of the cursor.
nom::Cursor::~Cursor
~Cursor(void)
Destructor.
nom::Cursor::default_cursor
SDL_Cursor * default_cursor(void) const
Get the default mouse cursor.
nom::Cursor::Cursor
Cursor(void)
Default constructor.
nom::Cursor::mouse_state
static NOM_EXPORT MouseState mouse_state(void)
Retrieve the current state of the mouse.
nom::MouseState
Definition
Cursor.hpp:50
nom::MouseState::state
uint32 state
32-bit button bit-mask of the current button state.
Definition
Cursor.hpp:56
nom::MouseState::pos
Point2i pos
The X & Y coordinates of the mouse cursor position, relative to the focused window.
Definition
Cursor.hpp:53
Generated on
for nomlib by
1.18.0