Skip to content

Commit

Permalink
Fixed st_camera_rotate() and st_camera_rotate_set() by including pi
Browse files Browse the repository at this point in the history
  • Loading branch information
BtheDestroyer committed Jul 28, 2016
1 parent efa0d17 commit 2139048
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions spritetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,11 @@ void st_camera_rotate(st_cam *pcam, float rot){
st_cam cam = *pcam;
cam.rot += rot;
//wraps rotation
while(cam.rot > 1.0){
cam.rot -= 1.0;
while(cam.rot > 2*3.14159265359){
cam.rot -= 2*3.14159265359;
}
while(cam.rot < 0){
cam.rot += 2*3.14159265359;
}
*pcam = cam;
}
Expand All @@ -925,6 +928,9 @@ void st_camera_rotate_set(st_cam *pcam, float rot){
while(cam.rot > 1.0){
cam.rot -= 1.0;
}
while(cam.rot < 0){
cam.rot += 2*3.14159265359;
}
*pcam = cam;
}

Expand Down

0 comments on commit 2139048

Please sign in to comment.