diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2025-02-23 22:22:02 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2025-02-23 22:22:02 -0500 |
| commit | bdc6e6af796440f06b37f204aedc40d9220f975d (patch) | |
| tree | 48ea650a343fd97b8c4ff14f0d6294a89eed9c18 /renderer.c | |
| parent | edfe8f1452115a94b2371daf7c150f7a6ac2a2f0 (diff) | |
| download | volute-bdc6e6af796440f06b37f204aedc40d9220f975d.zip | |
set window title
Diffstat (limited to 'renderer.c')
| -rw-r--r-- | renderer.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -12,6 +12,7 @@ enum window { WIDTH = 640, HEIGHT = 480, WINFLAGS = SDL_WINDOW_RESIZABLE, + RENDERFLAGS = 0, }; static const char FONT[] = "font/charter-regular.ttf"; @@ -52,12 +53,21 @@ static SDL_Renderer *renderer = NULL; /* Initialize the window and renderer. Returns non-zero on error. */ int -r_init(mu_Context *ctx) { +r_init(mu_Context *ctx, const char *title) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "%s\n", SDL_GetError()); return 1; } - if (SDL_CreateWindowAndRenderer(WIDTH, HEIGHT, WINFLAGS, &window, &renderer) != 0) { + window = SDL_CreateWindow(title, + SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, + WIDTH, HEIGHT, + WINFLAGS); + if (!window) { + fprintf(stderr, "%s\n", SDL_GetError()); + return 1; + } + renderer = SDL_CreateRenderer(window, -1, RENDERFLAGS); + if (!renderer) { fprintf(stderr, "%s\n", SDL_GetError()); return 1; } |