[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] shaking images]




On Jan 4, 2006, at 11:31 AM, michael gross wrote:


Even though you have floating point positions for your object, SDL and
Pygame use integer coordinates for all blits and drawing. The shaking
you are seeing is caused by the 'stepping' of the integer positions.


Flash does filtering on its renderer so you can do subpixel positioning
of objects.

ok I understand, so I am wondering if there is a free algorithm which does
a similar thing.



If you look at my first Python and Pygame project[1] you will see how I kept track of movements smaller than a pixel (sub-pixel movement).

Just search for "sub-pixel" in the code and you should see plenty of
comments on the subject.  The entire file is commented pretty heavily
so it may or may not be useful for you as a beginner.

Feel free to ask more questions if you don't quite understand something
in the file.

[1]http://fancher.org/projects/pong/pong.py.txt

Regards,
__
Trevor Fancher
http://fancher.org/

Attachment: smime.p7s
Description: S/MIME cryptographic signature