LOADSPRITE2MEN ERROR

Previous topic - Next topic

aroldo

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

[a http://apd-games.com/][img http://apd-games.com/images/APDGames135.png][/a]
MacBook Pro OS X El Capitan
XCode Version 7
iPhone 6 running  iOS 9
iPad Mini running  iOS 7.1
Galaxy S5
Dell Latitude Windows 8 Enterprise
Palm Pre, Palm Pre2

r0ber7

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

MrTAToad

The help file is in error here...