www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/10/01:42:06

To: djgpp AT delorie DOT com
Subject: Allegro rotate
Message-ID: <19961110.222616.4247.0.chambersb@juno.com>
References: <199611080625 DOT BBJ22599 AT m4 DOT boston DOT juno DOT com>
From: chambersb AT juno DOT com (Benjamin D Chambers)
Date: Sun, 10 Nov 1996 01:25:16 EST

Question:
Has anyone else noticed that Allegro has a built-in limit on the size 
of the bitmap to be rotated by rotate_sprite?
Specifically, the maximum size of a sprite is 181x181, else only the  4th
quadrant (the lower-right) is displayed, though if you want the whole
bitmap to be visible (without the corners clipped off) you must use a
120x120.
Anyways, this limit is NOT DIRECTLY IMPOSED BY ALLEGRO, but by the way
Allegro does math (with the 16.16 fixed system), the numbers are just too
big for the system.  Here's the math:
Distance (Use good old Pythagoras' theorum):
A*A+B*B=C*C
182 (One above the max size) * 182+182*182=66248, largest number with 16
bits is 65535.
I don't know what effect this has (I suspect something with the fsqrt
function not liking neg's, since it wraps around), but I know that only
the 4th quadrant will be displayed.
Has anyone written a fixed rotate routine that doesn't have this
limitation?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019