Raylib Bubbles
C++11 Raylib bubble shooter game.
|
The configuration file is a simple text file that contains settings for the game. When opening the game, the configuration file is used to setup the main window, as well as configuring several aspects of the game.
When opening the game, the GameWindow::GameWindow()
class constructor will call several functions to retrieve data from the configuration file. These can be found in the static method class GameUtils
. These utility functions use the inipp.h
header-only library to parse the configuration file.
Configuration settings are stored as an INI file, which is a simple text file format that stores settings in key-value pairs, with multiple under related sections. Because of this, the utility functions have been designed with arguments section
and key
to retrieve the value of a specific key in a specific section.
Finally, let's take a look at the configuration file itself. The configuration file is named bubbles.ini
and is located near the executable (in the general project structure, it's located in static/
as with all other assets).
; ------------------------------------------------------ ; ; bubbles.ini: runtime configuration for Raylib Bubbles ; ; ------------------------------------------------------ ; ; This file is loaded at game launch to configure ; ; various aspects of the program. Each section is titled ; ; according to the source code queries to its settings. ; ; ------------------------------------------------------ ; ; The file is in INI format, with sections and key-value ; ; pairs. This project uses the mcmtroffaes/inipp library ; ; to parse the file. ; ; ------------------------------------------------------ ; [*.Action] ; Downward acceleration of actions. GRAVITY = 0.75 ; Maximum number of IDs for actions, thus maximum actions. MAX_IDS = 131072 [*.Board] ; Number of adjacent same-colored bubbles to pop. MATCHES_TO_POP = 3 [Game.Arrow] ; Paths to the player shooter sprites, plus offsets for combining. ARROW_CORE_PATH = res/sprites/arrow_core.png ARROW_TIP_PATH = res/sprites/arrow_tip.png ARROW_TIP_OFFSET_Y = 8.0 ARROW_SPRING_PATH = res/sprites/arrow_spring.png ARROW_SPRING_OFFSET_Y = -4.0 [Game.Background] ; Colon separated list of background images, relative to executable path. PATHS = res/backgrounds/abandoned_1.png:res/backgrounds/abandoned_2.png:res/backgrounds/abandoned_3.png:res/backgrounds/abandoned_4.png:res/backgrounds/bowl_1.png:res/backgrounds/bowl_2.png:res/backgrounds/engraved_1.png:res/backgrounds/engraved_2.png:res/backgrounds/engraved_3.png [Game.Board] ROWS = 13 COLS = 10 [Game.Bubble] ; Colon separated list of bubble images, relative to executable path. PATHS = res/sprites/bubble_1.png:res/sprites/bubble_2.png:res/sprites/bubble_3.png:res/sprites/bubble_4.png:res/sprites/bubble_5.png:res/sprites/bubble_6.png [Game.Font] PATH = res/fonts/ct_prolamina.ttf SIZE = 36 [Game.Input] ; Speed of the player shots, in px per frame. SHOOTING_SPEED = 20 ; Rotation speed in radians per frame. ROTATION_SPEED = 0.04 [Game.View] HUD_HELD_BUBBLES = 5 ; Game board margins from window edges, to fit decorated girders. MARGIN_SIDES = 20 MARGIN_TOP = 32 [Game.Window] ; Some suggested resolutions: 450x720 low, 600x960 default. ; Note: Never exceed 1024x1024, as the background images are that size (not enforced). WIDTH = 600 HEIGHT = 960 TITLE = Raylib Bubbles: A simple game by @magnetrwn FPS = 60 VSYNC = true