A "copy and paste" type of project made to modularize the game's engine outside of the game, making it cleaner, reusable and more open to changes and improvements!
- Pedro Nogueira
This project doesn't work by itself - it ALWAYS needs to be compiled alongside with the engine. The engine is crucial for this project, which serves for the sole purpose of cleaning and improving it. This game project, and whatever other game project you use with the engine, needs to be cloned right by its side according to my makefile (or you can mess with the makefile, fuck off).
So your path will look like
/Path/MySDL2-2DEngine/
/Path/SDL2-2DEngineTester/
Project's Mr. Compiler dude. make help
shows you the commands and you can run off from that.
It basically just compiles using either make debug
or make release
(difference being the -d debug flag, anyway...), cppcheck with make cppcheck
and execute the compiled executable with make execute
.
The neat thing about this project is that, in the game's side of the compilation, you'll also be compiling the engine's code using its makefile. The engine is always compiled as a release, whatever the fuck that means, but not linked. The object files generated by the compilations are then copied to the game's bin folder, where they are all linked together with the game's object files too.
With that said, the make debug
and make release
commands mentioned above affect only the game's own code, with the engine always compiling as release. make cppcheck
too. I made it like this because I'd technically be the only one messing with the engine's code, so it'll always be debugged and "cppchecked".
A "does it all" command suggestion:
make clean && make debug && make cppcheck && make execute
My makefile's organization (follow it (ง'̀-'́)ง):
- lib - Imported libraries
- include - Headers' home (in this case, the .h's)
- src - Beautifull raw code (.cpp's)
- bin - Object files generated from compilation (.o's), INCLUDING the engine's objects
- dep - Dependency files for the compilations
Always updated (I wish), in its beatifull markdown format. Watchout for trailing whitespaces!!!
I'm using VSCode in my Ubuntu 16.04.7 LTS.
In it I'm using this very famous C++ extension and I'll config it to Google's formatting style using 80 long lines.
The main goal of this whole debauchery, besides procrastinating from uni, is gathering my SDL2 knowledge I got from a game development class I took a while ago (gods, i miss Lucity =/) and using it to make a "copy-paste" engine.
This means that, by cloning the engine in the same directory as this game I would make, I'd be able to use it for said game immediately. This would:
- Reduce the game's own code;
- Expand the reusability of this engine;
- Keep the engine clean from "game code" to actually work on it alone without having to bother to delete code everytime I want to enhance it;
- Maybe even more shit, idk man...