~l3kn/quad

ccf407b5722e160250d9767026ca5b5b4de49069 — Leon Rische 6 months ago 46b7fdd
Use same outline for all squares
1 files changed, 8 insertions(+), 8 deletions(-)

M quad.c
M quad.c => quad.c +8 -8
@@ 55,7 55,7 @@ bool quit = false;
bool zooming = false;
int limit = 1;

void drawSquare(SDL_Renderer* renderer, int x, int y, int s, unsigned long long pattern, int outline) {
void drawSquare(SDL_Renderer* renderer, int x, int y, int s, unsigned long long pattern) {
    SDL_Rect rect;
    rect.x = x;
    rect.y = y;


@@ 86,7 86,7 @@ void expandNode(SDL_Renderer* renderer, int x, int y, int s, Node node) {
  if (node.type == RULE) {
    expandRule(renderer, x, y, s, &rules[node.index]);
  } else if (node.type == PATTERN) {
    drawSquare(renderer, x, y, s, patterns[node.index], outline);
    drawSquare(renderer, x, y, s, patterns[node.index]);
  }
}



@@ 116,7 116,7 @@ void saveBMP() {
void drawNumber(int x, int y, int n) {
  int h = menu_size / 2;
  int o = menu_size / 8;
  Pattern pattern = (n >= 4) ? WHITE : BLACK;
  Pattern pattern = (n >= 4) ? BLACK : WHITE;

  if (n & 2) {
    y += h;


@@ 125,15 125,15 @@ void drawNumber(int x, int y, int n) {
    x += h;
  }

  drawSquare(mainRenderer, x + o, y + o, h / 2, pattern, outline);
  drawSquare(mainRenderer, x + o, y + o, h / 2, pattern);
}

void drawNode(int x, int y, Node node) {
  if (node.type == RULE) {
    drawSquare(mainRenderer, x, y, menu_size, BLACK, 1);
    drawSquare(mainRenderer, x, y, menu_size, BLACK);
    drawNumber(x, y, node.index);
  } else {
    drawSquare(mainRenderer, x, y, menu_size, patterns[node.index], 1);
    drawSquare(mainRenderer, x, y, menu_size, patterns[node.index]);
  }
}



@@ 154,7 154,7 @@ void drawMenu() {
    int x = i * menu_size + PADDING;
    for (int j = 0; j < 4; j ++) {
      int y = j * menu_size + PADDING;
      drawSquare(mainRenderer, x, y, menu_size, patterns[i + 10 * j], 1);
      drawSquare(mainRenderer, x, y, menu_size, patterns[i + 10 * j]);
    }
  }



@@ 188,7 188,7 @@ void draw() {
  setColor(mainRenderer, colors[1], SDL_ALPHA_OPAQUE);

  drawMenu();
  drawSquare(mainRenderer, CANVAS_X-1, CANVAS_Y-1, size+1, BLACK, 1);
  drawSquare(mainRenderer, CANVAS_X-1, CANVAS_Y-1, size+1, BLACK);

  SDL_Rect src, target;
  src.x = 0;