ref: 294415147cb9435c37d449deee66da67bac104d1
parent: 2142ef34fad15e2ee446219b4396c7198cc7183f
author: laamaa <jonne.kokkonen@gmail.com>
date: Sat Sep 6 15:20:40 EDT 2025
add application version metadata, small cleanups
--- a/src/main.c
+++ b/src/main.c
@@ -5,6 +5,8 @@
CFLAGS=-DDEBUG_MSG` */
// #define DEBUG_MSG
+#define APP_VERSION "v2.1.1"
+
#include <SDL3/SDL.h>
#define SDL_MAIN_USE_CALLBACKS
#include <SDL3/SDL_main.h>
@@ -153,6 +155,8 @@
// Initialize the app: initialize context, configs, renderer controllers and attempt to find M8
SDL_AppResult SDL_AppInit(void **appstate, int argc, char **argv) {+ SDL_SetAppMetadata("M8C",APP_VERSION,"fi.laamaa.m8c");+
char *config_filename = NULL;
// Initialize in-app log capture/overlay
--- a/src/render.c
+++ b/src/render.c
@@ -111,7 +111,7 @@
const int new_hd_texture_height = texture_height * scale_factor;
if (hd_texture != NULL && new_hd_texture_width == hd_texture_width &&
new_hd_texture_height == hd_texture_height) {- // Texture exists and there is no change in the size, carry on
+ // Texture exists, and there is no change in the size, carry on
SDL_LogDebug(SDL_LOG_CATEGORY_RENDER, "HD texture size not changed, skipping");
return;
}
@@ -151,7 +151,7 @@
// Append a formatted line to the circular log buffer
static void log_buffer_append_line(const char *line) {- if (line == NULL || line[0] == '\0') {+ if (line[0] == '\0') {return;
}
const int index = (log_line_start + log_line_count) % LOG_BUFFER_MAX_LINES;
@@ -196,7 +196,7 @@
log_overlay_needs_redraw = 1;
}
-// Render the log buffer into a texture for overlay display
+// Render the log buffer into a texture for the overlay display
static void render_log_overlay_texture(void) { if (!log_overlay_visible) {return;
@@ -225,7 +225,7 @@
SDL_SetRenderDrawColor(rend, 0, 0, 0, 220);
SDL_RenderClear(rend);
- // Use small font to fit more lines
+ // Use a small font to fit more lines
const int prev_font_mode = font_mode;
inline_font_close();
inline_font_initialize(fonts[0]);
@@ -236,9 +236,6 @@
const int usable_width = texture_width - (margin_x * 2);
const int cols = SDL_max(1, usable_width / (fonts[0]->glyph_x + 1));
- const Uint32 fg = 0xFFFFFF; // light grey
- const Uint32 bg = 0xFFFFFF; // inprint translates same bg as fg to transparent
-
// Compute how many text rows fit
const int max_rows = (texture_height - margin_y * 2) / line_height;
int rows_needed = max_rows;
@@ -279,7 +276,9 @@
const char *s = log_lines[cur];
const size_t len = SDL_strlen(s);
for (size_t pos = offset; pos < len && y < texture_height;) {- size_t remaining = len - pos;
+ const Uint32 bg = 0xFFFFFF;
+ const Uint32 fg = 0xFFFFFF;
+ const size_t remaining = len - pos;
size_t take = (size_t)cols < remaining ? (size_t)cols : remaining;
char buf[LOG_LINE_MAX_CHARS];
if (take >= sizeof(buf)) {@@ -558,7 +557,7 @@
return 0;
}
- if (!SDL_CreateWindowAndRenderer("m8c", texture_width * 2, texture_height * 2,+ if (!SDL_CreateWindowAndRenderer("M8C", texture_width * 2, texture_height * 2,SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY |
SDL_WINDOW_OPENGL | conf->init_fullscreen,
&win, &rend)) {--
⑨