MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-Samples / handle_option

Method handle_option

app/plugins/window_options/window_options.cpp:43–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43bool WindowOptions::handle_option(std::deque<std::string> &arguments)
44{
45 assert(!arguments.empty() && (arguments[0].substr(0, 2) == "--"));
46 std::string option = arguments[0].substr(2);
47
48 vkb::Window::OptionalProperties properties;
49 if (option == "borderless")
50 {
51 properties.mode = vkb::Window::Mode::FullscreenBorderless;
52 platform->set_window_properties(properties);
53
54 arguments.pop_front();
55 return true;
56 }
57 else if (option == "fullscreen")
58 {
59 properties.mode = vkb::Window::Mode::Fullscreen;
60 platform->set_window_properties(properties);
61
62 arguments.pop_front();
63 return true;
64 }
65 else if (option == "headless-surface")
66 {
67 properties.mode = vkb::Window::Mode::Headless;
68 platform->set_window_properties(properties);
69
70 arguments.pop_front();
71 return true;
72 }
73 else if (option == "height")
74 {
75 if (arguments.size() < 2)
76 {
77 LOGE("Option \"height\" is missing the actual height!");
78 return false;
79 }
80 uint32_t height = static_cast<uint32_t>(std::stoul(arguments[1]));
81 if (height < platform->MIN_WINDOW_HEIGHT)
82 {
83 LOGD("[Window Options] {} is smaller than the minimum height {}, resorting to minimum height", height, platform->MIN_WINDOW_HEIGHT);
84 height = platform->MIN_WINDOW_HEIGHT;
85 }
86 properties.extent.height = height;
87 platform->set_window_properties(properties);
88
89 arguments.pop_front();
90 arguments.pop_front();
91 return true;
92 }
93 else if (option == "stretch")
94 {
95 properties.mode = vkb::Window::Mode::FullscreenStretch;
96 platform->set_window_properties(properties);
97
98 arguments.pop_front();
99 return true;
100 }

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
set_window_propertiesMethod · 0.80
sizeMethod · 0.80
endMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected