Support command-line arguments in application context

This commit is contained in:
Nikita Lisitsa 2023-07-21 01:30:31 +03:00
parent bd826103d3
commit 6ee75f8bae
2 changed files with 4 additions and 1 deletions

View file

@ -22,6 +22,7 @@ namespace psemek::app
// Data received from platform backend after initialization
struct context
{
std::vector<std::string> args;
std::function<void(bool)> show_cursor;
std::function<void(bool)> vsync;
};

View file

@ -9,7 +9,7 @@
#undef main
int main() try
int main(int argc, char ** argv) try
{
using namespace psemek;
@ -32,6 +32,8 @@ int main() try
gfx::init();
app::application::context context;
for (int i = 0; i < argc; ++i)
context.args.push_back(argv[i]);
context.show_cursor = [&](bool show){ window.show_cursor(show); };
context.vsync = [&](bool on){ window.vsync(on); };