tuxanci2-engine
Game engine for tuxanci2
Log | Files | Refs | README | LICENSE
commit e03d013c9b6888ab816f01a83f3fa4dc47b5616e
parent f498ad6945a0c1338c64716eeea075a2ef054d37
Author: Connor Thomson <connor@gnufault.org>
Date: Sun, 18 Oct 2026 16:34:59 -0700
Add window titles
Diffstat:
8 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/include/ta_api.h b/include/ta_api.h
@@ -9,6 +9,7 @@ extern "C" {
#include "ta_types.h"
#include "ta_fb.h"
#include "ta_keyboard.h"
+#include "ta_title.h"
// Must be called before ta_update()
void ta_main_init(void);
diff --git a/include/ta_title.h b/include/ta_title.h
@@ -0,0 +1,6 @@
+#ifndef TA_TITLE_H
+#define TA_TITLE_H
+
+extern const char *ta_title;
+
+#endif // TA_TITLE_H
diff --git a/platforms/sdl2/sdl2.c b/platforms/sdl2/sdl2.c
@@ -75,7 +75,7 @@ int main(void) {
ta_main_init();
- SDL_Window *window = SDL_CreateWindow("", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
+ SDL_Window *window = SDL_CreateWindow(ta_title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WINDOW_WIDTH, WINDOW_HEIGHT, SDL_WINDOW_SHOWN);
if (!window) {
SDL_Quit();
return 1;
@@ -106,6 +106,7 @@ int main(void) {
}
ta_main_update();
+ SDL_SetWindowTitle(window, ta_title);
SDL_UpdateTexture(texture, NULL, ta_fb.buffers[0], WINDOW_WIDTH * sizeof(Uint32));
SDL_RenderClear(renderer);
diff --git a/platforms/sdl3/sdl3.c b/platforms/sdl3/sdl3.c
@@ -75,7 +75,7 @@ int main(void) {
ta_main_init();
- SDL_Window *window = SDL_CreateWindow("", WINDOW_WIDTH, WINDOW_HEIGHT, 0);
+ SDL_Window *window = SDL_CreateWindow(ta_title, WINDOW_WIDTH, WINDOW_HEIGHT, 0);
if (!window) {
SDL_Quit();
return 1;
@@ -114,6 +114,7 @@ int main(void) {
}
ta_main_update();
+ SDL_SetWindowTitle(window, ta_title);
SDL_UpdateTexture(texture, NULL, ta_fb.buffers[0], WINDOW_WIDTH * sizeof(Uint32));
SDL_RenderClear(renderer);
diff --git a/platforms/wayland/wayland.c b/platforms/wayland/wayland.c
@@ -511,7 +511,7 @@ int main(void) {
xdg_surface_add_listener(state.xdg_surface, &xdg_surface_listener, &state);
state.toplevel = xdg_surface_get_toplevel(state.xdg_surface);
xdg_toplevel_add_listener(state.toplevel, &toplevel_listener, &state);
- xdg_toplevel_set_title(state.toplevel, "Tuxanci2");
+ xdg_toplevel_set_title(state.toplevel, ta_title);
xdg_toplevel_set_app_id(state.toplevel, "tuxanci2");
xdg_toplevel_set_min_size(state.toplevel, WINDOW_WIDTH, WINDOW_HEIGHT);
xdg_toplevel_set_max_size(state.toplevel, WINDOW_WIDTH, WINDOW_HEIGHT);
@@ -535,6 +535,7 @@ int main(void) {
state.frame_ready = 0;
state.buffer_released = 0;
ta_main_update();
+ xdg_toplevel_set_title(state.toplevel, ta_title);
memcpy(state.pixels, ta_fb.buffers[0], state.buffer_size);
state.frame_callback = wl_surface_frame(state.surface);
diff --git a/platforms/win32/win32.c b/platforms/win32/win32.c
@@ -138,7 +138,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
RECT wr = {0, 0, WINDOW_WIDTH, WINDOW_HEIGHT};
AdjustWindowRect(&wr, window_style, FALSE);
- window_handle = CreateWindowEx(0, CLASS_NAME, "", window_style, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, hInstance, NULL);
+ window_handle = CreateWindowEx(0, CLASS_NAME, ta_title, window_style, CW_USEDEFAULT, CW_USEDEFAULT, wr.right - wr.left, wr.bottom - wr.top, NULL, NULL, hInstance, NULL);
if (!window_handle) {
return 1;
@@ -182,6 +182,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
ta_main_update();
+ SetWindowText(window_handle, ta_title);
StretchDIBits(hdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, ta_fb.buffers[0], &bmi, DIB_RGB_COLORS, SRCCOPY);
diff --git a/platforms/x11/x11.c b/platforms/x11/x11.c
@@ -133,6 +133,7 @@ int main(void) {
ta_main_init();
Window win = XCreateSimpleWindow(display, root, 0, 0, ta_fb.width, ta_fb.height, 0, BlackPixel(display, screen), WhitePixel(display, screen));
+ XStoreName(display, win, ta_title);
XSizeHints *hints = XAllocSizeHints();
if (hints) {
@@ -171,6 +172,7 @@ int main(void) {
}
ta_main_update();
+ XStoreName(display, win, ta_title);
ximage->data = (char *)ta_fb.buffers[0];
XPutImage(display, win, gc, ximage, 0, 0, 0, 0, ta_fb.width, ta_fb.height);
diff --git a/src/ta_title.c b/src/ta_title.c
@@ -0,0 +1 @@
+const char *ta_title = "Tuxánci 2";