~l3kn/quad

d8d7b088ef2b8124f5045d761f04b89a955c6836 — Leon Rische 4 months ago ee6ecd6
Improve texture alignment
2 files changed, 3 insertions(+), 4 deletions(-)

M README.md
M quad.c
M README.md => README.md +2 -2
@@ 9,8 9,8 @@ Depends on the `sdl2-dev` package.
Build with `make`, run with `./quad`.

The default size is 1024 pixels, optimized for 1080x1920px screens.
To use another size (ideally a power of two) run e.g `./quad 512` or
`./quad 2048`.
To use another size (ideally a power of two or a number 2^n * m where m is
small) run e.g `./quad 512` or `./quad 2048`.

Run with `make run`.


M quad.c => quad.c +1 -2
@@ 56,8 56,7 @@ void drawSquare(int x, int y, int s, unsigned long long pattern, int outline) {
  unsigned long long index;
  for (px = x; px < x + s; px++) {
    for (py = y; py < y + s; py++) {
      index = (((py - PADDING) / SCALE) % 8) * 8 + \
        (((px - PADDING) / SCALE) % 8);
      index = (((px - CANVAS_X) / SCALE) % 8) * 8 + (((py - CANVAS_Y) / SCALE) % 8);
      if ((pattern & (1UL << index)) > 0) {
        SDL_RenderDrawPoint(renderer, px, py);
      }