MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / handleMouseMove

Method handleMouseMove

Engine/source/windowManager/windowInputGenerator.cpp:129–226  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Mouse Events -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

127// Mouse Events
128//-----------------------------------------------------------------------------
129void WindowInputGenerator::handleMouseMove( WindowId did, U32 modifier, S32 x, S32 y, bool isRelative )
130{
131 if( !mInputController || !mFocused )
132 return;
133
134 // jddTODO : Clean this up
135 // CodeReview currently the Torque GuiCanvas deals with mouse input
136 // as relative movement, even when the cursor is visible. Because
137 // of this there is an asinine bit of code in there that manages
138 // updating the cursor position on the class based on relative movement.
139 // Because of this we always have to generate and send off for processing
140 // relative events, even if the mouse is not locked.
141 // I'm considering removing this in the Canvas refactor, thoughts? [7/6/2007 justind]
142
143 // Generate a base Movement along and Axis event
144 InputEventInfo event;
145 event.deviceType = MouseDeviceType;
146 event.deviceInst = 0;
147 event.objType = SI_AXIS;
148#ifdef TORQUE_SDL
149 event.modifier = modifier;
150#else
151 event.modifier = convertModifierBits(modifier);
152#endif
153 event.ascii = 0;
154
155 // Generate delta movement along each axis
156 Point2F cursDelta;
157 if(isRelative)
158 {
159 cursDelta.x = F32(x) * mPixelsPerMickey;
160 cursDelta.y = F32(y) * mPixelsPerMickey;
161 }
162 else
163 {
164 cursDelta.x = F32(x - mLastCursorPos.x);
165 cursDelta.y = F32(y - mLastCursorPos.y);
166 }
167
168 // If X axis changed, generate a relative event
169 if(mFabs(cursDelta.x) > 0.1)
170 {
171 event.objInst = SI_XAXIS;
172 event.action = SI_MOVE;
173 event.fValue = cursDelta.x;
174 generateInputEvent(event);
175 }
176
177 // If Y axis changed, generate a relative event
178 if(mFabs(cursDelta.y) > 0.1)
179 {
180 event.objInst = SI_YAXIS;
181 event.action = SI_MOVE;
182 event.fValue = cursDelta.y;
183 generateInputEvent(event);
184 }
185
186 // CodeReview : If we're not relative, pass along a positional update

Callers

nothing calls this directly

Calls 5

convertModifierBitsFunction · 0.85
mFabsFunction · 0.85
mClampFFunction · 0.85
Point2IClass · 0.50
getClientExtentMethod · 0.45

Tested by

no test coverage detected