Added Scene Loading and Program Settings

This commit is contained in:
Aslan2142 2019-08-29 20:18:48 +02:00
parent 881e6c70f2
commit 1bad863c5b
13 changed files with 91 additions and 43 deletions

View file

@ -4,17 +4,16 @@ namespace asloengine
{
static sf::RenderWindow *main_window;
static Settings active_settings;
void init(Scene *starting_scene)
void init(Scene *starting_scene, Settings _settings)
{
LOG("START Init");
main_window = new sf::RenderWindow(sf::VideoMode(RESOLUTION_X, RESOLUTION_Y, BIT_DEPTH),
PROGRAM_INFO, sf::Style::Fullscreen);
main_window->setVerticalSyncEnabled(VSYNC_ENABLED);
main_window->setFramerateLimit(MAX_FRAMERATE);
main_window = new sf::RenderWindow();
apply_settings(_settings);
SceneManager::load_scene(starting_scene);
@ -22,6 +21,32 @@ namespace asloengine
}
Settings get_active_settings()
{
return active_settings;
}
void apply_settings(Settings _settings)
{
active_settings = _settings;
if (active_settings.fullscreen_enabled)
{
main_window->create(sf::VideoMode(active_settings.resolution_x, active_settings.resolution_y, active_settings.bit_depth),
PROGRAM_INFO, sf::Style::Fullscreen);
} else {
main_window->create(sf::VideoMode(active_settings.resolution_x, active_settings.resolution_y, active_settings.bit_depth),
PROGRAM_INFO, sf::Style::Close);
}
main_window->setVerticalSyncEnabled(active_settings.vsync_enabled);
main_window->setFramerateLimit(active_settings.max_framerate);
}
void start_main_game_loop()
{