#7762 - aran - Tue Jun 24, 2003 9:32 am
In a function that implements rotation/zoom arithmethics I have seen
the following snippets:
FIXED zoom = 1<<8;
y = (y * zoom)>>8;
bg->DX = ((bg->x_scroll<<8) - y*SIN[angle] - x*COS[angle]);
bg->PA = (COS[angle]*zoom)>>8;
What exactly is a FIXED and why does it have to be a FIXED in the above function? Does it mean zoom is unmodifyable? However I would want to zoom faster and slower, is that possible, if yes how would I change my zoom variable?
Also, am I correct that 1<<8 means as 1 as dual shifted eight bits to the left? Why did the author then shift after each operation, either 8 bits left or right?
Thanks
the following snippets:
FIXED zoom = 1<<8;
y = (y * zoom)>>8;
bg->DX = ((bg->x_scroll<<8) - y*SIN[angle] - x*COS[angle]);
bg->PA = (COS[angle]*zoom)>>8;
What exactly is a FIXED and why does it have to be a FIXED in the above function? Does it mean zoom is unmodifyable? However I would want to zoom faster and slower, is that possible, if yes how would I change my zoom variable?
Also, am I correct that 1<<8 means as 1 as dual shifted eight bits to the left? Why did the author then shift after each operation, either 8 bits left or right?
Thanks