In my pygame code I am using rect.clamp to keep sprites within a screen or gameboard, where I clamp and if the center was moved I recalculate the sprite's movement like so:
ctr = self.rect.center self.rect = self.rect.clamp(self.clamp_rect) if self.rect.center != ctr: I'm now using OpenGL with wxPython and my own sprite class. Would it make sense to keep a pygame rect for my sprites and use this clamp function? I assumed the clamp being in C is better than me doing it in python... Using the rect wouldn't slow things down vs just keeping x,y in my own sprite class would it? I would only use rect.center and I assume rect.x y top bottom etc are only calculated if they are used right? Mark