My problem is getting mouse input for irrlicht when in a windows form. I am NOT using irrlicht.net. This is a C++ project.
I am starting the irrlicht loop with this:
Code: Select all
private: System::Void dialog_Load(System::Object^ sender, System::EventArgs^ e)
{
Manager^ Mgr;
parenthWnd = (HWND)this->Handle.ToPointer();
Threading::Thread^ dThread;
Mgr = gcnew Manager;
dThread = gcnew Thread( gcnew ThreadStart( Mgr, &Manager::run_main ));
dThread->Start();
}
Code: Select all
virtual void WndProc( Message% m ) override
{
irr::SEvent irr_event;
switch( m.Msg )
{
case WM_MOUSEMOVE:
{
irr_event.MouseInput.X = (short)LOWORD( &m.LParam );
irr_event.MouseInput.Y = (short)HIWORD( &m.LParam );
irr_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
device->postEventFromUser( irr_event );
break;
}
case WM_LBUTTONDOWN:
{
irr_event.MouseInput.X = (short)LOWORD( &m.LParam );
irr_event.MouseInput.Y = (short)HIWORD( &m.LParam );
irr_event.MouseInput.Event = irr::EMIE_LMOUSE_PRESSED_DOWN;
irr_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
device->postEventFromUser( irr_event );
break;
}
case WM_LBUTTONUP:
{
irr_event.MouseInput.X = (short)LOWORD( &m.LParam );
irr_event.MouseInput.Y = (short)HIWORD( &m.LParam );
irr_event.MouseInput.Event = irr::EMIE_LMOUSE_LEFT_UP;
irr_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
device->postEventFromUser( irr_event );
break;
}
case WM_RBUTTONDOWN:
{
irr_event.MouseInput.X = (short)LOWORD( &m.LParam );
irr_event.MouseInput.Y = (short)HIWORD( &m.LParam );
irr_event.MouseInput.Event = irr::EMIE_RMOUSE_PRESSED_DOWN;
irr_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
device->postEventFromUser( irr_event );
break;
}
case WM_RBUTTONUP:
{
irr_event.MouseInput.X = (short)LOWORD( &m.LParam );
irr_event.MouseInput.Y = (short)HIWORD( &m.LParam );
irr_event.MouseInput.Event = irr::EMIE_RMOUSE_LEFT_UP;
irr_event.EventType = irr::EET_MOUSE_INPUT_EVENT;
device->postEventFromUser( irr_event );
break;
}
}
Form::WndProc( m );
}
Thanks!