aboutsummaryrefslogtreecommitdiff
path: root/cube/cube.cpp
diff options
context:
space:
mode:
authorNicolas Caramelli <caramelli.devel@gmail.com>2021-01-08 17:46:07 +0100
committerTony-LunarG <tony@lunarg.com>2021-01-15 15:31:28 -0700
commit7c25ce965b92d789bdc767422f2a4410c71653bb (patch)
treed502f31fbba586ddeac734d4b7473d06a95f2453 /cube/cube.cpp
parent93a6c58d76e1da0383242a4043c40e5020573890 (diff)
downloadusermoji-7c25ce965b92d789bdc767422f2a4410c71653bb.tar.xz
vkcube: Add options --width and --height to specify width and height
Change-Id: Ie2533ad22e4bf9672f749138baddc0313169d09b
Diffstat (limited to 'cube/cube.cpp')
-rw-r--r--cube/cube.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/cube/cube.cpp b/cube/cube.cpp
index 8efea2a2..69da9a9f 100644
--- a/cube/cube.cpp
+++ b/cube/cube.cpp
@@ -939,6 +939,8 @@ void Demo::init(int argc, char **argv) {
presentMode = vk::PresentModeKHR::eFifo;
frameCount = UINT32_MAX;
+ width = 500;
+ height = 500;
use_xlib = false;
/* Autodetect suitable / best GPU by default */
gpu_number = -1;
@@ -970,6 +972,14 @@ void Demo::init(int argc, char **argv) {
i++;
continue;
}
+ if (strcmp(argv[i], "--width") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &width) == 1 && width > 0) {
+ i++;
+ continue;
+ }
+ if (strcmp(argv[i], "--height") == 0 && i < argc - 1 && sscanf(argv[i + 1], "%" SCNu32, &height) == 1 && height > 0) {
+ i++;
+ continue;
+ }
if (strcmp(argv[i], "--suppress_popups") == 0) {
suppress_popups = true;
continue;
@@ -985,6 +995,7 @@ void Demo::init(int argc, char **argv) {
<< "\t[--break] [--c <framecount>] [--suppress_popups]\n"
<< "\t[--gpu_number <index of physical device>]\n"
<< "\t[--present_mode <present mode enum>]\n"
+ << "\t[--width <width>] [--height <height>]\n"
<< "\t<present_mode_enum>\n"
<< "\t\tVK_PRESENT_MODE_IMMEDIATE_KHR = " << VK_PRESENT_MODE_IMMEDIATE_KHR << "\n"
<< "\t\tVK_PRESENT_MODE_MAILBOX_KHR = " << VK_PRESENT_MODE_MAILBOX_KHR << "\n"
@@ -1006,9 +1017,6 @@ void Demo::init(int argc, char **argv) {
init_vk();
- width = 500;
- height = 500;
-
spin_angle = 4.0f;
spin_increment = 0.2f;
pause = false;