mElite  1.0
An Elite clone based on TextElite by Jan-Philipp Kappmeier and Melanie Schmidt.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
MouseHandler.cpp
Go to the documentation of this file.
1 
6 #include "MouseHandler.h"
7 
9  m_mouseHovering = false;
10 }
11 
13 }
14 
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 
52  m_position = position;
53 }
54 
56  m_position.x = x;
57  m_position.y = y;
58 }
59 
61  return m_position;
62 }
63 
65  m_hitted = hitObject;
66 }
67 
68 void MouseHandler::setHittedObjectInfo( int hitInfo ) {
69  m_hittedInfo = hitInfo;
70 }
71 
73  return m_hitted;
74 }
75 
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!!!
85 
86 }
87 
89 
90 }
91 
93 
94 }
95 
97 
98 }
99 
101  return this->m_moveStartPosition;
102 }
103 
105  return this->m_moveEndPosition;
106 }