Skip to content

Commit

Permalink
add loop delay argument
Browse files Browse the repository at this point in the history
  • Loading branch information
moonshadow565 committed Apr 6, 2022
1 parent fe86810 commit 36b688c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ struct App {
server.onConnected = std::bind_front(&App::on_connected, this);
server.onDisconnected = std::bind_front(&App::on_disconnected, this);
server.onPacket = std::bind_front(&App::on_packet, this);
server.service();
server.service(options.ping);
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ Options::Options(int argc, char** argv) {
.help("Black loading screen")
.implicit_value((bool)true)
.default_value((bool)black_screen);
program.add_argument("--ping")
.action([](std::string const& v) { return (uint32_t)std::stoul(v); })
.default_value((uint32_t)ping);
program.add_argument("-l", "--log")
.help("Log level")
.action([](std::string const& v) {
Expand All @@ -47,6 +50,7 @@ Options::Options(int argc, char** argv) {
port = program.get<uint16_t>("--port");
key = program.get<std::string>("--key");
black_screen = program.get<bool>("-b");
ping = program.get<uint32_t>("--ping");
Logger::currentLevel = program.get<int>("-l");
} catch (std::exception const& error) {
panic(error.what());
Expand Down
1 change: 1 addition & 0 deletions src/options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ struct Options {
uint16_t port = 5119;
std::string key = "GLzvuWtyCfHyGhF2";
bool black_screen = false;
std::uint32_t ping = 0;

Options(int argc, char** argv);
};

0 comments on commit 36b688c

Please sign in to comment.