summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authoryuzu-eva <cafebabe@disroot.org>2025-04-23 11:21:04 +0200
committeryuzu-eva <cafebabe@disroot.org>2025-04-23 11:21:04 +0200
commita029d434b3f67c37bb4663be8e9b4d6623a32955 (patch)
tree44872c7797ff3b2b27a53ead3f9ca4ce80b5b30c /src/main.c
parent083dc7097143385e55ca14372194da7e05fb8c19 (diff)
restructure project
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/src/main.c b/src/main.c
deleted file mode 100644
index 952dd45..0000000
--- a/src/main.c
+++ /dev/null
@@ -1,86 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <string.h>
-#include <assert.h>
-#include <raylib.h>
-#include <complex.h>
-#include <math.h>
-
-#include <dlfcn.h>
-
-#include "plug.h"
-
-#define ARRAY_LEN(xs) sizeof(xs)/sizeof(xs[0])
-
-const char *libplug_file_name = "libplug.so";
-void *libplug = NULL;
-
-#ifdef HOTRELOAD
-#define PLUG(name, ...) name##_t *name = NULL;
-#else
-#define PLUG(name, ...) name##_t name;
-#endif
-LIST_OF_PLUGS
-#undef PLUG
-
-#ifdef HOTRELOAD
-bool reload_plugin(void)
-{
-
- if (libplug != NULL) dlclose(libplug);
-
- libplug = dlopen(libplug_file_name, RTLD_NOW);
- if (libplug == NULL) {
- fprintf(stderr, "ERROR: could not load %s: %s", libplug_file_name, dlerror());
- return false;
- }
-
- #define PLUG(name, ...) \
- name = dlsym(libplug, #name); \
- if (name == NULL) { \
- fprintf(stderr, "ERROR: could not find %s symbol in %s: %s", \
- #name, libplug_file_name, dlerror()); \
- return false; \
- }
- LIST_OF_PLUGS
- #undef PLUG
-
- return true;
-}
-#else
-#define reload_plugin() true
-#endif
-
-int main(void)
-{
- if (!reload_plugin()) return 1;
-
- size_t factor = 60;
- SetConfigFlags(FLAG_WINDOW_RESIZABLE);
-
- InitWindow(factor*16, factor*9, "MVis");
- SetTargetFPS(60);
- InitAudioDevice();
-
- plug_init();
-
- while (!WindowShouldClose()) {
- if (IsKeyPressed(KEY_O)) {
- void *state = plug_pre_reload();
- if (!reload_plugin()) return 1;
- plug_post_reload(state);
- }
-
- if (IsKeyPressed(KEY_X)) {
- break;
- }
-
- plug_update();
- }
-
- CloseAudioDevice();
- CloseWindow();
-
- return 0;
-}