/* * Copyright (c) 2022, Jelle Raaijmakers * * SPDX-License-Identifier: BSD-2-Clause */ #include #include #include #include #include #include ErrorOr serenity_main(Main::Arguments arguments) { TRY(Core::System::pledge("stdio recvfd sendfd rpath unix prot_exec map_fixed")); unsigned refresh_rate = 12; Core::ArgsParser args_parser; args_parser.set_general_help("Screensaver rendering colorful moving tubes using LibGL"); args_parser.add_option(refresh_rate, "Refresh rate", "rate", 'r', "milliseconds"); args_parser.parse(arguments); auto app = TRY(GUI::Application::create(arguments)); TRY(Core::System::pledge("stdio recvfd sendfd rpath prot_exec map_fixed")); auto window = TRY(Desktop::Screensaver::create_window("Tubes"sv, "app-tubes"sv)); window->update(); auto tubes_widget = TRY(window->set_main_widget(refresh_rate)); tubes_widget->set_fill_with_background_color(false); tubes_widget->set_override_cursor(Gfx::StandardCursor::Hidden); window->show(); TRY(tubes_widget->create_buffer(window->size())); tubes_widget->setup_view(); tubes_widget->reset_tubes(); window->move_to_front(); window->set_cursor(Gfx::StandardCursor::Hidden); return app->exec(); }