Forums

Full Version: Where to put the code?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

In the book you say (section: Add some code, picture of Lenna): After the FileHandler add this code:

MyFiles FileHandler;
int Width, Height;
char* OurRawData = FileHandler.Load((char*)"../Lenna.png", &Width, &Height);
if (OurRawData == NULL) printf("We failed to load\n");

WHERE do I have to put this code? In which file and on which location?

Best Regards, Patrick

update: it seems that putting it after this line in MyFiles.cpp is the place to be:
unsigned char *data = stbi_load(filename, width, height, &comp, 4);
yes, the code can actually go anywhere really as long as you include STB, and have a MyFiles Filehandler line somewhere

but putting into a Myfiles.cpp file to wrap our load in to a nice function is the safest option.