diff options
-rw-r--r-- | application.cpp | 12 | ||||
-rw-r--r-- | application.h | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/application.cpp b/application.cpp index b92b9a3..8cd9e9d 100644 --- a/application.cpp +++ b/application.cpp @@ -15,17 +15,19 @@ Application::~Application() { } -void Application::create_window(unsigned int w, unsigned int h, bool fs) { - window->Create(sf::VideoMode(w, h, 32), "Foo", sf::Style::Resize | sf::Style::Close | (fs ? sf::Style::Fullscreen : 0)); +void Application::create_window(unsigned int w, unsigned int h, bool fs, const std::string& title) { + window->Create(sf::VideoMode(w, h, 32), title, sf::Style::Resize | sf::Style::Close | (fs ? sf::Style::Fullscreen : 0)); window->UseVerticalSync(true); } -void Application::init_window(unsigned int w, unsigned int h, bool fs) { +void Application::init_window(unsigned int w, unsigned int h, bool fs, const std::string& title) { renderwindow = new sf::RenderWindow(); window = renderwindow; - create_window(w, h, fs); + create_window(w, h, fs, title); input_backend = &window->GetInput(); + + window_title = title; } void Application::run() { @@ -76,7 +78,7 @@ void Application::event_keypress(sf::Key::Code key) { break; case sf::Key::F: fullscreen = !fullscreen; - create_window(1024, 768, fullscreen); + create_window(1024, 768, fullscreen, window_title); event_reshape(window->GetWidth(), window->GetHeight()); init(); break; diff --git a/application.h b/application.h index f7ea563..8f1bb35 100644 --- a/application.h +++ b/application.h @@ -1,6 +1,8 @@ #ifndef APPLICATION_H #define APPLICATION_H +#include <string> + #include <SFML/Window.hpp> #include "input.h" @@ -10,9 +12,11 @@ class Application { bool please_quit; bool fullscreen; + std::string window_title; + protected: - void create_window(unsigned int w, unsigned int h, bool fs = false); - void init_window(unsigned int w, unsigned int h, bool fs = false); + void create_window(unsigned int w, unsigned int h, bool fs, const std::string& title); + void init_window(unsigned int w, unsigned int h, bool fs, const std::string& title); virtual void event(const sf::Event& e); virtual void event_keypress(Key::Code key); |