~l3kn/quad

30680017a03728b70ab8fdd750ca095173dcf676 — Leon Rische 6 months ago 3f52db3
Always use opaque alpha
1 files changed, 6 insertions(+), 9 deletions(-)

M quad.c
M quad.c => quad.c +6 -9
@@ 44,28 44,25 @@ void saveBMP() {
  /* SDL_FreeSurface(surface); */
}

void setColor(SDL_Renderer* renderer, int color, int alpha) {
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, alpha);
  SDL_SetRenderDrawColor(renderer, r, g, b, SDL_ALPHA_OPAQUE);
}

void renderRule(SDL_Renderer* renderer) {
  setColor(renderer, colors[0], 255);
  setColor(grammarRenderer, colors[0], 255);
  setColor(renderer, colors[0]);
  SDL_RenderClear(renderer);
  setColor(renderer, colors[1], 255);
  setColor(grammarRenderer, colors[1], 255);

  setColor(renderer, colors[1]);
  expandRule(renderer, 0, 0, SIZE, currentRule, rules);
  grammarTexture = SDL_CreateTextureFromSurface(mainRenderer, grammarSurface);
}

void draw() {
  setColor(mainRenderer, colors[0], SDL_ALPHA_OPAQUE);
  setColor(mainRenderer, colors[0]);
  SDL_RenderClear(mainRenderer);
  setColor(mainRenderer, colors[1], SDL_ALPHA_OPAQUE);
  setColor(mainRenderer, colors[1]);

  drawSquare(mainRenderer, CANVAS_X-1, CANVAS_Y-1, SIZE+1, BLACK);
  drawMenu(mainRenderer, PADDING, PADDING, &patterns, &rules);