drawImage()
Purpose
Draw a previously loaded image file
Description
Draws part or all of an image file at the specified location on the screen
Syntax
drawImage( handle, x, y )
drawImage( handle, x, y, scale )
drawImage( handle, { sourceX, sourceY, sourceW, sourceH }, { x, y, width, height } )
Arguments
handle Variable which stores the desired image file
sourceX Horizontal pixel coordinate in the source image from which to begin drawing
sourceY Vertical pixel coordinate in the source image from which to begin drawing
sourceW Width (in pixels) of the source image to draw
sourceH Height (in pixels) of the source image to draw
x Desired on-screen horizontal axis location
y Desired on-screen vertical axis location
scale Amount by which image should be scaled (can be a float or vector { scaleX, scaleY })
height Desired on-screen width in pixels
Example
roll = 0
clear()
image = loadImage( "Colin Brown/Dice", false )
size = tileSize( image, 0 )
for i = 1 to 10 loop
clear()
roll = random(6) + 1
x = size.x - ( size.x * ( roll % 2 ) )
y = size.y * ( ceil( roll / 2 ) - 1 )
drawImage( image, { x, y, size.x, size.y }, { 0, 0, size.x, size.y } )
update()
sleep( 0.3 )
repeat
printAt( 0, 15, "You rolled a ", roll )
update()
sleep( 3 )
Associated Commands
clear(), createImage(), drawImageEx(), drawQuad(), drawSheet(), loadImage(), update(), uploadImage()