Problems with Windows 8

Archives Forums/BlitzMax Bug Reports/Problems with Windows 8

Ev(Posted 2013) [#1]
I have been using BlitzMax for a little while on my Mac computer, and I was able to achieve basic goals like making a character that moves around the screen. However, I recently got a new computer that runs Windows 8. Whenever I use the DrawImage command, the program will compile with no errors, but when the window opens, an error pops up saying "Unhandled Exception:Attempt to access field or method of Null object."


I am only trying to run a simple program like this:

Graphics 800,600

AutoMidHandle True

shipimage = LoadImage ("spaceship.bmp")

While Not KeyDown(KEY_ESCAPE)

DrawImage shipimage, 400,300

Flip
Wend


GfK(Posted 2013) [#2]
Probably using some weird-ass BMP file format (there are many).

Try converting the image in question to a PNG (which will look the same, but smaller file size).

[edit] Oh, and for the record - always best to ask questions in the programming forums before reporting bugs (because this isn't one).


Ev(Posted 2013) [#3]
Just tried that, didn't change the outcome. And sorry, I will do that if I have any problems in the future. I'm just really confused as to what the problem could be. Maybe theres some sort of security preventing BlitzMax from accessing my files?


GfK(Posted 2013) [#4]
I've just noticed you aren't defining shipimage as a TImage. If you don't do that, it will revert to an Int, and you can't cast a TImage (returned by LoadImage) to an Int. I don't know why that works on a Mac. It shouldn't.

Try:
Local shipimage:TImage = LoadImage ("spaceship.png")

Beyond that, just make sure the file you're trying to load is actually in the location you're trying to load it from.


Ev(Posted 2013) [#5]
Is there a certain way you're supposed to show where you're trying to load it from or something?

Tried this, didn't make a difference:




TomToad(Posted 2013) [#6]
Where is your "spaceship.png" graphic located? The way you have it written, BlitzMAX is expecting to find the graphic in the same directory as the .exe file. If you are just typing out the program and clicking the rocket icon (the file is still called "untitled.bmx") then the .exe will compile somewhere in a temp folder, and not where you expect it to be. Save the source file to a folder and copy the spaceship image to the same folder, then BlitzMAX will compile the .exe to that folder and it should work. Also make sure you didn't misname the image (like spacehsip.png or something).