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 a game. Of course I made a test game for the sole purpose of cleaning and improving this code. This game project, and whatever other game project you use with this 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 make
and cppcheck with make cppcheck
.
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. 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, this project does not work by itself! It's basically a husk of a code that a game uses to run. It doesn't even link the object files because it doesn't even have a main! The test game I mentioned above was made exactly to debug this bad boy so that future games don't have to worry about it.
A "does it all" command suggestion:
make clean && make && make cppcheck
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. Watch out 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...
I went back to following exactly my steps in my game development course, and this engine would be good to complete the second assignment out of seven (or nine, I actually don't remember), which means that it shows sprites and plays music! Time for the intense ice screen, baby (/) (°,,°) (/)