213 int width = LOWORD(a_lparam);
214 int height = HIWORD(a_lparam);
215 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
217 _this->resize(width,height);
223 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
224 if(_this) _this->wm_paint();
228 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
230 if(_this->m_interactor) {
232 _this->m_interactor->key_press(event);
237 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
239 if(_this->m_interactor) {
241 _this->m_interactor->key_release(event);
246 case WM_LBUTTONDOWN:{
247 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
249 if(_this->m_interactor) {
251 _this->m_interactor->mouse_press(event);
254 ::GetClientRect(a_hwnd,&rect);
255 unsigned int h = rect.bottom-rect.top;
256 if(!_this->is_touch_event()) _this->left_button_down(LOWORD(a_lparam),h-HIWORD(a_lparam));
261 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
263 if(_this->m_interactor) {
265 _this->m_interactor->mouse_release(event);
268 ::GetClientRect(a_hwnd,&rect);
269 unsigned int h = rect.bottom-rect.top;
270 if(!_this->is_touch_event()) _this->left_button_up(LOWORD(a_lparam),h-HIWORD(a_lparam));
275 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
277 if(_this->m_interactor) {
279 _this->m_interactor->mouse_move(event);
281 WPARAM state = a_wparam;
282 bool ldown = ((state & MK_LBUTTON)==MK_LBUTTON)?
true:
false;
284 ::GetClientRect(a_hwnd,&rect);
285 unsigned int h = rect.bottom-rect.top;
286 if(!_this->is_touch_event()) _this->mouse_move(LOWORD(a_lparam),h-HIWORD(a_lparam),ldown);
293 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
295 if(_this->m_interactor) {
297 _this->m_interactor->wheel_rotate(event);
302 #ifdef TOOLS_WINDOWS_TOUCH
304 glarea* _this = (
glarea*)::GetWindowLongPtr(a_hwnd,GWLP_USERDATA);
305 if(_this && _this->m_touch_available) {
308 ::GetClientRect(a_hwnd,&rect);
309 unsigned int h = rect.bottom-rect.top;
311 unsigned int num_inputs = (int)a_wparam;
313 TOUCHINPUT* ti =
new TOUCHINPUT[num_inputs];
315 if(::GetTouchInputInfo((HTOUCHINPUT)a_lparam,num_inputs,ti,
sizeof(TOUCHINPUT))) {
316 for(
unsigned int i=0;i<num_inputs; ++i) {
317 p.x = TOUCH_COORD_TO_PIXEL(ti[i].x);
318 p.y = TOUCH_COORD_TO_PIXEL(ti[i].y);
319 if(!::ScreenToClient(a_hwnd,&p)) {}
320 if(ti[i].dwFlags & TOUCHEVENTF_DOWN) {
322 _this->left_button_down(p.x,h-p.y);
323 }
else if (ti[i].dwFlags & TOUCHEVENTF_UP) {
325 _this->left_button_up(p.x,h-p.y);
326 }
else if (ti[i].dwFlags & TOUCHEVENTF_MOVE) {
329 _this->mouse_move(p.x,h-p.y,ldown);
333 ::CloseTouchInputHandle((HTOUCHINPUT)a_lparam);
337 #endif //TOOLS_WINDOWS_TOUCH
340 return (DefWindowProc(a_hwnd,a_msg,a_wparam,a_lparam));