Window size as arguments (Fixes #270)

This commit is contained in:
saschawillems 2017-01-22 12:29:27 +01:00
parent 8d3fe738c3
commit 792d8347be
5 changed files with 16 additions and 12 deletions

View file

@ -565,16 +565,28 @@ void VulkanExampleBase::submitFrame()
VulkanExampleBase::VulkanExampleBase(bool enableValidation) VulkanExampleBase::VulkanExampleBase(bool enableValidation)
{ {
// Parse command line arguments // Parse command line arguments
for (auto arg : args) for (size_t i = 0; i < args.size(); i++)
{ {
if (arg == std::string("-validation")) if (args[i] == std::string("-validation"))
{ {
this->enableValidation = true; this->enableValidation = true;
} }
if (arg == std::string("-vsync")) if (args[i] == std::string("-vsync"))
{ {
enableVSync = true; enableVSync = true;
} }
if ((args[i] == std::string("-w")) || (args[i] == std::string("-width")))
{
char* endptr;
uint32_t w = strtol(args[i + 1], &endptr, 10);
if (endptr != args[i + 1]) { width = w; };
}
if ((args[i] == std::string("-h")) || (args[i] == std::string("-height")))
{
char* endptr;
uint32_t h = strtol(args[i + 1], &endptr, 10);
if (endptr != args[i + 1]) { height = h; };
}
} }
#if defined(__ANDROID__) #if defined(__ANDROID__)
// Vulkan library is loaded dynamically on Android // Vulkan library is loaded dynamically on Android
@ -591,7 +603,7 @@ VulkanExampleBase::VulkanExampleBase(bool enableValidation)
// Debug message callback will output to it // Debug message callback will output to it
if (this->enableValidation) if (this->enableValidation)
{ {
setupConsole("VulkanExample"); setupConsole("Vulkan validation output");
} }
#endif #endif
} }

View file

@ -91,8 +91,6 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
width = 1280;
height = 720;
zoom = -35.0f; zoom = -35.0f;
zoomSpeed = 2.5f; zoomSpeed = 2.5f;
rotationSpeed = 0.5f; rotationSpeed = 0.5f;

View file

@ -68,8 +68,6 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
width = 1280;
height = 720;
zoom = -30.0; zoom = -30.0;
zoomSpeed = 2.5f; zoomSpeed = 2.5f;
rotationSpeed = 0.5f; rotationSpeed = 0.5f;

View file

@ -114,8 +114,6 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
width = 1280;
height = 720;
zoom = -2.5f; zoom = -2.5f;
title = "Vulkan Example - Basic indexed triangle"; title = "Vulkan Example - Basic indexed triangle";
// Values not set here are initialized in the base class constructor // Values not set here are initialized in the base class constructor

View file

@ -93,8 +93,6 @@ public:
VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION) VulkanExample() : VulkanExampleBase(ENABLE_VALIDATION)
{ {
width = 1280;
height = 720;
zoom = -3.75f; zoom = -3.75f;
rotationSpeed = 0.5f; rotationSpeed = 0.5f;
rotation = glm::vec3(15.0f, 0.f, 0.0f); rotation = glm::vec3(15.0f, 0.f, 0.0f);