Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariapreda19 committed Apr 29, 2023
1 parent 17165fd commit 66022b0
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion headers/Erori.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class eroare_fereastra : public std::runtime_error {

class eroare_imagine : public eroare_fereastra {
public:
[[maybe_unused]] explicit eroare_imagine(const std::string& mesaj);
explicit eroare_imagine(const std::string& mesaj);
};

class eroare_font : public eroare_fereastra {
Expand Down
2 changes: 1 addition & 1 deletion headers/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Player{

explicit Player(std::string name_, int lastId = 0, int score_ = 0);

Player (const Player& other);
//Player (const Player& other);

Player& operator=(const Player& other);

Expand Down
8 changes: 4 additions & 4 deletions headers/Question.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Question: public Screen {
public:
explicit Question(std::string question = "", const std::vector<std::string> &options = {}, int correct = -1, int category_ = 0);

Question(const Question &other);
//Question(const Question &other);

Question &operator=(const Question &other);

Expand All @@ -57,9 +57,9 @@ class Question: public Screen {
class MenuScreen : public Screen {
using Screen::Screen;
public:
explicit MenuScreen(std::string text = "", const std::vector<std::string> &button_options = {"Play again", "Menu", "Quit"});
//explicit MenuScreen(std::string text = "", const std::vector<std::string> &button_options = {"Play again", "Menu", "Quit"});

MenuScreen(const MenuScreen &other);
//MenuScreen(const MenuScreen &other);

MenuScreen &operator=(const MenuScreen &other);

Expand All @@ -76,7 +76,7 @@ class CategoryScreen : public Screen {
public:
explicit CategoryScreen(std::string text, const std::vector<std::string> &button_options = {std::string ("Music"), std::string ("Geography"), std::string ("History"), std::string ("Art"), std::string ("Literature"), std::string ("Sports")});

CategoryScreen(const CategoryScreen &other);
//CategoryScreen(const CategoryScreen &other);

CategoryScreen &operator=(const CategoryScreen &other);

Expand Down
2 changes: 1 addition & 1 deletion headers/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Timer {
explicit Timer(int durationSeconds);
[[nodiscard]] bool isExpired() const;
void reset();
[[nodiscard]] int getRemainingSeconds() const;
[[nodiscard]] long long getRemainingSeconds() const;
};


Expand Down
3 changes: 1 addition & 2 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void Game::play(){
}
else {
number += 1;
int time = clock.getRemainingSeconds();
long long time = clock.getRemainingSeconds();


int raspuns = question -> display(window);
Expand Down Expand Up @@ -182,7 +182,6 @@ void Game::play(){
}
}
}
delete screen;
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ Player::Player(std::string name_, int lastId , int score_) : name(std::move(name
//std::cout<<"const player";
}

Player::Player (const Player& other): name(other.name), lastId(other.lastId), id(other.id), score(other.score){
}
//Player::Player (const Player& other) = default;

Player& Player:: operator=(const Player& other) {
name = other.name;
Expand Down
10 changes: 5 additions & 5 deletions src/Question.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Question::Question(std::string question, const std::vector<std::string>& options
Screen(std::move(question), options), correctAnswerIndex(correct), category(category_){
}

Question::Question(const Question& other) = default;
//Question::Question(const Question& other) = default;

Question& Question::operator=(const Question& other) = default;

Expand Down Expand Up @@ -187,16 +187,16 @@ int Question::display(sf::RenderWindow &window) {
return -1;
}

MenuScreen::MenuScreen(std::string text, const std::vector<std::string> &button_options) : Screen(std::move(text), button_options) {}
//MenuScreen::MenuScreen(std::string text, const std::vector<std::string> &button_options) : Screen(std::move(text), button_options) {}

MenuScreen::MenuScreen(const MenuScreen &other) = default;
//MenuScreen::MenuScreen(const MenuScreen &other) = default;

MenuScreen &MenuScreen::operator=(const MenuScreen &other) = default;

int MenuScreen::display(sf::RenderWindow &window) {
sf::Texture background;
try {
background.loadFromFile("background.jpg");
background.loadFromFile("backgroun.jpg");
}
catch(eroare_imagine &er){
std::cout << er.what() << std::endl;
Expand Down Expand Up @@ -259,7 +259,7 @@ int MenuScreen::display(sf::RenderWindow &window) {


CategoryScreen::CategoryScreen(std::string text, const std::vector<std::string> &button_options) : Screen(std::move(text), button_options){}
CategoryScreen::CategoryScreen(const CategoryScreen &other) = default;
//CategoryScreen::CategoryScreen(const CategoryScreen &other) = default;
CategoryScreen &CategoryScreen::operator=(const CategoryScreen &other) = default;
int CategoryScreen::display(sf::RenderWindow &window) {
sf::Texture background;
Expand Down
2 changes: 1 addition & 1 deletion src/Timer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void Timer::reset() {
start_ = std::chrono::high_resolution_clock::now();
}

int Timer::getRemainingSeconds() const {
long long Timer::getRemainingSeconds() const {
auto remainingTime = duration_ - (std::chrono::high_resolution_clock::now() - start_);
return std::chrono::duration_cast<std::chrono::seconds>(remainingTime).count();
}

0 comments on commit 66022b0

Please sign in to comment.