~l3kn/quad

ref: bw-only quad/quad.h -rw-r--r-- 529 bytes
feeba87e — Leon Rische Print screen size 6 months ago
                                                                                
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
typedef bool Pattern;
const Pattern BLACK = false;
const Pattern WHITE = true;
Pattern patterns[] = { BLACK, WHITE };

int colors[2] = { COLOR_BLACK, COLOR_WHITE };

void setColor(SDL_Renderer* renderer, int color) {
  int r = color >> 16;
  int g = (color >> 8) & 255;
  int b = color & 255;
  SDL_SetRenderDrawColor(renderer, r, g, b, SDL_ALPHA_OPAQUE);
}

typedef enum {
  RULE, PATTERN,
} nodeType;

typedef struct node {
  nodeType type;
  int index;
} Node;

typedef struct rule {
  Node quads[4];
  Node fallback;
} Rule;