Skip to content

Commit 4a7b6a5

Browse files
authored
Merge pull request #110 from WinPooh32/window-should-close
add window.SetShouldClose method
2 parents e0d60aa + c3f9ebe commit 4a7b6a5

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

backend.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,8 @@ void igGLFWWindow_GetDisplaySize(GLFWwindow *window, int *width, int *height) {
277277
glfwGetWindowSize(window, width, height);
278278
}
279279

280+
void igGLFWWindow_SetShouldClose(GLFWwindow *window, int value){
281+
glfwSetWindowShouldClose(window, value);
282+
}
283+
280284
#endif

backend.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ func (w GLFWwindow) DisplaySize() (width int32, height int32) {
8989
return
9090
}
9191

92+
func (w GLFWwindow) SetShouldClose(value bool) {
93+
C.igGLFWWindow_SetShouldClose(w.handle(), C.int(castBool(value)))
94+
}
95+
9296
//export glfwWindowLoopCallback
9397
func glfwWindowLoopCallback() {
9498
if loopFunc != nil {

backend.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ extern GLFWwindow *igCreateGLFWWindow(const char *title, int width, int height,
3030
extern void igRunLoop(GLFWwindow *window, VoidCallback loop, VoidCallback beforeRender, VoidCallback afterRender,
3131
VoidCallback beforeDestroyContext);
3232
extern void igGLFWWindow_GetDisplaySize(GLFWwindow *window, int *width, int *height);
33+
extern void igGLFWWindow_SetShouldClose(GLFWwindow *window, int value);
3334
extern void igRefresh();
3435
extern ImTextureID igCreateTexture(unsigned char *pixels, int width, int height);
3536
extern void igDeleteTexture(ImTextureID id);

0 commit comments

Comments
 (0)