diff options
author | one-some <onesome01@protonmail.com> | 2021-02-28 22:59:21 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-03 11:03:34 +0100 |
commit | f99644e75b67129b319c19f7c449ec16989f85fd (patch) | |
tree | 9651bb3bcb6c86da061cb6da687f088d47a66108 | |
parent | add94aebfa890f6ee6610c00e16075824eb070bd (diff) | |
download | serenity-f99644e75b67129b319c19f7c449ec16989f85fd.zip |
Cube: Add an argument for the "frameless cube" option
-rw-r--r-- | Userland/Demos/Cube/Cube.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Demos/Cube/Cube.cpp b/Userland/Demos/Cube/Cube.cpp index 2c0af6cec2..6e0fb1e8b5 100644 --- a/Userland/Demos/Cube/Cube.cpp +++ b/Userland/Demos/Cube/Cube.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <LibCore/ArgsParser.h> #include <LibCore/ElapsedTimer.h> #include <LibGUI/Application.h> #include <LibGUI/Icon.h> @@ -44,6 +45,8 @@ const int WIDTH = 200; const int HEIGHT = 200; +static bool flag_hide_window_frame = false; + class Cube final : public GUI::Widget { C_OBJECT(Cube) public: @@ -238,6 +241,11 @@ int main(int argc, char** argv) return 1; } + Core::ArgsParser parser; + parser.set_general_help("Create a window with a spinning cube."); + parser.add_option(flag_hide_window_frame, "Hide window frame", "hide-window", 'h'); + parser.parse(argc, argv); + auto window = GUI::Window::construct(); window->set_double_buffering_enabled(true); window->set_title("Cube"); @@ -261,6 +269,8 @@ int main(int argc, char** argv) auto show_window_frame_action = GUI::Action::create_checkable("Show window frame", [&](auto& action) { cube.set_show_window_frame(action.is_checked()); }); + + cube.set_show_window_frame(!flag_hide_window_frame); show_window_frame_action->set_checked(cube.show_window_frame()); app_menu.add_action(move(show_window_frame_action)); app_menu.add_separator(); |