Sleeping Wombat GUI
0.100
swGUI
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
swInputLibrary
InputCore
KeyState.h
Go to the documentation of this file.
1
#pragma once
2
10
#include "
swCommonLib/Common/TypesDefinitions.h
"
11
12
#include <assert.h>
13
14
15
16
17
namespace
sw
{
18
namespace
input
19
{
20
21
22
26
class
KeyState
27
{
28
enum
KeyStateFlag
:
int8
29
{
30
Pressed
= 0x1,
31
DownEvent
= 0x2,
32
UpEvent
= 0x4
33
};
34
35
private
:
36
37
int8
m_state
;
38
39
public
:
40
41
explicit
KeyState
()
42
: m_state( 0 )
43
{}
44
45
inline
bool
IsPressed
()
const
{
return
( m_state &
Pressed
) != 0; }
46
inline
bool
IsUp
()
const
{
return
!
IsPressed
(); }
47
48
inline
bool
IsKeyDownEvent
()
const
{
return
( m_state &
DownEvent
) != 0; }
49
inline
bool
IsKeyUpEvent
()
const
{
return
( m_state &
UpEvent
) != 0; }
50
52
inline
operator
void
* ( )
const
{
return
(
void
*)
IsPressed
(); }
53
54
inline
void
operator=
(
KeyState
newState )
55
{
56
m_state = newState.
m_state
;
57
}
58
59
public
:
62
inline
void
Press
() { m_state =
Pressed
|
DownEvent
; }
63
inline
void
UnPress
() { m_state =
UpEvent
; }
64
inline
void
HoldState
() { m_state = m_state &
Pressed
; }
65
66
inline
void
operator=
(
bool
newState )
67
{
68
if
( !
IsPressed
() && newState )
69
Press
();
70
else
if
(
IsPressed
() && !newState )
71
UnPress
();
72
else
73
HoldState
();
74
}
76
};
77
78
79
}
// input
80
}
// sw
81
sw::input::KeyState::IsKeyDownEvent
bool IsKeyDownEvent() const
Definition:
KeyState.h:48
sw::input::KeyState::DownEvent
Definition:
KeyState.h:31
int8
int8_t int8
Definition:
TypesDefinitions.h:26
sw
Definition:
DirectInputModule.cpp:11
sw::input::KeyState::operator=
void operator=(KeyState newState)
Definition:
KeyState.h:54
sw::input::KeyState::Press
void Press()
Wciska przycisk.
Definition:
KeyState.h:62
sw::input::KeyState::IsUp
bool IsUp() const
Definition:
KeyState.h:46
TypesDefinitions.h
Plik zawiera definicje podstawowych typów zmiennych.
sw::input::KeyState::m_state
int8 m_state
Definition:
KeyState.h:37
sw::input::KeyState::IsKeyUpEvent
bool IsKeyUpEvent() const
Definition:
KeyState.h:49
sw::input::KeyState::UpEvent
Definition:
KeyState.h:32
sw::input::KeyState::KeyStateFlag
KeyStateFlag
Definition:
KeyState.h:28
sw::input::KeyState::KeyState
KeyState()
Definition:
KeyState.h:41
sw::input::KeyState
Button state structure..
Definition:
KeyState.h:26
sw::input::KeyState::HoldState
void HoldState()
Podtrzymuje stan przycisku i kasuje info o eventach.
Definition:
KeyState.h:64
sw::input::KeyState::IsPressed
bool IsPressed() const
Definition:
KeyState.h:45
sw::input::KeyState::Pressed
Definition:
KeyState.h:30
sw::input::KeyState::UnPress
void UnPress()
Puszcza przycisk.
Definition:
KeyState.h:63
Generated on Tue May 9 2017 15:46:02 for Sleeping Wombat GUI by
1.8.9.1