tonyg: If you loadimage, how do you reference only a portion of that image? Drawimagerect works differently.
I use this function here
Function DrawImagePart(Image:TImage, DrawX#, DrawY#, PartX#, PartY#, PartWidth#, PartHeight#, Frame# = 0) Local OldX:Int Local OldY:Int Local OldWidth:Int Local OldHeight:Int Local ViewportX:Int = DrawX Local ViewportY:Int = DrawY ' Save current viewport settings GetViewport(OldX, OldY, OldWidth, OldHeight) ' Calculate viewport coordinates based on image's handle If Image.Handle_X Then Local PercentX:Float PercentX = Float(Image.Handle_X) / Float(Image.Width) ViewportX = DrawX - (PercentX * PartWidth) EndIf If Image.Handle_Y Then Local PercentY:Float PercentY = Float(Image.Handle_Y) / Float(Image.Height) ViewportY = DrawY - (PercentY * PartHeight) EndIf SetViewport(ViewportX, ViewportY, PartWidth, PartHeight) DrawImage(Image, DrawX-PartX, DrawY-PartY, Frame) ' Restore old viewport settings SetViewport(OldX, OldY, OldWidth, OldHeight) End Function
but all my testing has shown that using an AnimImage is faster than a single image and any DrawImageRect method I could find.