This example from the GLB Help file does not work.
When I compile it gives the following error:
compiling:
C:\Users\ACARVA~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\ACARVA~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:65: error: invalid initialization of non-const reference of type '__GLBASIC__::DGNatArray&' from a temporary of type 'int'
C:/Program Files (x86)/GLBasic_v11/Compiler/platform/Include/glb.h:1370: error: in passing argument 1 of `DGNat __GLBASIC__::MEM2SPRITE(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat)'
*** FATAL ERROR - Please post this output in the forum
Does any body know what is wrong?
LOCAL w%, h%, pix%[]
IF LOADSPRITEMEM("test.png", w%, h%, pix%[])
MEM2SPRITE(0, w%, h%, pix%[])
DRAWSPRITE 0,0,0
ENDIF
SHOWSCREEN
MOUSEWAIT
error: in passing argument 1
You're putting pix[] in the wrong place. Try:
MEM2SPRITE(pix%[], 0, w%, h%)
http://www.glbasic.com/xmlhelp.php?lang=en&id=383&action=view
The help file is in error here...