Just wondering how much of a footprint the SetScale() command has. Being introduced to polymorphism, I'm naturally thinking of things like universal sprite systems, for instance:
Type sprite
Field x:Float,y:Float
Field w:Float,h:Float ' Width, Height
Field r:Float ' Rotation
Field a:Float ' Alpha
Field image:Int,f:Int ' Image, Frame
Method draw()
SetTransform r,w,h
DrawImage image,x,y,f
End Method
End Type
Type ball Extends sprite
Field r:Int,g:Int,b:Int
Field bounce:Float
End Type The idea here is of course that every image on the screen is ultimately a sprite, so there can be a "root class" that all the individual classes - players, projectiles, enemies etc - extend.
My question is that, as you can see, the SetTransform() command is called every time that a sprite is drawn. This allows a clean, easy way to have the width, height and rotation of each sprite controlled individually. However, I remember many times when methods like this could trip one up; for instance, the need for single-surface particle systems in Blitz3D, because draw calls are more time-intensive than polygons. So, I'm wondering: is it a viable, speedy method to use SetTransform() before every image drawing? Or am I setting myself up for a performance hammer?
|