Raylib Bubbles
C++11 Raylib bubble shooter game.
|
An early demo build showing some main mechanics.
Raylib Bubbles is a compact puzzle game following the classic bubble shooter game concept. It relies on the Raylib library for rendering and input handling.
The game is written in C++11 and is built with CMake. It is intended to be a well structured example of a game written with Raylib.
To get started, follow these steps:
git clone --recursive https://github.com/magnetrwn/raylib-bubbles.git
.sudo apt install cmake raylib
../build.sh
, and check the build
directory for the built executable, or the zipped bundle dist/bubbles_build[timestamp].zip
../bubbles
to start the game.INSTRUCTIONS.md
file.--recursive
flag. To fix this, just run git submodule update --init --recursive
.
The game is structured in a way that allows for easy modification and extension.
The following libraries are used in the project:
To summarize the structure of the project, here is a short description of each header file, in alphabetical order:
Include Header | Description |
---|---|
src/animation/action.hpp | Handles actions (animations) taking place, and allows them to neatly interact with the board. |
src/animation/lissajous.hpp | Provides state object for Lissajous curves. |
src/game/board.hpp | Provides a way to build an hexagonal grid of bubbles and methods to manipulate, update and check it. |
src/game/pboard.hpp | Thin struct wrapper adding position information and other window-related metadata to a board. |
src/game/game.hpp | Injects all other modules and builds the main game loop, as well as higher level game state. |
src/raylib/hud.hpp | Manages the HUD and wraps scoring, advanced overlays and other HUD elements, to pass to the window module. |
src/raylib/window.hpp | Manages the window and provides general primitives for window handling and drawing. |
src/utility/util.hpp | Contains static utilities for filesystem interactions and some math. |
Only the window.hpp
, hud.hpp
(both under src/raylib/
) and util.hpp
modules are allowed to include Raylib headers and interact with the Raylib API directly. The rest of the modules are meant to be decoupled from Raylib and should be able to be tested independently or repurposed.
The main strategy used to integrate modules (manager objects/singletons) is dependency injection. This is done by passing the necessary objects to the constructors of the classes that need them. This way, the classes are decoupled and can be tested independently. A downside to this strategy is a lack of clarity in interfaces. This documentation aims to clarify the interfaces and the responsibilities of each class as well.
The static
folder contains all files to bundle with the compiled executable. After running ./build.sh
, which will run cmake
among things, the executable will be placed alongside resources and files to include with it:
res/
: Contains the fonts, textures and all other resources used by the game.bubbles
: The compiled executable.bubbles.ini
: The configuration file for the game.INSTRUCTIONS.md
: A file containing instructions on how to play the game.LICENSE
: The license file for the game, same as the project license.dist
project directory, with the name bubbles_build[timestamp].zip
. It contains all necessary files to run or distribute the game.
Bundled with the project are some utility scripts to help with building the project and documentation, as well as general maintenance.
You can check them out in the scripts section.
Please make sure to read the contributing docs for relevant information on how to contribute to the project. When contributing, adhere to the code style and Gitflow branching guidelines outlined in the file.
If you wish to discuss contributions or talk about the project in a more detached manner, please use the Discussions tab.
This project is licensed under the BSD-3-Clause license. You can find the full license text in the LICENSE
file in the project root, as well as in static/LICENSE
which gets included in every build.