Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Chapter 04] Unclear where to put the FileHandler code
#1
Hi,

So I just finished the part about displaying the single picture ("lenna.png") in chapter 04. There's one part that seemed unclear to me and that's where to put this FileHandler code:

Code:
int Width, Height;
char* OurRawData = FileHandler.Load((char*)"../assets/lenna.png", &Width, &Height);
if (OurRawData == NULL) printf("Picture failed to load.\n");
    
p_state->user_data->textureID = CreateTexture2D(Width, Height, OurRawData);


You mention a while (TRUE) loop on page 63 as if it's already existing, but if you look back at the first code listing for the triangle on page 49, there is no while loop in the main function. 

My first reaction was to put the new code into the esMainLoop function (I mean, it's already called main loop, it has a while loop that terminates and it worked previously) which resulted in a program that was executing but displayed no picture, no compiler errors and none of the debug messages. So, without any errors I started looking for mistakes elsewhere and checked the code that was changed in this chapter so far against the book ... twice. Only when looking at the project file you uploaded for chapter 04 did I notice that you had placed a new while loop in the main function. 
 
So, to summarize, on page 61 you wrote "After the FileHandler add this code;"  which in my opinion should have been something like "Above the esMainLoop function in the main function at the bottom, add the following code:" and then on page 63 it should have said to add the new line below and put a while (TRUE) loop around it while also mentioning that execution of the program can now only be stopped from within Visual Studio by pressing the "Stop Debugging"-button.

Another thing, maybe for the next edition: Could you please highlight the changes you made to existing code?
Reply


Messages In This Thread
[Chapter 04] Unclear where to put the FileHandler code - by sephris - 04-10-2018, 01:06 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)