Re: weird SDL Rect handling on SDL module

Rafael Jannone <jannone-bf/[email protected]> Sun, 28 Aug 2005 11:45:03 -0300
Newsgroups gmane.comp.lang.lua.luacheia
Message-ID <[email protected]>
Asko Kauppi escreveu:
> 
> Yes, you certainly have found the source of the issue.
> 
> The +0.5's are there to handle cases where coordinates have been 
> calculated, and don't exactly match into integers. Originally, the  SDL
> port was tested against Meteor Shower demo, and it most likely 
> benefitted from them.
> 
> Now, the proper solution would most likely involve some rounding 
> function, suggestions welcome. :)

how about this:

#define glua_round(v)   ((int)(((v) < 0) ? (v)-0.5 : (v)+0.5))

i changed all "+0.5" to this define, and now it seems to be working.

i forgot to mention, there is another instance of this bug inside
function GLUA_FUNC( _Rect_settable ).  just search for all "0.5" and
you'll get there.

regards,
--
Rafael Jannone


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf