Hi! Is it possible to check if the mouse move and if a mouse button state changes? I want to move a node when the right button is pressed an the mousepointer moves.
regards, Tom
Recieve Mouse Move and Mouse Click?
-
DarkWood_Neo
- Posts: 52
- Joined: Thu Sep 04, 2003 7:45 pm
- Location: Germany
yes it's possible.
ICursorControl *ctrl = device->getCursorControl();
position2d<s32> cpos = ctrl->getPosition(); or
position2d<f32> cpos = ctrl->getRelativePosition();
the you got the position of the cursor and it's stored in cpos.
if you use "getRelativePosition()":
btw: Reading the documentation is mostly advisable............
ICursorControl *ctrl = device->getCursorControl();
position2d<s32> cpos = ctrl->getPosition(); or
position2d<f32> cpos = ctrl->getRelativePosition();
the you got the position of the cursor and it's stored in cpos.
if you use "getRelativePosition()":
and "getPosition()":Returns the current position of the cursor. The returned position is a value between (0.0f, 0.0f) and (1.0f, 1.0f), where (0.0f, 0.0f) is the top left corner and (1.0f, 1.0f) is the bottom right corner of the render window.
and this is the code to test if a mouse button is klicked:Returns the current position of the cursor. The returned position is the position of the mouse cursor in pixel units.
Code: Select all
bool YourClass:OnEvent(SEvent event)
{
if (event.EventType == EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event == EMIE_LMOUSE_PRESSED_DOWN)
{
//Your Code here
};
return false;
};