LoadImage

Family: Image · 4 forms

What it does

LoadImage writes to an Image object: it loads rather than reads. It takes iImageIndex (an integer), sImageFilename (a string) and bBlackToAlpha (an integer), and returns nothing. That is the first of 4 forms. iImageIndex is the id you are giving an Image object: every later call names it by that number.

Syntax

1
LoadImage(iImageIndex integer, sImageFilename string, bBlackToAlpha integer)
2
LoadImage(ID integer, sImageFilename string)
3
LoadImage(sImageFilename string, bBlackToAlpha integer) → integer
4
LoadImage(sImageFilename string) → integer

Parameters

NameTypeIn forms
iImageIndexinteger1
sImageFilenamestringall
bBlackToAlphainteger1, 3
IDinteger2

What each form returns

1LoadImage(1, "assets/sprite.png", 1)nothing
2LoadImage(1, "assets/sprite.png")nothing
3image = LoadImage("assets/sprite.png", 1)integer
4image = LoadImage("assets/sprite.png")integer

Example · generated

Form 1, you choose the id yourself

LoadImage(1, "assets/sprite.png", 1)DO  Sync()LOOP

Form 3, the command hands back the id

image = LoadImage("assets/sprite.png", 1)DO  Sync()LOOP

LoadImage is called with values of the types its signature asks for. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

35 commands in Image