After finishing the first section of LearnOpenGL, I decided to get some hands-on experience and coded this game.
It's a simple shooter where you (the green box) have to shoot and eliminate the enemies (the red boxes).
When deciding how to structure my code, I was inspired by the Cell game engine by Joey DeVries and the OpenGL snake game by Oleg Artene (which are pretty good repos to be used as learning resources) and separated the concerns into classes/entities such as Scene, Drawable, Object, BoundingBox, CollisionManager, utility namespaces, shape structs etc.
Collision is implemented using the well-known "self-adaptive" Axis Aligned Bounding Boxes (AABB), which change their shape when the object rotates according to the updated minimum and maximum x, y and z coordinate values of the vertices to simplify collision calculation.
Build the project using CMake. This project has GLFW, GLM and GLAD as dependencies, so you will need to have the headers for each of these libraries
in an include directory on your machine as well as the GLFW .lib file in a lib directory. Run the following commands from the project root:
mkdir build
cd build
cmake -DINCLUDE_DIR=<path\to\your\include_dir> -DLIB_DIR=<path\to\your\lib_dir> ..
cmake --build .
cd ..
After building, run the executable located in the project's root with ./Boxy.