feat(glfw): allow to switch backend

This commit is contained in:
2026-08-21 23:17:21 +02:00
parent 519a9b88f4
commit 192cf571b1
6 changed files with 58 additions and 6 deletions
+20 -1
View File
@@ -7,6 +7,8 @@
#include "types.h"
#include "constants.h"
#include "args.h"
#include "config.h"
#include "string.h"
@@ -42,6 +44,10 @@ static void print_help(int status_code) {
"[-mr / -nmr] "
"[-tm] "
"[-tf] "
"[--x11] "
"[--wayland] "
"[--cocoa] "
"[--win32] "
"\n\n"
"Fusion Of Real-time Generative Effects.\n\n"
"options:\n"
@@ -81,7 +87,11 @@ static void print_help(int status_code) {
" -mr, --midi-reconnect auto-reconnect midi (default)\n"
" -nmr, --no-midi-reconnect do not auto-reconnect midi\n"
" -tm, --trace-midi print midi code and values\n"
" -tf, --trace-fps print fps status of subsystems\n");
" -tf, --trace-fps print fps status of subsystems\n"
" --x11 force X11 GLFW backend\n"
" --wayland force Wayland GLFW backend\n"
" --cocoa force Cocoa GLFW backend\n"
" --win32 force Win32 GLFW backend\n");
exit(status_code);
}
@@ -152,6 +162,7 @@ void args_parse(Parameters *params, int argc, char **argv) {
params->midi_reconnect = true;
params->trace_midi = false;
params->trace_fps = false;
params->glfw_backend = GLFW_BACKEND_ANY;
for (int i = 1; i < argc; i++) {
arg = argv[i];
@@ -220,6 +231,14 @@ void args_parse(Parameters *params, int argc, char **argv) {
params->trace_midi = true;
} else if (is_arg(arg, "-tf") || is_arg(arg, "--trace-fps")) {
params->trace_fps = true;
} else if (is_arg(arg, "--x11")) {
params->glfw_backend = GLFW_BACKEND_X11;
} else if (is_arg(arg, "--wayland")) {
params->glfw_backend = GLFW_BACKEND_WAYLAND;
} else if (is_arg(arg, "--cocoa")) {
params->glfw_backend = GLFW_BACKEND_COCOA;
} else if (is_arg(arg, "--win32")) {
params->glfw_backend = GLFW_BACKEND_WIN32;
} else {
#ifdef VIDEO_IN
if (is_arg(arg, "-vi") || is_arg(arg, "--video-in")) {