//-------------------------------------------------------------- bool ofxDetectDisplays::placeWindowOnDisplay(int displayID, bool borderless) { #if defined(TARGET_OSX) ofSetFullscreen(false); ofSetWindowPosition(displays[displayID]->left, displays[displayID]->top); ofSetWindowShape(displays[displayID]->width, displays[displayID]->height); #elif defined(TARGET_WIN32) HWND hwnd = ofGetWin32Window(); DWORD EX_STYLE; DWORD STYLE; if (borderless) { EX_STYLE = WS_EX_WINDOWEDGE; STYLE = WS_OVERLAPPED; } else { EX_STYLE = WS_EX_OVERLAPPEDWINDOW; STYLE = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; } SetWindowLong(hwnd, GWL_EXSTYLE, EX_STYLE); SetWindowLong(hwnd, GWL_STYLE, STYLE); SetWindowPos(hwnd, HWND_TOPMOST, displays[displayID]->left, displays[displayID]->top, displays[displayID]->width, displays[displayID]->height, SWP_SHOWWINDOW); #endif return true; }
//-------------------------------------------------------------- void ofApp::setup(){ // add font should before gui.setup() otherwise font will not build ImGuiIO * io = &ImGui::GetIO(); ImFontConfig font_config; font_config.OversampleH = 1; font_config.OversampleV = 1; font_config.PixelSnapH = 1; io->Fonts->AddFontFromFileTTF("data/Deng.ttf", 18.0f, &font_config, io->Fonts->GetGlyphRangesChinese()); gui.setup(); ImGui::GetIO().MouseDrawCursor = false; // For Microsoft IME, pass your HWND to enable IME positioning: io->ImeWindowHandle = ofGetWin32Window(); }
//-------------------------------------------------------------- bool ofxDetectDisplays::fullscreenWindowOnDisplay(int displayID) { #if defined(TARGET_OSX) ofSetFullscreen(true); ofSetWindowShape(displays[displayID]->width, displays[displayID]->height); ofSetWindowPosition(displays[displayID]->left, displays[displayID]->top); #elif defined(TARGET_WIN32) ofSetFullscreen(true); HWND hwnd = ofGetWin32Window(); SetWindowLong(hwnd, GWL_EXSTYLE, 0); SetWindowLong(hwnd, GWL_STYLE, WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); SetWindowPos(hwnd, HWND_TOPMOST, displays[displayID]->left, displays[displayID]->top, displays[displayID]->width, displays[displayID]->height, SWP_SHOWWINDOW); #endif return true; }