Skip to content

Commit

Permalink
Network-related confirmation dialogs on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankata453 committed Jun 4, 2024
1 parent 9827cc7 commit 1d12c8f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/supertux/gameconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#endif

Config::Config() :
m_initial(true),
profile(1),
fullscreen_size(0, 0),
fullscreen_refresh_rate(0),
Expand Down Expand Up @@ -340,6 +341,8 @@ Config::load()
}
}
}

m_initial = false;
}

void
Expand Down
6 changes: 6 additions & 0 deletions src/supertux/gameconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class Config final
void load();
void save();

bool is_initial() const { return m_initial; }

private:
bool m_initial;

public:
int profile;

/** the width/height to be used to display the game in fullscreen */
Expand Down
19 changes: 19 additions & 0 deletions src/supertux/menu/main_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "gui/menu_item.hpp"
#include "gui/menu_manager.hpp"
#include "supertux/fadetoblack.hpp"
#include "supertux/gameconfig.hpp"
#include "supertux/globals.hpp"
#include "supertux/level.hpp"
#include "supertux/level_parser.hpp"
Expand Down Expand Up @@ -68,6 +69,24 @@ MainMenu::MainMenu()
#endif

on_window_resize();

#ifndef __EMSCRIPTEN__
// Show network-related confirmation dialogs on first startup
if (g_config->is_initial())
{
Dialog::show_confirmation(_("Would you allow SuperTux to connect to the Internet?\n\nThis enables additional features, such as the in-game add-on catalog."),
[]()
{
g_config->disable_network = false;

Dialog::show_confirmation(_("Would you allow SuperTux to check for new releases on startup?\n\nYou will be notified if any are found."),
[]()
{
g_config->do_release_check = true;
});
}, true);
}
#endif
}

void
Expand Down

0 comments on commit 1d12c8f

Please sign in to comment.