diff --git a/Userland/Games/2048/CMakeLists.txt b/Userland/Games/2048/CMakeLists.txt index e31191c05ae..27bed755f77 100644 --- a/Userland/Games/2048/CMakeLists.txt +++ b/Userland/Games/2048/CMakeLists.txt @@ -12,4 +12,4 @@ set(SOURCES ) serenity_app(2048 ICON app-2048) -target_link_libraries(2048 LibConfig LibGUI) +target_link_libraries(2048 LibConfig LibGUI LibMain) diff --git a/Userland/Games/2048/main.cpp b/Userland/Games/2048/main.cpp index 7294f4b353c..b428be3f742 100644 --- a/Userland/Games/2048/main.cpp +++ b/Userland/Games/2048/main.cpp @@ -19,40 +19,28 @@ #include #include #include +#include +#include #include #include -#include -int main(int argc, char** argv) +ErrorOr serenity_main(Main::Arguments arguments) { - if (pledge("stdio rpath recvfd sendfd unix", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(System::pledge("stdio rpath recvfd sendfd unix", nullptr)); srand(time(nullptr)); - auto app = GUI::Application::construct(argc, argv); + auto app = GUI::Application::construct(arguments.argc, arguments.argv); auto app_icon = GUI::Icon::default_icon("app-2048"); auto window = GUI::Window::construct(); Config::pledge_domains("2048"); - if (pledge("stdio rpath recvfd sendfd", nullptr) < 0) { - perror("pledge"); - return 1; - } + TRY(System::pledge("stdio rpath recvfd sendfd", nullptr)); - if (unveil("/res", "r") < 0) { - perror("unveil"); - return 1; - } - - if (unveil(nullptr, nullptr) < 0) { - perror("unveil"); - return 1; - } + TRY(System::unveil("/res", "r")); + TRY(System::unveil(nullptr, nullptr)); size_t board_size = Config::read_i32("2048", "", "board_size", 4); u32 target_tile = Config::read_i32("2048", "", "target_tile", 2048);