GLBasic forum

Main forum => GLBasic - en => Topic started by: aroldo on 2013-Jun-10

Title: LOADSPRITE2MEN ERROR
Post by: aroldo on 2013-Jun-10
This example from the GLB Help file does not work.

When I compile it gives the following error:
Code (glbasic) Select
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?

Code (glbasic) Select
LOCAL w%, h%, pix%[]
IF LOADSPRITEMEM("test.png", w%, h%, pix%[])
   MEM2SPRITE(0, w%, h%, pix%[])
   DRAWSPRITE 0,0,0
ENDIF
SHOWSCREEN
MOUSEWAIT

Title: Re: LOADSPRITE2MEN ERROR
Post by: r0ber7 on 2013-Jun-11
Code (glbasic) Select
error: in passing argument 1

You're putting pix[] in the wrong place. Try:

Code (glbasic) Select
MEM2SPRITE(pix%[], 0, w%, h%)

http://www.glbasic.com/xmlhelp.php?lang=en&id=383&action=view
Title: Re: LOADSPRITE2MEN ERROR
Post by: MrTAToad on 2013-Jun-11
The help file is in error here...