~l3kn/quad

652e49aa56fc0e578f2db1dcb4a43d615791b037 — Leon Rische 6 months ago 1002ec9
Disable zooming
1 files changed, 0 insertions(+), 36 deletions(-)

M quad.c
M quad.c => quad.c +0 -36
@@ 17,8 17,6 @@ SDL_Renderer* mainRenderer = NULL;
SDL_Surface* grammarSurface = NULL;
SDL_Renderer* grammarRenderer = NULL;
SDL_Texture* grammarTexture = NULL;

double zoomFactor = 1.0;
int currentRule = 0;
int currentQuad = 0;



@@ 26,7 24,6 @@ Node selection;
Rule rules[NRULES];

bool quit = false;
bool zooming = false;

bool selector = false;
int selectorX = PADDING;


@@ 92,34 89,13 @@ void reset() {
  draw();
}

void zoom() {
  zoomFactor *= powf(2, 1.0 / 128);
  if (zoomFactor >= 2) {
    zoomFactor = 1.0;
    Node* quad = &rules[currentRule].quads[0];
    if (quad->type == RULE) {
      currentRule = quad->index;
    }
  }
  draw();
}

void invertColors() {
  int tmp = colors[0];
  colors[0] = colors[1];
  colors[1] = tmp;
  renderRule(grammarRenderer);
  draw();
}

void toggleZooming() {
  if (zooming) {
    zooming = false;
    zoomFactor = 1.0;
  } else {
    zooming = true;
  }
  draw();
}

void toggleOutline() {


@@ 169,9 145,6 @@ void handleKey(SDL_Event* event) {
  case SDLK_v:
    invertColors();
    break;
  case SDLK_z:
    toggleZooming();
    break;
  case SDLK_d:
    decreaseLimit();
    break;


@@ 295,7 268,6 @@ int main(int argc, char* argv[]) {
  reset();
  draw();

  int tick = 0;
  while (!quit) {
    SDL_Event event;



@@ 317,14 289,6 @@ int main(int argc, char* argv[]) {
      }
    }

    if (zooming) {
      tick += 1;
      if (tick == 1) {
        zoom();
        tick = 0;
      }
    }

    // Render at 60 fps
    SDL_Delay(1000 / 60);
  }