diff options
| author | Raven <citrons@mondecitronne.com> | 2026-11-27 04:01:15 -0600 |
|---|---|---|
| committer | Raven <citrons@mondecitronne.com> | 2026-11-27 04:01:15 -0600 |
| commit | d3b5ea00a47f1eda20d86129a4569ed75bbf7094 (patch) | |
| tree | 9eca8c29a67dbe4c3829ddc93c0090d79c1984fd /src/main.c | |
| parent | fd3c5a06a73345d7b486017a434041efc1c22341 (diff) | |
grid
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -396,6 +396,31 @@ static void show_pages() { free_unused_pages(&pages); } +static void show_grid() { + double s = get_scale(); + double offs_x = (SDL_floor(pos_x) - pos_x) * s; + double offs_y = (SDL_floor(pos_y) - pos_y) * s; + for (int i = 0; i < window_height / s; i++) { + if (((int)pos_y + i) % sizeof(long) == 0) { + SDL_SetRenderDrawColor(renderer, 80, 80, 80, 255); + } else { + SDL_SetRenderDrawColor(renderer, 50, 50, 50, 255); + } + double y = offs_y + s*i; + SDL_RenderLine(renderer, 0, y, window_width, y); + } + for (int i = 0; i < window_width / s; i++) { + if (((int)pos_x + i) % sizeof(long) == 0) { + SDL_SetRenderDrawColor(renderer, 128, 128, 128, 255); + } else { + SDL_SetRenderDrawColor(renderer, 50, 50, 50, 255); + } + double x = offs_x + s*i; + SDL_RenderLine(renderer, x, 0, x, window_height); + } + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); +} + static SDL_Texture *missing_texture() { static SDL_Texture *tex = NULL; if (!tex) { @@ -423,6 +448,7 @@ static void show() { SDL_GetWindowSize(window, &window_width, &window_height); SDL_RenderClear(renderer); show_pages(); + if (scale >= 4) show_grid(); SDL_RenderPresent(renderer); if (current_menu) { menu_render(current_menu); |
