Heres One Now.
In the UserInterface Demo. I wanted to be able to run it and see where my mouse x, y location would be over the entire screen so i could map out where i want to place things, But i only wanted them to show in Debug mode.
so i added this:
Code: Select all
bool MyEventReceiver::OnEvent(SEvent event)
{
//mouse events
if (event.EventType == EET_MOUSE_INPUT_EVENT)
{
switch(event.MouseInput.Event)
{
//! Left mouse button was pressed down.
case EMIE_LMOUSE_PRESSED_DOWN:// = 0,
//! Right mouse button was pressed down.
case EMIE_RMOUSE_PRESSED_DOWN:
break;
//! Middle mouse button was pressed down.
case EMIE_MMOUSE_PRESSED_DOWN:
break;
//! Left mouse button was left up.
case EMIE_LMOUSE_LEFT_UP:
break;
//! Right mouse button was left up.
case EMIE_RMOUSE_LEFT_UP:
break;
//! Middle mouse button was left up.
case EMIE_MMOUSE_LEFT_UP:
break;
//! The mouse cursor changed its position.
case EMIE_MOUSE_MOVED:
{
#ifdef _DEBUG
//spits out the x,y coords for the mouse position
//helpful for designing a layout or sizing Gui items
char cpos[12];
wchar_t pos[12];
for(int j=0;j<12;j++) //pre-format the string data
{
cpos[j] = '\0';
pos[j]='\0';
}
wsprintf(cpos,"%u %u",device->getCursorControl()->getPosition());
wprintf(L"x:%u y:%u\n", device->getCursorControl()->getPosition());
mbstowcs(pos , cpos , 12);
device->setWindowCaption(&pos[0]);
#endif
break;
}
default:
break;
}
}
//end mouse events
...//more code
The code sets the windows caption to x,y coordinates of the mouse location