Optimize param use.

This commit is contained in:
halx99 2020-08-02 16:48:19 +08:00
parent a624babd09
commit 99432aa171
2 changed files with 8 additions and 7 deletions

View File

@ -681,13 +681,14 @@ void GLViewImpl::setFullscreen(int monitorIndex, int w, int h, int refreshRate)
void GLViewImpl::setFullscreen(GLFWmonitor *monitor, int w, int h, int refreshRate) { void GLViewImpl::setFullscreen(GLFWmonitor *monitor, int w, int h, int refreshRate) {
_monitor = monitor; _monitor = monitor;
if (w == -1 || h == -1 || refreshRate == -1) const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor);
{
const GLFWvidmode* videoMode = glfwGetVideoMode(_monitor); if (w == -1)
w = videoMode->width; w = videoMode->width;
if (h == -1)
h = videoMode->height; h = videoMode->height;
if (refreshRate == -1)
refreshRate = videoMode->refreshRate; refreshRate = videoMode->refreshRate;
}
glfwSetWindowMonitor(_mainWindow, _monitor, 0, 0, w, h, refreshRate); glfwSetWindowMonitor(_mainWindow, _monitor, 0, 0, w, h, refreshRate);

View File

@ -94,9 +94,9 @@ public:
/// Sets monitor full screen with w*h(refresh rate) /// Sets monitor full screen with w*h(refresh rate)
/// </summary> /// </summary>
/// <param name="monitorIndex">the 0 based index of monitor</param> /// <param name="monitorIndex">the 0 based index of monitor</param>
/// <param name="w">the width of hardware resolution in full screen</param> /// <param name="w">the width of hardware resolution in full screen, -1 use default value</param>
/// <param name="h">the height of hardware resolution in full screen</param> /// <param name="h">the height of hardware resolution in full screen, -1 use default value</param>
/// <param name="refreshRate">the display refresh rate, usually 60</param> /// <param name="refreshRate">the display refresh rate, usually 60, -1 use default value</param>
void setFullscreen(int monitorIndex, int w, int h, int refreshRate); void setFullscreen(int monitorIndex, int w, int h, int refreshRate);
/* for internal use */ /* for internal use */