Last active
May 17, 2020 04:22
-
-
Save galloscript/1ca2c21ab2b8425bb6aa36c5e0cb4bae to your computer and use it in GitHub Desktop.
Revisions
-
galloscript revised this gist
Apr 13, 2017 . No changes.There are no files selected for viewing
-
galloscript revised this gist
Apr 13, 2017 . 2 changed files with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes.File renamed without changes. -
galloscript created this gist
Apr 12, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ //I'm using the menu bar for dragging //... after creating your menus inside ImGui::BeginMenuBar() //Window dragging from ImGui ImRect menuBarRect = ImRect(0, 0, WINDOW_WIDTH, MENU_BAR_HEIGHT); ImVec2 mouseDelta = ImGui::GetIO().MouseDelta; ImGui::InvisibleButton("##windowdragging", menuBarRect.Max); if(ImGui::IsItemActive() && ImGui::IsMouseDragging(0, 0.0f)) { MPMainWindow::instance->addWindowDeltaPos(mouseDelta.x, mouseDelta.y); //GLFW window dragging int newPosX, newPosY; glfwGetWindowPos(glfwWindowPtr, &newPosX, &newPosY); glfwSetWindowPos(glfwWindowPtr, newPosX + mouseDelta.x, newPosY + mouseDelta.y); //Update mouse previous position ImGui::GetIO().MousePosPrev.x = ImGui::GetIO().MousePos.x - mouseDelta.x; ImGui::GetIO().MousePosPrev.y = ImGui::GetIO().MousePos.y - mouseDelta.y; } //... ImGui::EndMenuBar(); This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ //Get the native window NSWindow* cocoaWindow = glfwGetCocoaWindow(glfwWindowPtr); NSUInteger lWindowStyle = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable | NSWindowStyleMaskUnifiedTitleAndToolbar | NSWindowStyleMaskFullSizeContentView; //Set the style mask [cocoaWindow setStyleMask:lWindowStyle]; cocoaWindow.titlebarAppearsTransparent = YES; cocoaWindow.movableByWindowBackground = YES; //Not really necessary