mElite
1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
mElite
MouseHandler.cpp
Go to the documentation of this file.
1
6
#include "
MouseHandler.h
"
7
8
MouseHandler::MouseHandler
(
void
) {
9
m_mouseHovering =
false
;
10
}
11
12
MouseHandler::~MouseHandler
(
void
) {
13
}
14
15
bool
MouseHandler::isMouseHoveringActive
() {
16
return
m_mouseHovering;
17
}
18
19
void
MouseHandler::setMouseHovering
(
bool
status ) {
20
m_mouseHovering = status;
21
}
22
24
31
bool
MouseHandler::isMouseOverRect
(
unsigned
int
left,
unsigned
int
right,
unsigned
int
top,
unsigned
int
bottom ) {
32
if
( m_mouseHovering )
33
if
( m_position.
x
> left && m_position.
x
< right && m_position.
y
> top && m_position.
y
< bottom )
34
return
true
;
35
return
false
;
// other cases (not over rect and mouse hovering disabled!
36
}
37
38
40
47
bool
MouseHandler::isMouseOverRectCenter
(
unsigned
int
centerx,
unsigned
int
centery,
unsigned
int
width,
unsigned
int
height ) {
48
return
isMouseOverRect
( centerx - width*0.5, centerx + width*0.5, centery - height*0.5, centery + height*0.5 );
49
}
50
51
void
MouseHandler::setMousePosition
(
Position
position ) {
52
m_position = position;
53
}
54
55
void
MouseHandler::setMousePosition
(
int
x
,
int
y
) {
56
m_position.
x
=
x
;
57
m_position.
y
=
y
;
58
}
59
60
Position
MouseHandler::getMousePosition
() {
61
return
m_position;
62
}
63
64
void
MouseHandler::setHittedObject
(
HitableObjects
hitObject ) {
65
m_hitted = hitObject;
66
}
67
68
void
MouseHandler::setHittedObjectInfo
(
int
hitInfo ) {
69
m_hittedInfo = hitInfo;
70
}
71
72
HitableObjects
MouseHandler::getHittedObject
() {
73
return
m_hitted;
74
}
75
76
int
MouseHandler::getHittedObjectInfo
() {
77
return
m_hittedInfo;
78
}
79
80
// todo:
81
// for better mouse interaction use this positions and some more --> hitObjectMouse down and so on
82
// but it also works without them, but no moving is possible and the button-up-position is _only_
83
// used for klicking, not, as used in windows, the button-down and button-up-positon!!!
84
void
MouseHandler::setMouseMoveStartPosition
(
Position
startPosition ) {
85
86
}
87
88
void
MouseHandler::setMouseMoveStartPosition
(
int
x
,
int
y
) {
89
90
}
91
92
void
MouseHandler::setMouseMoveEndPosition
(
Position
endPosition ) {
93
94
}
95
96
void
MouseHandler::setMouseMoveEndPosition
(
int
x
,
int
y
) {
97
98
}
99
100
Position
MouseHandler::getMouseMoveStartPosition
(
void
) {
101
return
this->m_moveStartPosition;
102
}
103
104
Position
MouseHandler::getMouseMoveEndPosition
(
void
) {
105
return
this->m_moveEndPosition;
106
}
Generated on Tue Oct 2 2012 14:38:37 for mElite by
1.8.2