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

Re: [pygame] Re: pygame with SDL2 proposal




  • Handling of transparent backgrounds on images. Pygame requires extra code for this
  • Easily scaling graphics
  • Easily rotating graphics and drawing primitives
  • Not having the graphics coordinates reversed
  • Easy 'scrolling' of games by showing only part of a larger canvas to draw on
  • Pygame naming was a bit inconsistent


Thanks Paul. That's some good feedback for what we can improve.

I guess a sprite with scaling, rotation, and easier resource loading could be used/added to help with a few of those. Then if things were in a group like LayeredDirty it could handle scrolling. (as a bonus it would work faster on lower powered machines, since that optimizes layers and dirty updates). I'm pretty sure an API could be made which made these things quite nice to use. Maybe a sprite class like this would be an option for pygame zero as well.

s = Sprite('sheep.png').rotate(30).scale(2)

Internally it could load from data/sheep.png, or ./sheep.png and automatically handle transparency convert. rotate, and scale what they say. Internally, they'd call the correct pygame transform functions at draw time.

I haven't looked to closely, but I noticed there have been newer SDL_gfx releases. Including a release for SDL2. Not sure how a rotated/scaled draw api would look like. But I guess transforming the inputs could work. Again a sprite class which was just a line, rect, circle, etc, but it would handle the transforms internally (using pygame.math vectors internally perhaps). Or the group could be transformed as well.

l = Line(1,2, 3,4).rotate(30).scale(2)

Just some off the cuff ideas. But I guess a friendlier sprite API could work to address everything except the reversed coordinates, and naming.


cheers,