Quote: "As far as I know, this is not possible. It's a very good suggestion"
I already added it
I do my interface like this:
type button
id //sprite id
state //button state
//Normally have a few more things here
endtype
bts as button[99]
function MakeButton(x,y,xsize,ysize,img)
for k=1 to 99
if GetSpriteExists(bts[k].id)=0
c=k
exit
endif
next
bts[c].id=CreateSprite(img)
//Finish making sprite here
endfunction c //return array position
function DoButtons()
for k=1 to 99
if GetSpriteExists(bts[c].id)
//Do Sprite hit test stuff here
//set bts[k].s to 1 if button is down, 2 if button is released
endif
next
endfunction
function State(i)
ret=bts[i].s
endfunction ret
//START MAIN CODE, above code is normally in a different file
start=MakeButton(20,20,30,10,LoadImage("startButton.png"))
do
print(state(start))
sync()
loop
Hope that makes sense
Basically just use a global array for the buttons
EDIT: It's probably quite a bit easier now with AGKv2 because of the array sorting commands, this is how I did it with AGKv1