Skip to content

Commit

Permalink
- Modificare culori
Browse files Browse the repository at this point in the history
- Aliniere Text/Butoane
- Curatare consola
  • Loading branch information
radumcostache committed Jun 30, 2023
1 parent fff8dc5 commit 37c1f6a
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 43 deletions.
3 changes: 0 additions & 3 deletions Attraction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
Attraction::Attraction() : name(), rating(), chr(1, 1, 1, 1) {std::cerr << "Successful use of Attraction constructor";}
Attraction::Attraction(const std::string &name, const Rating &rating)
: name(name), rating(rating), chr(1, 1, 1, 1) {std::cerr << "Successful use of Attraction constructor";}
Attraction::~Attraction() {
std::cerr << "Successful use of Attraction destructor";
}

const Rating & Attraction::getRating() const{
return rating;
Expand Down
2 changes: 1 addition & 1 deletion Attraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Attraction {
Attraction();
Attraction(const std::string &name, const Rating &rating);
Attraction(const Attraction & t) = default;
~Attraction();
~Attraction() = default;
Attraction &operator =(const Attraction &other) = default;

const Characteristics<char> &getChr() const;
Expand Down
16 changes: 8 additions & 8 deletions Button_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ Button Button_factory::startButton() {
.size(100, 100)
.text("Start")
.textSize(30)
.idleColor(sf::Color::Green)
.idleColor(sf::Color(0xACBEA3))
.hoverColor(sf::Color::Red).build();
}

Button Button_factory::ratingButton(int rating) {
Button_builder builder;
return builder.position(30 + 60 * rating, 100)
return builder.position(30 + 60 * rating, 300)
.size(40, 40)
.idleColor(sf::Color::Black)
.hoverColor(sf::Color::Cyan)
.hoverColor(sf::Color(0xEB6534))
.text(std::to_string(rating + 1))
.textSize(20)
.build();
Expand All @@ -28,17 +28,17 @@ Button Button_factory::ratingButton(int rating) {
Button Button_factory::yButton() {
Button_builder builder;
return builder.position(100, 300)
.size(50, 50)
.size(70, 70)
.text("YES")
.textSize(30)
.idleColor(sf::Color::Black)
.hoverColor(sf::Color::Green).build();
.hoverColor(sf::Color(0xACBEA3)).build();
}

Button Button_factory::nButton() {
Button_builder builder;
return builder.position(300, 300)
.size(50, 50)
.size(70, 70)
.idleColor(sf::Color::Black)
.hoverColor(sf::Color::Red)
.text("NO")
Expand All @@ -49,12 +49,12 @@ Button Button_factory::nButton() {
Button Button_factory::submitButton() {

Button_builder builder;
return builder.position(100, 50)
return builder.position(100, 300)
.size(100, 100)
.text("Submit")
.textSize(30)
.idleColor(sf::Color::Black)
.hoverColor(sf::Color::Cyan).build();
.hoverColor(sf::Color(0xEB6534)).build();
}


4 changes: 0 additions & 4 deletions Destination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Destination::Destination(const std::string &name, const std::string &description
std::cerr << "Successful use of Destination constructor";
}

Destination::~Destination() {
std::cerr << "Successful use of Destination constructor";
}

Destination &Destination::operator=(const Destination &other) {
name = other.name;
description = other.description;
Expand Down
2 changes: 1 addition & 1 deletion Destination.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Destination {
const std::vector<Attraction> &attraction,
const Characteristics<int> &characteristics);
Destination(const Destination &) = default;
~Destination();
~Destination() = default;

Destination& operator=(const Destination & other);
//void addAttraction(const Attraction & A);
Expand Down
2 changes: 1 addition & 1 deletion Frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void Frame::drawBackground(sf::RenderWindow &window) {
Frame::Frame(User &user) : user(user) {
font.loadFromFile("fonts/arial.ttf");
background.setSize(sf::Vector2f(800, 600));
background.setFillColor(sf::Color::White);
background.setFillColor(sf::Color(0x40476D));
}

void Frame::addError(const std::string & error) {
Expand Down
10 changes: 3 additions & 7 deletions Point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@

#include "Point.h"
#include <cmath>
#include <ctgmath>

Point::Point() : x(0), y(0) {std::cerr << "Successful use of Point constructor";}
Point::Point(float x, float y) : x(x), y(y) {std::cerr << "Successful use of Point constructor";}
Point::Point(const Point & other) : x(other.x), y(other.y) {std::cerr << "Successful use of Point constructor";}
Point::~Point() {
std::cerr << "Successful use of Point destructor";
}
Point::Point() : x(0), y(0) {std::cerr << "Point Constructor";}
Point::Point(float x, float y) : x(x), y(y) {std::cerr << "Point constructor";}
Point::Point(const Point & other) : x(other.x), y(other.y) {std::cerr << "Point Constructor";}

Point& Point::operator=(const Point &other) {
x = other.x;
Expand Down
2 changes: 1 addition & 1 deletion Point.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Point {
Point();
Point(float x, float y);
Point(const Point & other);
~Point();
~Point() = default;

Point& operator=(const Point &other);

Expand Down
3 changes: 0 additions & 3 deletions Rating.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ Rating::Rating(float val): val(val), numberOfRatings(1) {
Rating::Rating(const Rating &other) : val(other.val), numberOfRatings(other.numberOfRatings) {
std::cerr << "Successful use of Rating constructor";
}
Rating::~Rating() {
std::cerr << "Successful use of Rating destructor";
}

Rating& Rating::operator=(const Rating& other) {
val = other.val;
Expand Down
1 change: 0 additions & 1 deletion Rating.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ class Rating {
Rating();
explicit Rating(float val);
Rating(const Rating &other);
~Rating();

Rating& operator=(const Rating& other);
void addRating(int newRating);
Expand Down
6 changes: 3 additions & 3 deletions destinationFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ destinationFrame::destinationFrame(User &user, Destination &destination) : Frame
font.loadFromFile("fonts/arial.ttf");
nameText.setFont(font);
nameText.setCharacterSize(20);
nameText.setFillColor(sf::Color::Red);
nameText.setFillColor(sf::Color(0xEB6534));
nameText.setPosition(20, 100);
nameText.setString("You are going to " + destination.getName() + " " +
std::to_string(user.getLocation().Distance(destination.getLocation())) + "km away");

descriptionText.setFont(font);
descriptionText.setCharacterSize(10);
descriptionText.setFillColor(sf::Color::Black);
descriptionText.setFillColor(sf::Color::White);
descriptionText.setPosition(20, 150);
descriptionText.setString(destination.getDescription());

attractionText.setFont(font);
attractionText.setCharacterSize(30);
attractionText.setFillColor(sf::Color::Black);
attractionText.setFillColor(sf::Color::White);
attractionText.setPosition(100, 300);
std::string attractions;
auto att = destination.topByReviews();
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ int main() {
}
while (window.isOpen()) {
sf::Event event;
window.clear(sf::Color::Blue);
window.clear(sf::Color(0x40476D));
F->draw(window);
while (window.pollEvent(event)) {
if (event.type == sf::Event::Closed)
Expand Down
4 changes: 2 additions & 2 deletions startFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ startFrame::startFrame(User &user) : Frame(user) {
latiText.setString("Latitude");
latiText.setCharacterSize(30);
latiText.setPosition(100, 100);
latiText.setFillColor(sf::Color::Black);
latiText.setFillColor(sf::Color::White);

longiText.setFont(font);
longiText.setString("Longitude");
longiText.setCharacterSize(30);
longiText.setPosition(100, 200);
longiText.setFillColor(sf::Color::Black);
longiText.setFillColor(sf::Color::White);

//Button startButton(sf::Vector2f(100, 300), sf::Vector2f(100, 100), "Start", 30, sf::Color::Green, sf::Color::Red);
addButton(Button_factory::startButton());
Expand Down
4 changes: 2 additions & 2 deletions startFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class startFrame: public Frame{
sf::Text latiText;
sf::Text longiText;

TextBox latiBox{sf::Vector2f(300, 100), sf::Vector2f(200, 50), 30, sf::Color::Black, sf::Color::Green};
TextBox longiBox{sf::Vector2f(300, 200), sf::Vector2f(200, 50), 30, sf::Color::Black, sf::Color::Green};
TextBox latiBox{sf::Vector2f(300, 100), sf::Vector2f(200, 50), 30, sf::Color::Black, sf::Color::White};
TextBox longiBox{sf::Vector2f(300, 200), sf::Vector2f(200, 50), 30, sf::Color::Black, sf::Color::White};

public:
startFrame();
Expand Down
5 changes: 1 addition & 4 deletions tfQuestion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
tfQuestion::tfQuestion(const std::string & question, Characteristics<int> &characteristics) : Question(question, characteristics),
yesButton( Button_factory::yButton()),
noButton(Button_factory::nButton()) {
std::cout << "tfQuestion constructor" << std::endl;
answer = 3;
}

tfQuestion::~tfQuestion() {
std::cout << "tfQuestion destructor" << std::endl;
}


void tfQuestion::showQuestion(sf::RenderWindow &window) {
sf::Font font;
Expand Down
2 changes: 1 addition & 1 deletion tfQuestion.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class tfQuestion : public Question{
Button yesButton;
Button noButton;
tfQuestion(const std::string & question, Characteristics<int> &characteristics);
~tfQuestion() override;
~tfQuestion() = default;

void showQuestion(sf::RenderWindow &window) override;
std::string handleEvent(sf::Event event, sf::RenderWindow &window) override;
Expand Down

0 comments on commit 37c1f6a

Please sign in to comment.