summaryrefslogtreecommitdiff
path: root/lib/graphics.h
diff options
context:
space:
mode:
authordawidg81 <dawidgorski.m@gmail.com>2026-02-13 10:13:59 +0100
committerdawidg81 <dawidgorski.m@gmail.com>2026-02-13 10:13:59 +0100
commitfbc5c101783533f90a3053671de5314c2c6a1c1a (patch)
tree018ac888d94025249c296cd32bfd4ff57376792d /lib/graphics.h
parentc1dbeff8d56b1602d4df80e1e46ac4dbf2dca981 (diff)
Directory cleanup
Diffstat (limited to 'lib/graphics.h')
-rw-r--r--lib/graphics.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/graphics.h b/lib/graphics.h
new file mode 100644
index 0000000..cc0bd63
--- /dev/null
+++ b/lib/graphics.h
@@ -0,0 +1,56 @@
+#ifndef GRAPHICS_H
+#define GRAPHICS_H
+
+#include <cstdint>
+
+// Platform detection
+#if defined(_WIN32) || defined(_WIN64)
+ #define PLATFORM_WINDOWS
+#elif defined(__linux__)
+ #define PLATFORM_LINUX
+#elif defined(__APPLE__)
+ #define PLATFORM_MACOS
+#endif
+
+// Backend selection
+// Define one of these before including this header, or let it auto-detect
+#if !defined(USE_SDL) && !defined(USE_WIN32) && !defined(USE_X11)
+ #ifdef PLATFORM_WINDOWS
+ #define USE_SDL // Default to SDL on Windows for now
+ #elif defined(PLATFORM_LINUX)
+ #define USE_X11
+ #endif
+#endif
+
+// Color structure
+struct Color {
+ uint8_t r, g, b, a;
+
+ Color(uint8_t red = 0, uint8_t green = 0, uint8_t blue = 0, uint8_t alpha = 255)
+ : r(red), g(green), b(blue), a(alpha) {}
+};
+
+// Forward declarations for platform-specific types
+struct WindowHandle;
+
+// Window management functions
+WindowHandle* createWindow(const char* title, int width, int height);
+void destroyWindow(WindowHandle* window);
+bool windowShouldClose(WindowHandle* window);
+void pollEvents(WindowHandle* window);
+void swapBuffers(WindowHandle* window);
+
+// Drawing functions
+void clearScreen(WindowHandle* window, const Color& color);
+void drawLine(WindowHandle* window, int x1, int y1, int x2, int y2, const Color& color);
+void drawRectangle(WindowHandle* window, int x, int y, int width, int height, const Color& color);
+void drawFilledRectangle(WindowHandle* window, int x, int y, int width, int height, const Color& color);
+void drawCircle(WindowHandle* window, int centerX, int centerY, int radius, const Color& color);
+void drawFilledCircle(WindowHandle* window, int centerX, int centerY, int radius, const Color& color);
+void drawPixel(WindowHandle* window, int x, int y, const Color& color);
+
+// Utility functions
+void setDrawColor(WindowHandle* window, const Color& color);
+void delay(uint32_t milliseconds);
+
+#endif // GRAPHICS_H \ No newline at end of file