|
一个win32例子程序.程序里并没有加"ShowCursor(FALSE);",但运行的时候却隐藏了鼠标指针,不明白是在哪里设置了.莫非是创建窗口的时候设置了?请大虾帮忙看看啦.为什么.
// 注册窗口类
bool COGLWindow::RegisterWindow(HINSTANCE hInst)
{
WNDCLASS windowClass; // 窗口类
windowClass.style = 0;
windowClass.lpfnWndProc = WndProcOGL;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInst;
windowClass.hIcon = 0;
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.hbrBackground = NULL;
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = "Engine";
// 注册窗口类
if (!RegisterClass(&windowClass))
return false;
return true;
}
////////
// 构造函数
COGLWindow::COGLWindow(const char *szName, bool fscreen, int w, int h, int b)
{
RECT windowRect;
DWORD dwStyle;
DWORD dwExStyle;
fullscreen = fscreen;
width = w;
height = h;
bits = b;
windowRect.left = (long)0;
windowRect.right = (long)width;
windowRect.top = (long)0;
windowRect.bottom = (long)height;
if (fullscreen)
{
dwExStyle = WS_EX_APPWINDOW;
dwStyle = WS_POPUP;
}
else
{
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW;
}
AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
// 创建窗口
if (fullscreen)
{
BeginFullScreen(width, height, bits);
hWnd = CreateWindowEx(NULL, "Engine", szName, dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, (HINSTANCE)GetModuleHandle(NULL), (void*)this);
}
else
{
hWnd = CreateWindowEx(NULL, "Engine", szName, dwStyle | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
0, 0, width, height, NULL, NULL, (HINSTANCE)GetModuleHandle(NULL),(void*)this);
}
if (hWnd == NULL)
throw "ERROR: Creating OpenGL Window!";
ShowWindow(hWnd, SW_SHOW);
UpdateWindow(hWnd);
mouseSensitivity = 1.0f;
inputSystem = new CInputSystem;
useDInput = inputSystem->Initialize(hWnd, (HINSTANCE)GetModuleHandle(NULL), true, IS_USEKEYBOARD | IS_USEMOUSE);
SetForegroundWindow(hWnd);
SetCapture(hWnd);
SetFocus(hWnd);
if (useDInput)
{
inputSystem->AcquireAll();
inputSystem->Update();
}
ShowCursor(TRUE);
} |
|