Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where to put the code?
#1
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);
Reply
#2
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.
Brian Beuken
Lecturer in Game Programming at Breda University of Applied Sciences.
Author of The Fundamentals of C/C++ Game Programming: Using Target-based Development on SBC's 



Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)