mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 04:07:44 +00:00
FlappyBug: Port to LibMain
Simplified two pledge() and two unveil() by using TRY().
This commit is contained in:
parent
ca7b603578
commit
85ae298b85
2 changed files with 9 additions and 21 deletions
|
@ -12,33 +12,21 @@
|
|||
#include <LibGUI/Menubar.h>
|
||||
#include <LibGUI/MessageBox.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <unistd.h>
|
||||
#include <LibMain/Main.h>
|
||||
#include <LibSystem/Wrappers.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
ErrorOr<int> 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));
|
||||
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||
|
||||
Config::pledge_domains("FlappyBug");
|
||||
|
||||
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));
|
||||
|
||||
u32 high_score = Config::read_i32("FlappyBug", "Game", "HighScore", 0);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue