Imagepointer help
BlitzMax Forums/BlitzMax Beginners Area/Imagepointer help
| ||
Hi Guys, i am new to blitzmax and own Blitz3d. Its hard to start but it seems that i cant store the pointer to an Image like in Blitz3D. Anyone can help me to code this ? Here is the short example Global grid[5] Graphics 640, 480,0 setmaskcolor 0, 0, 0 my_Image:Timage = LoadImage("gfx\Reaktor.bmp") grid[0]] = pointer to my_Image ? While Not KeyDown(Key_Escape) Drawimage grid[0], 10, 10 flip; cls Wend |
| ||
Something like this should work (untested) :SuperStrict Global grid:TImage[5] Graphics 640, 480,0 setmaskcolor 0, 0, 0 Local my_Image:Timage = LoadImage("gfx\Reaktor.bmp") grid[0] = my_Image While Not KeyDown(Key_Escape) Drawimage grid[0], 10, 10 flip; cls Wend |
| ||
it doesnt work get a Null Pointer |
| ||
If "grid[0]" is null, then "my_Image" is also null ... which means "LoadImage" failed - eg. the path isn't correct. When using "more complex" types (not integers, strings, ...) you already are using some kind of "pointers" (better "handles"). So when assigning grid[0] = my_Image you do not "copy" the image, but the handler. bye Ron |
| ||
it doesnt work get a Null Pointer As Derron says, your image probably hasn't loaded. |
| ||
my Image is loaded, because if i do this i get shown my image Global grid[5] Graphics 640, 480,0 setmaskcolor 0, 0, 0 my_Image:Timage = LoadImage("gfx\Reaktor.bmp") While Not KeyDown(Key_Escape) Drawimage my_image, 10, 10 flip; cls Wend |
| ||
Can you provide the exact code you're using to get the error? Because Brucey's example works perfectly, for me. |
| ||
sorry my mistake, all fine with the code |