about summary refs log tree commit diff
path: root/src/simulator/rendering.h
blob: a899cc26ce3dab3afcf356b0ceda91b1659f7316 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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