The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
Saving Class Reference

Utility class for managing save game and high score functionality. More...

#include <game_save.hpp>

Static Public Member Functions

static void delete_highscore ()
 Deletes the high score file.
 
static void delete_save ()
 Deletes the save game file.
 
static bool highscore_exists ()
 Checks if a high score file exists.
 
static bool load_game (SaveState &state)
 Loads a game state from file.
 
static bool load_highscore (HighScore &score)
 Loads high score data from file.
 
static bool save_exists ()
 Checks if a save file exists.
 
static bool save_game (const SaveState &state)
 Saves the current game state to a file.
 
static bool save_highscore (const HighScore &score)
 Saves a high score to a file.
 

Detailed Description

Utility class for managing save game and high score functionality.

This class handles saving and loading game states and high scores, including file operations and data encoding/decoding.

Member Function Documentation

◆ delete_highscore()

void Saving::delete_highscore ( )
static

Deletes the high score file.

◆ delete_save()

void Saving::delete_save ( )
static

Deletes the save game file.

◆ highscore_exists()

bool Saving::highscore_exists ( )
static

Checks if a high score file exists.

Returns
true if a high score file exists, false otherwise

◆ load_game()

bool Saving::load_game ( SaveState & state)
static

Loads a game state from file.

Parameters
stateSaveState structure to populate with the loaded data
Returns
true if load was successful, false otherwise

Reads and decodes the saved game state from the save file

Parameters
stateSaveState structure to populate with the loaded data
Returns
true if load was successful, false otherwise

◆ load_highscore()

bool Saving::load_highscore ( HighScore & score)
static

Loads high score data from file.

Parameters
scoreHighScore structure to populate with the loaded data
Returns
true if load was successful, false otherwise

Reads and decodes the latest high score from the high score file

Parameters
scoreHighScore structure to populate with the loaded data
Returns
true if load was successful, false otherwise

◆ save_exists()

bool Saving::save_exists ( )
static

Checks if a save file exists.

Returns
true if a save file exists, false otherwise

◆ save_game()

bool Saving::save_game ( const SaveState & state)
static

Saves the current game state to a file.

Parameters
stateSaveState structure containing the game state to save
Returns
true if save was successful, false otherwise

Creates or overwrites the save file with the current game state in binary format after encoding

Parameters
stateSaveState structure containing the game state to save
Returns
true if save was successful, false otherwise

◆ save_highscore()

bool Saving::save_highscore ( const HighScore & score)
static

Saves a high score to a file.

Saves the current high score to a file.

Parameters
scoreHighScore structure containing the score data to save
Returns
true if save was successful, false otherwise

Appends the high score to the file in binary format after encoding

Parameters
scoreHighScore structure containing the score data to save
Returns
true if save was successful, false otherwise

The documentation for this class was generated from the following files: