diff options
author | talha <sarcxd@gmail.com> | 2025-02-10 19:18:27 +0500 |
---|---|---|
committer | talha <sarcxd@gmail.com> | 2025-02-10 19:18:27 +0500 |
commit | 9e616600198f5b2fe0e68d2456222ba1d8b2435b (patch) | |
tree | 308f48d21e08956ef95a802e9302128c548ab6be /source | |
parent | e9d132b69de70441e0bdaa05f97d605bd982fc29 (diff) |
V1 of updating how entity position is treated:
- position corresponds to bottom left of block.
- makes it easy and predictable to design and place levels.
Diffstat (limited to 'source')
-rwxr-xr-x | source/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/main.cpp b/source/main.cpp index 459d3da..d6e1394 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -276,11 +276,11 @@ struct GameState { Rect rect(Vec3 position, Vec2 size) { Rect r = {0}; - r.lb.x = position.x - size.x; - r.lb.y = position.y - size.y; + r.lb.x = position.x; + r.lb.y = position.y; - r.rt.x = position.x + size.x; - r.rt.y = position.y + size.y; + r.rt.x = position.x + 2.0f*size.x; + r.rt.y = position.y + 2.0f*size.y; return r; } @@ -667,7 +667,7 @@ void gl_draw_colored_quad_optimized( Mat4 scale = scaling_matrix4m(size.x, size.y, 0.0f); model = multiply4m(scale, model); // setting quad position - Mat4 translation = translation_matrix4m(position.x, position.y, position.z); + Mat4 translation = translation_matrix4m(position.x + size.x, position.y + size.y, position.z); model = multiply4m(translation, model); Vec4 model_pos; |