Skip to content

Commit f6b1037

Browse files
committed
most settings are saved after the game is exited now, added backgrounds for menu screens and some other minor changes
1 parent 21447b9 commit f6b1037

File tree

18 files changed

+87
-16
lines changed

18 files changed

+87
-16
lines changed

engine/src/engine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ void Engine::setView(const sf::View& view) {
110110
bool Engine::_pause = false;
111111
void Engine::Start(unsigned int width, unsigned int height,
112112
const std::string& gameName, Scene* scn) {
113+
Config::setCurrentLanguage(Config::getSetting("language"));
113114
_currentResolution.x = width;
114115
_currentResolution.y = height;
115116

@@ -165,6 +166,7 @@ void Engine::Start(unsigned int width, unsigned int height,
165166
_pause = false;
166167
}
167168
if(event.type == Event::Resized) {
169+
LOG(DEBUG) << "RESIZED";
168170
//resize view when window is resized so textures are not stretched
169171
auto old = _window->getView();
170172
auto oldPos = Vector2f(old.getViewport().left, old.getViewport().top);

res/lang/bg.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ walkl=Ляво
1818
walkr=Дясно
1919
jump=Скачане
2020
shoot=Стреляне
21+
anykey=Press any key...
22+
done=Готово!

res/lang/en.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ walkl=Walk left
1818
walkr=Walk right
1919
jump=Jump
2020
shoot=Shoot
21+
anykey=Press any key...
22+
done=Key set!
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

src/GUI/button.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Button::Button(const Vector2f& pos, const Vector2f& size, const std::string& tex
1414
_panel.setTextSize(30);
1515
_panel.setGUI(false);
1616
_panel.setBorder(2, Color::Magenta);
17+
_panel.setTextColour(Color::White);
1718
_position = pos;
1819
_clicked = false;
1920
}
@@ -68,12 +69,14 @@ void Button::onClick() {
6869

6970
//called when the mouse is on top the button
7071
void Button::onHover() {
71-
_panel.setPanelColour(Color::Red);
72+
_panel.setBorder(4.f, Color(54, 18, 179));
73+
_panel.setPanelColour(Color(0, 204, 255));
7274
}
7375

7476
//called when the mouse is NOT on top of the button
7577
void Button::reset() {
76-
_panel.setPanelColour(Color::Green);
78+
_panel.setPanelColour(Color(0, 46, 138));
79+
_panel.setBorder(0, Color::Transparent);
7780
}
7881

7982
//returns the "hitbox" of the mouse
@@ -111,3 +114,7 @@ const std::string &Button::getSelection() const {
111114
static const std::string ret = std::string();
112115
return ret;
113116
}
117+
118+
void Button::setSelection(const std::string &sel) {
119+
//do nothing
120+
}

src/GUI/button.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,5 @@ class Button {
3131
void addLabel(const std::string& text);
3232

3333
virtual const std::string& getSelection() const;
34+
virtual void setSelection(const std::string& sel);
3435
};

src/GUI/menu.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,13 @@ void Menu::repositionMenu() {
115115
}
116116
}
117117

118+
void Menu::setSelection(unsigned int id, const std::string &sel) {
119+
_buttons[id]->setSelection(sel);
120+
}
121+
122+
void Menu::setTitleSize(int size) {
123+
_title.setTextSize(size);
124+
}
125+
118126

119127

0 commit comments

Comments
 (0)