2026-07-30 01:10:31 -04:00
|
|
|
/**
|
|
|
|
|
* @file draw.c
|
|
|
|
|
* @brief Implements the draw subsystem.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-08-03 10:07:35 -04:00
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
|
#include <SDL3_image/SDL_image.h>
|
|
|
|
|
#include <SDL3_mixer/SDL_mixer.h>
|
2026-05-07 22:20:10 -04:00
|
|
|
#include <akgl/game.h>
|
2025-08-03 10:07:35 -04:00
|
|
|
|
|
|
|
|
/* Draw a Gimpish background pattern to show transparency in the image */
|
2026-05-06 23:18:42 -04:00
|
|
|
void akgl_draw_background(int w, int h)
|
2025-08-03 10:07:35 -04:00
|
|
|
{
|
|
|
|
|
SDL_Color col[2] = {
|
Reindent all C sources to the canonical stroustrup style
Mechanical whitespace-only change across src/, include/, tests/, and
util/, applied with scripts/reindent.sh. No behavioral change.
Most files already conformed. The genuine outliers indented at 2 columns
(json_helpers.c, util.c from akgl_rectangle_points onward, assets.c,
staticstring.c, akgl_actor_add_child, util.h, staticstring.h) or used
spaces where the canonical form is a tab (draw.c). cc-mode also re-aligns
line-continuation backslashes in multi-line macros to its default
c-backslash-column, which is required for the tree to be a fixed point of
the indenter.
Verified whitespace-only: `git diff -w` over this change is empty apart
from three trailing blank lines removed at EOF in src/heap.c,
src/registry.c, and tests/tilemap.c. The build produces no new errors and
ctest is unchanged at 13/14, with `character` still the one intentional
failure.
The tree is now a fixed point of `scripts/reindent.sh --check`.
include/akgl/SDL_GameControllerDB.h is generated and excluded.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:17:37 -04:00
|
|
|
{ 0x66, 0x66, 0x66, 0xff },
|
|
|
|
|
{ 0x99, 0x99, 0x99, 0xff },
|
2025-08-03 10:07:35 -04:00
|
|
|
};
|
|
|
|
|
int i, x, y;
|
|
|
|
|
SDL_FRect rect;
|
|
|
|
|
const int dx = 8, dy = 8;
|
|
|
|
|
|
|
|
|
|
rect.w = (float)dx;
|
|
|
|
|
rect.h = (float)dy;
|
|
|
|
|
for (y = 0; y < h; y += dy) {
|
Reindent all C sources to the canonical stroustrup style
Mechanical whitespace-only change across src/, include/, tests/, and
util/, applied with scripts/reindent.sh. No behavioral change.
Most files already conformed. The genuine outliers indented at 2 columns
(json_helpers.c, util.c from akgl_rectangle_points onward, assets.c,
staticstring.c, akgl_actor_add_child, util.h, staticstring.h) or used
spaces where the canonical form is a tab (draw.c). cc-mode also re-aligns
line-continuation backslashes in multi-line macros to its default
c-backslash-column, which is required for the tree to be a fixed point of
the indenter.
Verified whitespace-only: `git diff -w` over this change is empty apart
from three trailing blank lines removed at EOF in src/heap.c,
src/registry.c, and tests/tilemap.c. The build produces no new errors and
ctest is unchanged at 13/14, with `character` still the one intentional
failure.
The tree is now a fixed point of `scripts/reindent.sh --check`.
include/akgl/SDL_GameControllerDB.h is generated and excluded.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:17:37 -04:00
|
|
|
for (x = 0; x < w; x += dx) {
|
|
|
|
|
/* use an 8x8 checkerboard pattern */
|
|
|
|
|
i = (((x ^ y) >> 3) & 1);
|
|
|
|
|
SDL_SetRenderDrawColor(renderer->sdl_renderer, col[i].r, col[i].g, col[i].b, col[i].a);
|
2025-08-03 10:07:35 -04:00
|
|
|
|
Reindent all C sources to the canonical stroustrup style
Mechanical whitespace-only change across src/, include/, tests/, and
util/, applied with scripts/reindent.sh. No behavioral change.
Most files already conformed. The genuine outliers indented at 2 columns
(json_helpers.c, util.c from akgl_rectangle_points onward, assets.c,
staticstring.c, akgl_actor_add_child, util.h, staticstring.h) or used
spaces where the canonical form is a tab (draw.c). cc-mode also re-aligns
line-continuation backslashes in multi-line macros to its default
c-backslash-column, which is required for the tree to be a fixed point of
the indenter.
Verified whitespace-only: `git diff -w` over this change is empty apart
from three trailing blank lines removed at EOF in src/heap.c,
src/registry.c, and tests/tilemap.c. The build produces no new errors and
ctest is unchanged at 13/14, with `character` still the one intentional
failure.
The tree is now a fixed point of `scripts/reindent.sh --check`.
include/akgl/SDL_GameControllerDB.h is generated and excluded.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 18:17:37 -04:00
|
|
|
rect.x = (float)x;
|
|
|
|
|
rect.y = (float)y;
|
|
|
|
|
SDL_RenderFillRect(renderer->sdl_renderer, &rect);
|
|
|
|
|
}
|
2025-08-03 10:07:35 -04:00
|
|
|
}
|
|
|
|
|
}
|