The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
game_save.hpp
Go to the documentation of this file.
1
8#ifndef GAME_SAVE_HPP
9#define GAME_SAVE_HPP
10
11#include <string>
12
21{
22 int score1;
23 int score2;
24 float paddle1_y;
25 float paddle2_y;
26 float ball_x;
27 float ball_y;
28 float ball_vel_x;
29 float ball_vel_y;
32 char player1_name[20];
33 char player2_name[20];
34};
35
43{
44 int score;
45 char name[20];
46};
47
55class Saving
56{
57public:
61 static void delete_save();
62
66 static void delete_highscore();
67
73 static bool save_game(const SaveState &state);
74
80 static bool load_game(SaveState &state);
81
86 static bool save_exists();
87
93 static bool save_highscore(const HighScore &score);
94
100 static bool load_highscore(HighScore &score);
101
106 static bool highscore_exists();
107};
108
109#endif
Utility class for managing save game and high score functionality.
Definition game_save.hpp:56
static void delete_save()
Deletes the save game file.
Definition game_save.cpp:89
static void delete_highscore()
Deletes the high score file.
Definition game_save.cpp:97
static bool save_game(const SaveState &state)
Saves the current game state to a file.
Definition game_save.cpp:140
static bool highscore_exists()
Checks if a high score file exists.
Definition game_save.cpp:279
static bool save_exists()
Checks if a save file exists.
Definition game_save.cpp:268
static bool load_game(SaveState &state)
Loads a game state from file.
Definition game_save.cpp:179
static bool save_highscore(const HighScore &score)
Saves a high score to a file.
Definition game_save.cpp:110
static bool load_highscore(HighScore &score)
Loads high score data from file.
Definition game_save.cpp:227
Structure representing a high score record.
Definition game_save.hpp:43
char name[20]
Definition game_save.hpp:45
int score
Definition game_save.hpp:44
Structure representing the complete game state for saving/loading.
Definition game_save.hpp:21
float paddle2_y
Definition game_save.hpp:25
float ball_vel_y
Definition game_save.hpp:29
int score1
Definition game_save.hpp:22
float ball_x
Definition game_save.hpp:26
char player2_name[20]
Definition game_save.hpp:33
float ball_y
Definition game_save.hpp:27
int ball_type
Definition game_save.hpp:30
float paddle1_y
Definition game_save.hpp:24
char player1_name[20]
Definition game_save.hpp:32
float ball_vel_x
Definition game_save.hpp:28
int score2
Definition game_save.hpp:23