Skip to content

Commit 2139048

Browse files
committed
Fixed st_camera_rotate() and st_camera_rotate_set() by including pi
1 parent efa0d17 commit 2139048

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

spritetools.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,11 @@ void st_camera_rotate(st_cam *pcam, float rot){
911911
st_cam cam = *pcam;
912912
cam.rot += rot;
913913
//wraps rotation
914-
while(cam.rot > 1.0){
915-
cam.rot -= 1.0;
914+
while(cam.rot > 2*3.14159265359){
915+
cam.rot -= 2*3.14159265359;
916+
}
917+
while(cam.rot < 0){
918+
cam.rot += 2*3.14159265359;
916919
}
917920
*pcam = cam;
918921
}
@@ -925,6 +928,9 @@ void st_camera_rotate_set(st_cam *pcam, float rot){
925928
while(cam.rot > 1.0){
926929
cam.rot -= 1.0;
927930
}
931+
while(cam.rot < 0){
932+
cam.rot += 2*3.14159265359;
933+
}
928934
*pcam = cam;
929935
}
930936

0 commit comments

Comments
 (0)