about summary refs log tree commit diff
path: root/src/simulator/rendering.h
diff options
context:
space:
mode:
authorvenomade <venomade@venomade.com>2025-02-27 17:25:46 +0000
committervenomade <venomade@venomade.com>2025-02-27 17:25:46 +0000
commit259c727658485ea00d6ef8617ecab579be871470 (patch)
tree5f548781584cf942b0c8a9101eed124da902c9ce /src/simulator/rendering.h
Initial Commit
Diffstat (limited to 'src/simulator/rendering.h')
-rw-r--r--src/simulator/rendering.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/simulator/rendering.h b/src/simulator/rendering.h
new file mode 100644
index 0000000..a899cc2
--- /dev/null
+++ b/src/simulator/rendering.h
@@ -0,0 +1,36 @@
+#ifndef RENDERING_H
+#define RENDERING_H
+
+#include <SDL2/SDL.h>
+#include "../game.h"
+
+#define SCREEN_WIDTH 600
+#define SCREEN_HEIGHT 600
+
+#define CELL_WIDTH ((float) SCREEN_WIDTH / (float) BOARD_WIDTH)
+#define CELL_HEIGHT ((float) SCREEN_HEIGHT / (float) BOARD_HEIGHT)
+
+#define BACKGROUND_COLOR  0x190A0FFF
+#define GRID_COLOR        0xEBCBF4FF
+#define WALL_COLOR        (GRID_COLOR)
+#define AGENT_COLOR_ALIVE 0x8447FFFF
+// #define AGENT_COLOR_DEAD  0x392A2FFF
+#define AGENT_COLOR_DEAD  (BACKGROUND_COLOR)
+#define FOOD_COLOR        0xE1F0C4FF
+
+
+#define HEX_COLOR(hex)                          \
+  ((hex) >> (3 * 8)) & 0xFF,                    \
+  ((hex) >> (2 * 8)) & 0xFF,                    \
+  ((hex) >> (1 * 8)) & 0xFF,                    \
+  ((hex) >> (0 * 8)) & 0xFF
+
+int scc(int code);
+
+void *scp(void *ptr);
+
+void render_board_grid(SDL_Renderer *renderer);
+
+void render_game(SDL_Renderer *renderer, const Game *game);
+
+#endif