From cf886f4fa406ddd48f30c00ad3c77f9dc134af3a Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 24 Jun 2023 18:46:13 -0700 Subject: Add option to set window title. Add function to get mouse position. --- gfx-app/src/gfx_app.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gfx-app/src') 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) { // TODO: Test antialiasing later on. // glfwWindowHint(GLFW_SAMPLES, 4); - g_gfx_app.window = glfwCreateWindow( - desc->width, desc->height, "Gfx Application", NULL, NULL); + const char* title = desc->title ? desc->title : "Gfx Application"; + + g_gfx_app.window = + glfwCreateWindow(desc->width, desc->height, title, NULL, NULL); if (!g_gfx_app.window) { LOGE("glfwCreateWindow() failed"); goto cleanup; @@ -128,3 +130,7 @@ cleanup: glfwTerminate(); return success; } + +void gfx_app_get_mouse_position(double* x, double* y) { + glfwGetCursorPos(g_gfx_app.window, x, y); +} -- cgit v1.2.3