BASIC

Author Topic: LOADSPRITE2MEN ERROR  (Read 952 times)

Offline aroldo

  • Mr. Polyvector
  • ***
  • Posts: 143
    • View Profile
    • APD Consulting, Inc.
LOADSPRITE2MEN ERROR
« 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

 
[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

Offline r0ber7

  • Prof. Inline
  • *****
  • Posts: 539
    • View Profile
Re: LOADSPRITE2MEN ERROR
« Reply #1 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

MrTAToad

  • Guest
Re: LOADSPRITE2MEN ERROR
« Reply #2 on: 2013-Jun-11 »
The help file is in error here...