Mercurial > hg > orthanc-stone
comparison Applications/Sdl/BasicSdlApplication.cpp @ 279:8f5d7495076d am-2
SimpleViewer sample working in SDL, Qt and WASM
author | am@osimis.io |
---|---|
date | Mon, 27 Aug 2018 15:40:13 +0200 |
parents | 5de5699ad570 |
children | 017044be141b |
comparison
equal
deleted
inserted
replaced
278:8a86695fcbc3 | 279:8f5d7495076d |
---|---|
59 if (!parameters.count("width") || | 59 if (!parameters.count("width") || |
60 !parameters.count("height") || | 60 !parameters.count("height") || |
61 !parameters.count("opengl")) | 61 !parameters.count("opengl")) |
62 { | 62 { |
63 LOG(ERROR) << "Parameter \"width\", \"height\" or \"opengl\" is missing"; | 63 LOG(ERROR) << "Parameter \"width\", \"height\" or \"opengl\" is missing"; |
64 return -1; | 64 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
65 } | 65 } |
66 | 66 |
67 int w = parameters["width"].as<int>(); | 67 int w = parameters["width"].as<int>(); |
68 int h = parameters["height"].as<int>(); | 68 int h = parameters["height"].as<int>(); |
69 if (w <= 0 || h <= 0) | 69 if (w <= 0 || h <= 0) |
70 { | 70 { |
71 LOG(ERROR) << "Parameters \"width\" and \"height\" must be positive"; | 71 LOG(ERROR) << "Parameters \"width\" and \"height\" must be positive"; |
72 return -1; | 72 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
73 } | 73 } |
74 | 74 |
75 width_ = static_cast<unsigned int>(w); | 75 width_ = static_cast<unsigned int>(w); |
76 height_ = static_cast<unsigned int>(h); | 76 height_ = static_cast<unsigned int>(h); |
77 LOG(WARNING) << "Initial display size: " << width_ << "x" << height_; | 77 LOG(WARNING) << "Initial display size: " << width_ << "x" << height_; |
78 | 78 |
79 opengl_ = parameters["opengl"].as<bool>(); | 79 enableOpenGl_ = parameters["opengl"].as<bool>(); |
80 if (opengl_) | 80 if (enableOpenGl_) |
81 { | 81 { |
82 LOG(WARNING) << "OpenGL is enabled, disable it with option \"--opengl=off\" if the application crashes"; | 82 LOG(WARNING) << "OpenGL is enabled, disable it with option \"--opengl=off\" if the application crashes"; |
83 } | 83 } |
84 else | 84 else |
85 { | 85 { |