This simple example load an image, display it on screen and free image before exit.
This use the 2d API of Antiryad Gx.
class init
import antiryadgx.gx_bitmap
import antiryadgx.gx_screen
declarefunction nothing,main,nothing
function main
dim ptr_tbitmap,gx_tbitmap //Declare image pointer
ptr_tbitmap=gx_bitmap::loadall(string::"image.mtd") //Load mtd image
gx_screen::clear() //Clear video buffer
gx_screen::drawbitmap(0,0,ptr_tbitmap,gx_bitmap_drawflat,255,255,255,255) //Write image to video buffer at (0,0) position
gx_screen::flush() //Draw video buffer to screen
ptr_tbitmap->free() //Free image
return
endfunction
/* ---------------------- */
/* Animatedsprite example */
/* ---------------------- */
class init
import antiryadgx.gx_animatedsprite
import antiryadgx.gx_bitmap
import antiryadgx.gx_screen
declarefunction nothing,main,nothing
/* ---- */
/* main */
/* ---- */
function main
dim ptr_tanimatedsprite,gx_tanimatedsprite //Declare animatedprite pointer
ptr_tanimatedsprite=gx_animatedsprite_load(string::"sprite.spr")
ptr_tanimatedsprite->initiate()
while(1,==,1)
gx_screen::clear() //Clear video buffer
gx_screen::drawbitmap(0,0,ptr_tanimatedsprite->getcurrentbitmap(),gx_bitmap_drawflat,255,255,255,255) //Write animatedsprite to video buffer at (0,0) position
gx_screen::flush() //Draw video buffer to screen
ptr_tanimatedsprite->manage() //Update animatedsprite
if(ptr_tanimatedsprite->islooped(),!=,0) //Check if animation looped
break //Break the loop
endif
wend
ptr_tanimatedsprite->free() //Free animatedsprite
return
endfunction