红色部分就是原来的全屏代码,只是一个去框的窗口... ( 绿色是我用来修正目前全屏后不在当前显示器的代码 PS. Bug已提交应该很快就会修复了)
void ofAppGLFWWindow::setFullscreen(bool fullscreen){
#elif defined(TARGET_WIN32)
if( windowMode == OF_FULLSCREEN){
//----------------------------------------------------
HWND hwnd = glfwGetWin32Window(windowP);
SetWindowLong(hwnd, GWL_EXSTYLE, 0);
SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED | SWP_SHOWWINDOW);
int xpos;
int ypos;
int monitorCount;
GLFWmonitor** monitors = glfwGetMonitors(&monitorCount);
glfwGetMonitorPos(monitors[getCurrentMonitor()], &xpos, &ypos);
SetWindowPos(hwnd, HWND_TOPMOST, xpos, ypos, fullscreenW, fullscreenH, SWP_SHOWWINDOW);
}
}
不使用glfw自身的全屏代码估计是因为需要重新创建窗口才能设置全屏,详见 glfw 的文档