Message from C, C++ discussions

November 2019

— You are going to understand everything and sure its fun- but also remember that it can take years to learn all the stuff and you need a very solid understanding of C++. Sure you could also an other language (ive written my first engine in C#) but in c++ you have much more libraries and example code for game engines plus you have the full memory control and can do fancy & fast things like sse/avx. Do you want to make a 3d or 2d game engine?

Message permanent page

— 

I'm interesting in 3d graphics but my current knowledge are very limited and i have merely experience with 2d. I think that really the best way is to start from game engine book.

— Afaik scanf returns the number of successfully parsed and assigned inputs - for example if you want to read one int you could check if scanf return something which is NOT one- then you know something went wrong

Message permanent page

— 

while (scanf(“%i”, &somenum) != 1)

— Something like that like?

— I guess you want to run the loop as long the input is valid :) so in this case you should do

while(scanf("%i", &somenum) == 1)

Message permanent page

— The while loop runs as long as one input value is succesfully parsed and assigned - that should be it

Message permanent page

— Thank you

— Haha ^^ your welcome

— Is it possible to use an if statement instead of a while loop?

— If scanf equals to 1 else …

— Sure for example:

if(scanf("%i", &somenum)) { 
//Okay
} else {
//Dammit something went wrong
}
the == 1 is implicit because 0 evaluates to false and everything else to true so 1 is true

Message permanent page