Images into Array
BlitzMax Forums/BlitzMax Programming/Images into Array| 
 | ||
| I've not tried to load images into an array before but wanted to do so for a project I was working on yesterday. SuperStrict Global Images:Timage[2,2] Images[0,0] = loadimage "gfx\image1.png" Images[0,1] = loadimage "gfx\image2.png" images[1,0] = loadimage "gfx\image3.png" Images[1,1] = Loadimage "gfx\image4.png" ' etc I've punched that in from memory as I'm on work computer and code is at home but surely this should work? When I run it it will say I'm trying to load an integer into the wrong variable type, or words to that effect. | 
| 
 | ||
| You need brackets after loadimage otherwise BlitzMax thinks you want to store a pointer to the function in the array and not the result of calling the function. | 
| 
 | ||
| Aha, enlightenment... Images[0,0] = loadimage() "gfx\image1.png" or Images[0,0] = loadimage[] "gfx\image1.png" is the correct syntax? | 
| 
 | ||
| Seriously? LoadImage is a function call : 
Images[0,0] = loadimage("gfx\image1.png")
 | 
| 
 | ||
| No ... LoadImage(param)  -> LoadImage("gfx/image1.png") Please pay attention to the "/" instead of "\" - only windows uses the backslash, but accepts the "/"-slash variant too (which is needed for linux/mac). bye Ron | 
| 
 | ||
| Sorry, Brucey. Was just typing from memory (not that great) and got the syntax wrong. We're not all experts at this, you know? And I didn't know about the "/" "\" path restriction for Macs/Linux so thanks for that, Derron. I always wondered why both seemed to work when I tried it. Thanks for that. | 
| 
 | ||
| Sorry, it's just that you've been using function calls with brackets in most of your other posts, I assumed you must have had a brain fart or something ;-) |