diff options
author | Flenk008 <frenk_0_0@hotmail.com> | 2023-03-14 18:52:57 +0100 |
---|---|---|
committer | Flenk008 <frenk_0_0@hotmail.com> | 2023-03-14 18:52:57 +0100 |
commit | 76c8687bbefbfa34861f0a7dbd22fe391824aac8 (patch) | |
tree | 97b14ea5d19b7ab041cf46708a9184430cf76491 /src/engine/camera.c | |
parent | 47c76e5eabd2b7aa4eb0de7ca34b4ef9ac78f395 (diff) | |
parent | 51a49f8844705ea3bff95b3c25ba3adc96f5d652 (diff) |
Merge branch 'dev' of https://github.com/Flenk008/avans-arcade into dev
Diffstat (limited to 'src/engine/camera.c')
-rw-r--r-- | src/engine/camera.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/engine/camera.c b/src/engine/camera.c index e756bd4..2c3e517 100644 --- a/src/engine/camera.c +++ b/src/engine/camera.c @@ -6,10 +6,10 @@ vec_cor hh_update_camera(vec_cen new, vec2 min, vec2 max){ //TODO: change floating point math to fix point math - //TODO: fix buggy y-axis ?? + //TODO: remove magic number at y camera offset // new = vec_cen2cor(new,(vec2){.x=max.x/2,.y=max.y/2}); - new = vec_cen2cor((vec2){.x=new.x+(HH_PPU_SPRITE_WIDTH/2),.y=(new.y+(HH_PPU_SPRITE_HEIGHT/2))*2},(vec2){.x=max.x/2,.y=max.y/2}); + new = vec_cen2cor((vec2){.x=new.x+(HH_PPU_SPRITE_WIDTH),.y=new.y+(HH_PPU_SPRITE_HEIGHT*8)},(vec2){.x=max.x/2,.y=max.y/2}); // new.x = new.x << HH_MATH_FIXED_POINT; // new.y = new.y << HH_MATH_FIXED_POINT; static vec_cor old; @@ -19,6 +19,7 @@ vec_cor hh_update_camera(vec_cen new, vec2 min, vec2 max){ // int16_t some = 0; // some = some <<= HH_MATH_FIXED_POINT-1; + // Camera smoothing new.x = (int)((float)new.x*0.1f + (float)old.x*0.9f); new.y = (int)((float)new.y*0.1f + (float)old.y*0.9f); |