本文整理汇总了C++中GLWindow::OnMouseMove方法的典型用法代码示例。如果您正苦于以下问题:C++ GLWindow::OnMouseMove方法的具体用法?C++ GLWindow::OnMouseMove怎么用?C++ GLWindow::OnMouseMove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GLWindow
的用法示例。
在下文中一共展示了GLWindow::OnMouseMove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: motion
static void motion( GtkWidget *widget, GdkEventMotion *event, gpointer data ){
GLWindow *wnd = (GLWindow*)data;
guint32 flags = 0;
if ( ( event->state & GDK_BUTTON1_MASK ) != 0 ) {
flags |= MK_LBUTTON;
}
if ( ( event->state & GDK_BUTTON2_MASK ) != 0 ) {
flags |= MK_MBUTTON;
}
if ( ( event->state & GDK_BUTTON3_MASK ) != 0 ) {
flags |= MK_RBUTTON;
}
if ( ( event->state & GDK_CONTROL_MASK ) != 0 ) {
flags |= MK_CONTROL;
}
if ( ( event->state & GDK_SHIFT_MASK ) != 0 ) {
flags |= MK_SHIFT;
}
wnd->OnMouseMove( flags, (int)event->x, (int)event->y );
}
示例2: WindowProc
LRESULT CALLBACK GLWindow::WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
GLWindow* instance = (GLWindow*) GetWindowLongPtr(hwnd, GWL_USERDATA);
switch (msg)
{
case WM_CREATE:
{
CREATESTRUCT* create = (CREATESTRUCT*) lParam;
instance = (GLWindow*) create->lpCreateParams;
SetWindowLongPtr(hwnd, GWL_USERDATA, (LONG_PTR) instance);
return 0;
}
case WM_SIZE:
instance->OnResize(LOWORD(lParam), HIWORD(lParam));
return 0;
case WM_CLOSE:
DestroyWindow(hwnd);
case WM_DESTROY:
PostQuitMessage(0);
return 0;
case WM_KEYDOWN:
instance->OnKeyDown(wParam);
return 0;
case WM_RBUTTONDOWN:
case WM_LBUTTONDOWN:
SetCapture(hwnd);
instance->OnMouseDown(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_RBUTTONUP:
case WM_LBUTTONUP:
ReleaseCapture();
instance->OnMouseUp(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_MOUSEMOVE:
instance->OnMouseMove(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
return 0;
case WM_ERASEBKGND:
return 1;
case WM_PAINT:
if (GetUpdateRect(hwnd, NULL, FALSE))
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
instance->OnRender();
SwapBuffers(hdc);
EndPaint(hwnd, &ps);
}
return 0;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
}