summaryrefslogtreecommitdiff
path: root/include/quartz.h
diff options
context:
space:
mode:
authoruint <abhinav.prsai@gmail.com>2025-11-29 16:25:19 +0000
committeruint <abhinav.prsai@gmail.com>2025-11-29 16:27:23 +0000
commit87d9f9a48463814acc752df72fdcd423f1937327 (patch)
treed5574adc87590ffd4f85c90bc748473e7a6bda52 /include/quartz.h
parent5d5f1c0ad39481cd11960c0f25c1d7c5318fef6d (diff)
rename to quartz because suckless took quark >:(
.
Diffstat (limited to 'include/quartz.h')
-rw-r--r--include/quartz.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/include/quartz.h b/include/quartz.h
new file mode 100644
index 0000000..7c1c92d
--- /dev/null
+++ b/include/quartz.h
@@ -0,0 +1,46 @@
+#pragma once
+
+#include <stdbool.h>
+#include <stdio.h>
+
+#include <SDL2/SDL.h>
+
+/* types */
+typedef struct {
+ SDL_Window* win;
+ SDL_GLContext gl;
+ int win_w;
+ int win_h;
+ bool running;
+} quartz_t;
+
+/* logging */
+#define ANSI_RESET "\x1b[0m"
+#define ANSI_FG_WHITE "\x1b[37m"
+#define ANSI_BG_CYAN "\x1b[46m"
+#define ANSI_BG_MAGENTA "\x1b[45m"
+#define ANSI_BG_RED "\x1b[41m"
+#define ANSI_BG_GREEN "\x1b[42m"
+#define ANSI_BG_YELLOW "\x1b[43m"
+
+#define LOG(fmt, ...) \
+ fprintf(stdout, fmt "\n", ##__VA_ARGS__)
+
+#define LOG_INFO(fmt, ...) \
+ fprintf(stdout, ANSI_FG_WHITE ANSI_BG_CYAN " INFO " ANSI_RESET " " fmt "\n", ##__VA_ARGS__)
+
+#define LOG_PASS(fmt, ...) \
+ fprintf(stdout, ANSI_FG_WHITE ANSI_BG_GREEN " PASS " ANSI_RESET " " fmt " (%s:%d)\n", ##__VA_ARGS__, __FILE__, __LINE__)
+
+#define LOG_WARN(fmt, ...) \
+ fprintf(stderr, ANSI_FG_WHITE ANSI_BG_YELLOW " WARN " ANSI_RESET " " fmt "\n", ##__VA_ARGS__)
+
+#define LOG_ERROR(fmt, ...) \
+ fprintf(stderr, ANSI_FG_WHITE ANSI_BG_RED " ERROR " ANSI_RESET " " fmt " (%s:%d)\n", ##__VA_ARGS__, __FILE__, __LINE__)
+
+#ifdef DEBUG
+#define LOG_DEBUG(fmt, ...) \
+ fprintf(stdout, ANSI_FG_WHITE ANSI_BG_MAGENTA " DEBUG " ANSI_RESET " " fmt "\n", ##__VA_ARGS__)
+#else
+#define LOG_DEBUG(fmt, ...) ((void)0)
+#endif