Syncing nuklear form's position with GLFW's window position ? #658
Comments
Hey @malvinro, What I would propose is to use the OS window header and a headerless nuklear window. The problem with using nuklear for OS window movement is that the OS renderer is always faster than nuklear in drawing (The kernel has more information). So while possible to do what you want it causes glitches. So the best cause of action would be to use the OS window decoration for maximum smoothness for movement.
Nuklear does not close the window. It only marks it as closed to be polled if closed. So you have to detect in your code that it was closed and not call the window anymore. This can be easily implemented by having a boolean check: static int win_unresolved_visible = true;
if (win_unresolved_visible) {
if (nk_begin(..., "unresolved",....)) {
/* ... */
}
nk_end(...);
}
win_unresolved_visible = nk_window_is_closed(ctx, "unresolved") ? false : true; or if you want to close the application something like this: if (nk_begin(..., "unresolved",....)) {
/* ... */
}
nk_end(...);
if (nk_window_is_closed(ctx, "unresolved")) {
exit(1);
} EDIT: if (nk_begin(..., "unresolved", ....)) {
nk_window_set_size(ctx, "unresolved", nk_vec2(glfw.width, glfw.height));
}
nk_end(...); |
This is happening, can't get it closed. |
Oops you are correct it should be: if (nk_window_is_hidden(ctx, "unresolved"))
exit(1); The 'x' only hides the specified window. While |
Found out how to make it movable, if someone wants to do it too simply create a variable (mine's a point named distFromWinToMouse) then insert this into your while function. if ((GetKeyState(VK_LBUTTON) & 0x100) != 0) {
POINT p;
int curX, curY;
if (GetCursorPos(&p)){
glfwGetWindowPos(win, &curX, &curY);
if (iMPressed && p.x < curX + WINDOW_WIDTH + 500 && p.x > curX - 500 && p.y < curY + ctx->active->layout->header_height + 500 && p.y > curY - 500)
glfwSetWindowPos(win, p.x - distFromWinToMouse.x, p.y - distFromWinToMouse.y);
else {
if (p.x < curX + WINDOW_WIDTH && p.x > curX &&
p.y < curY + ctx->active->layout->header_height && p.y > curY) {
distFromWinToMouse.x = p.x - curX;
distFromWinToMouse.y = p.y - curY;
glfwSetWindowPos(win, p.x - distFromWinToMouse.x, p.y - distFromWinToMouse.y);
iMPressed = true;
}
}
}
} Now i just want to change the icon from the taskbar, when i click right my program. |
I think I am a little lost at this point. Can this issue be marked fixed? |
The icon question is out of the Nuklear scope. But I would start e.g. with https://msdn.microsoft.com/en-us/library/windows/desktop/ms648051(v=vs.85).aspx or similar (just google it - this was right the second match I got). |
Hey, i want to make a window that is borderless(From GLFW) and i want to make it movable.
It looks like this:
I want to make it movable so i tried to override the nuklear.h code but didn't worked. Can you help me with this ?
The Nuklear Form' width and height are the same as GLFW's.
EDIT: i want to handle the X button, the window is closing but instantly reopens when i press the button, dont rlly know how to work with it, can you help me with this too ?
The text was updated successfully, but these errors were encountered: