Cool effects. Lot of nice stuff you did with camera and shaders there!
Some help (maybe):
You have a bug in 64-bit systems in line 1853. That calculation will return 16 (as ppEffects are pointers which are 64-bit per pointer while int has a size of 32 bit):
- cpp Code: Select all
int ftx = sizeof(ppEffects) / sizeof(int); // get Array total size
Generally using constant numbers (like 8 for array-size) is not a good idea. Programmers call them magic numbers. Prefer using constants instead of numbers whenever you can. It avoids a lot of errors.
Also prefer working with classes like std::vector or irr::core::array (I would use std::vector). That's a lot easier to work with than fixed-size arrays. You use them already a lot - why do you avoid them in some cases? I don't think you need a fixed-size array in your code at all (at least the places I did see on a quick view all looked like they would be better replaced by std::vector's).
If you have 2 arrays for the same thing it's often a hint that you could use a struct or class instead to put those together (for example CEffectPostProc* and std::string). That again then allows you to do stuff like cleaning up memory automatically later on.
You should use more classes instead of one long main function - it's hard to read right now. Start by adding a main application class. Then you can already move variables like musicList into that class. Once you did that you can split the main function up and for example put all the stuff from "RETRIEVE MUSIC + LYRICS FILES, FROM FOLDER" into a member function which just fills those variables. That gives you 2 advantages - first you might call the function again from another place. You might even give it a variable parameter as path and then users can later chose their own folder. And second variables which are only needed in that function like "dir" are then only no longer visible from everywhere. Reducing the scope of variables will make your code easier to maintain.
Later on you will likely split up the application class again into more classes, but starting with one already will help you to see which variables need to be accessed from everywhere and which are only needed locally in some functions. Another useful struct/class would likely be one for settings for example. And maybe one for animations (forward, speed and a function pointer). Animation stuff would also be a prime candidate to put into another file (if you want to keep the c-style there you can use "extern" in that files header to access it from another file and you can use "static" in the .c file to ensure all global variables like anim_forward5 are only accessible within that file).
Ah well... I wish I could help more, but have to start with my own work now :-)
One last hint - you might want to use a style where loops are better visible. If you have Unix you can install astyle and run: astyle --indent=tab --indent-switches -p -b main.cpp
That will give you a style very similar to what Irrlicht uses.