[bmx] Another drawimagerect by tonyg [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:41

Previous topic - Next topic

BlitzBot

Title : Another drawimagerect
Author : tonyg
Posted : 1+ years ago

Description : Very simple drawimagerect function using standard Bmax commands so OK with GL/DX and takes rotates, blends etc.
Seems fast enough to use in non-debug mode unless you're planning on hundreds per cycle.


Code :
Code (blitzmax) Select
Graphics 640,480
SeedRnd MilliSecs()
image:TImage=LoadImage("max.png")
While Not KeyHit(key_escape)
  Cls
  tg_drawimagerect(image,Rand(0,640),Rand(0,480),0,0,200,100)
  Flip
Wend
Function tg_drawimagerect(image:TImage,x:Int,y:Int,xs:Int,ys:Int,width:Int,height:Int)
    DrawImage LoadImage(PixmapWindow(LockImage(image),xs,ys,width,height)),x,y
End Function


Comments :


Grey Alien(Posted 1+ years ago)

 bug: xy doesn't exist.  Should be ys.


tonyg(Posted 1+ years ago)

 ...changed. At least somebody tried it.


Grey Alien(Posted 1+ years ago)

 lol, yep.  I was worried about my viewport version not being compatible with all PCs.