mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 09:37:34 +00:00
Breakout: Port to LibMain
Simplified two pledge() and two unveil() by using TRY().
This commit is contained in:
parent
8fa5dc7241
commit
6e6228d40d
2 changed files with 9 additions and 21 deletions
|
@ -11,4 +11,4 @@ set(SOURCES
|
||||||
)
|
)
|
||||||
|
|
||||||
serenity_app(Breakout ICON app-breakout)
|
serenity_app(Breakout ICON app-breakout)
|
||||||
target_link_libraries(Breakout LibGUI)
|
target_link_libraries(Breakout LibGUI LibMain)
|
||||||
|
|
|
@ -11,31 +11,19 @@
|
||||||
#include <LibGUI/Menubar.h>
|
#include <LibGUI/Menubar.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.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 recvfd sendfd rpath unix", nullptr) < 0) {
|
TRY(System::pledge("stdio recvfd sendfd rpath unix", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto app = GUI::Application::construct(argc, argv);
|
auto app = GUI::Application::construct(arguments.argc, arguments.argv);
|
||||||
|
|
||||||
if (pledge("stdio recvfd sendfd rpath", nullptr) < 0) {
|
TRY(System::pledge("stdio recvfd sendfd rpath", nullptr));
|
||||||
perror("pledge");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil("/res", "r") < 0) {
|
TRY(System::unveil("/res", "r"));
|
||||||
perror("unveil");
|
TRY(System::unveil(nullptr, nullptr));
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto window = GUI::Window::construct();
|
auto window = GUI::Window::construct();
|
||||||
window->resize(Breakout::Game::game_width, Breakout::Game::game_height);
|
window->resize(Breakout::Game::game_width, Breakout::Game::game_height);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue