Handmade Hero»Forums»Code
Trevor
2 posts
Day 36: Loading BMPs
Hey everyone,

Is there something im missing when is comes to loading BMPs?

From what I can get out of the debugger is that when i call

DEBUGLoadBMP(Thread, Memory->DEBUGPlatformReadEntireFile, "test/test_background.bmp");

The ReadEntireFile(Thread, FileName) returns a INVALID_HANDLE_VALUE. Im thinking that it might have something to do with the thread but in cant find a way to tell. any ideas?
Mārtiņš Možeiko
2568 posts / 2 projects
Day 36: Loading BMPs
How are you running executable? From Visual Studio? Have you set correct current working directory for application like Casey did in Episode 1 from 49:30 to 52:10 ?
Trevor
2 posts
Day 36: Loading BMPs
That fixed it!! Thanks!

I dont know why I changed it. Dident casey say at a later episode that we dident need to worry about the working directory? or maybe it was something else in the properties. OR i could just have imagined it all.

But any way thank you.
Mārtiņš Možeiko
2568 posts / 2 projects
Day 36: Loading BMPs
Edited by Mārtiņš Možeiko on
You don't need to worry about folder where live-editing loop files are stored. Casey wrote code for saving/loading hmi files so they are always relative to .exe file location. If I remember correctly that was done to not pollute data folder because hmi files are temporary things, not permanent asset files for HH.

But debug file location always uses file name directly. So if you pass relative path to it, then you need to be sure what is current working folder for your process.