The NEW Pong Game V13.2.1
An interesting implemnettaion of the pong game
Loading...
Searching...
No Matches
user.hpp
Go to the documentation of this file.
1
8#ifndef USER_HPP
9#define USER_HPP
10
11#include <string>
12#include <SDL.h>
13#include <SDL_ttf.h>
14
22class User
23{
24public:
29 User(const std::string &name = "Player");
30
34 void increment_score();
35
41 void reset_score();
42
47 int get_user_score() const;
48
53 void set_user_score(int _score) { score = _score; };
54
59 const std::string &get_user_name() const; // It is a contstant since once it is set, it doesn't change afterward
60
65 void set_user_name(const std::string &name);
66
71 void set_round(int _round) { round = _round; }
72
77 int get_round() const { return round; }
78
79private:
80 std::string name;
81 int score;
82 int round;
83};
84
85#endif
Represents a player in the game with name and score tracking.
Definition user.hpp:23
int get_user_score() const
Gets the current score of the user.
Definition user.cpp:44
std::string name
Definition user.hpp:80
const std::string & get_user_name() const
Gets the user's name.
Definition user.cpp:54
int score
Definition user.hpp:81
int get_round() const
Gets the current round number.
Definition user.hpp:77
User(const std::string &name="Player")
Constructor for User class.
Definition user.cpp:17
void set_round(int _round)
Sets the current round number.
Definition user.hpp:71
void set_user_name(const std::string &name)
Sets the user's name.
Definition user.cpp:64
int round
Definition user.hpp:82
void set_user_score(int _score)
Sets the user's score to a specific value.
Definition user.hpp:53
void increment_score()
Increments the user's score by 1.
Definition user.cpp:24
void reset_score()
Resets the user's score to 0.
Definition user.cpp:34