diff options
author | 3gg <3gg@shellblade.net> | 2023-06-24 18:46:13 -0700 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2023-06-24 18:46:13 -0700 |
commit | cf886f4fa406ddd48f30c00ad3c77f9dc134af3a (patch) | |
tree | abd916cf56b264a25257bcaade37caf1fbb974ac /gfx-app/src/gfx_app.c | |
parent | 9522580380393ae9d9b121f335579c5cfa5134f3 (diff) |
Add option to set window title. Add function to get mouse position.
Diffstat (limited to 'gfx-app/src/gfx_app.c')
-rw-r--r-- | gfx-app/src/gfx_app.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gfx-app/src/gfx_app.c b/gfx-app/src/gfx_app.c index 31f8448..2d54e3d 100644 --- a/gfx-app/src/gfx_app.c +++ b/gfx-app/src/gfx_app.c | |||
@@ -95,8 +95,10 @@ bool gfx_app_run(const GfxAppDesc* desc, const GfxAppCallbacks* callbacks) { | |||
95 | // TODO: Test antialiasing later on. | 95 | // TODO: Test antialiasing later on. |
96 | // glfwWindowHint(GLFW_SAMPLES, 4); | 96 | // glfwWindowHint(GLFW_SAMPLES, 4); |
97 | 97 | ||
98 | g_gfx_app.window = glfwCreateWindow( | 98 | const char* title = desc->title ? desc->title : "Gfx Application"; |
99 | desc->width, desc->height, "Gfx Application", NULL, NULL); | 99 | |
100 | g_gfx_app.window = | ||
101 | glfwCreateWindow(desc->width, desc->height, title, NULL, NULL); | ||
100 | if (!g_gfx_app.window) { | 102 | if (!g_gfx_app.window) { |
101 | LOGE("glfwCreateWindow() failed"); | 103 | LOGE("glfwCreateWindow() failed"); |
102 | goto cleanup; | 104 | goto cleanup; |
@@ -128,3 +130,7 @@ cleanup: | |||
128 | glfwTerminate(); | 130 | glfwTerminate(); |
129 | return success; | 131 | return success; |
130 | } | 132 | } |
133 | |||
134 | void gfx_app_get_mouse_position(double* x, double* y) { | ||
135 | glfwGetCursorPos(g_gfx_app.window, x, y); | ||
136 | } | ||