diff options
author | 2025-05-20 19:50:54 +0200 | |
---|---|---|
committer | 2025-05-20 19:50:54 +0200 | |
commit | 6613969cd6511acb4f7faf6ab99caa9ee8838a2e (patch) | |
tree | 49505a5ceff0bb54947ed23c0b97e9b1d1f7c746 /src/main/game | |
parent | 9a1b0eb36cf9200b190f58af2c8289f5690dd0be (diff) | |
download | tris-6613969cd6511acb4f7faf6ab99caa9ee8838a2e.tar.gz tris-6613969cd6511acb4f7faf6ab99caa9ee8838a2e.zip |
Remove the transformation from pixel to OpenGL coordinates
Diffstat (limited to 'src/main/game')
-rw-r--r-- | src/main/game/game.c | 12 | ||||
-rw-r--r-- | src/main/game/game.h | 2 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/main/game/game.c b/src/main/game/game.c index 4addcf2..117cf45 100644 --- a/src/main/game/game.c +++ b/src/main/game/game.c @@ -20,10 +20,12 @@ #include "../engine/engine.h" void -game_draw_field(int box_size, int x, int y) +game_draw_field(float box_size, float x, float y) { - engine_draw_line(box_size, y, box_size, box_size * 3); - engine_draw_line(box_size * 2, y, box_size * 2, box_size * 3); - engine_draw_line(x, box_size, box_size * 3, box_size); - engine_draw_line(x, box_size * 2, box_size * 3, box_size * 2); + float half_box = box_size / 2; + engine_draw_line(x - half_box, y + half_box * 3, x - half_box, y - half_box * 3); + engine_draw_line(x + half_box, y + half_box * 3, x + half_box, y - half_box * 3); + + engine_draw_line(x - half_box * 3, y + half_box, x + half_box * 3, y + half_box); + engine_draw_line(x - half_box * 3, y - half_box, x + half_box * 3, y - half_box); } diff --git a/src/main/game/game.h b/src/main/game/game.h index 8148645..e98e109 100644 --- a/src/main/game/game.h +++ b/src/main/game/game.h @@ -20,6 +20,6 @@ #ifndef __GAME_H__ #define __GAME_H__ -void game_draw_field(int box_size, int x, int y); +void game_draw_field(float box_size, float x, float y); #endif /* __GAME_H__ */ |