mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-15 06:41:27 +00:00
78 lines
1.8 KiB
C++
78 lines
1.8 KiB
C++
|
//
|
||
|
//---------------------------------------------------------------------------
|
||
|
//
|
||
|
// Copyright(C) 2017 Magnus Norddahl
|
||
|
// Copyright(C) 2017 Rachael Alexanderson
|
||
|
// All rights reserved.
|
||
|
//
|
||
|
// This program is free software: you can redistribute it and/or modify
|
||
|
// it under the terms of the GNU Lesser General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
|
// This program is distributed in the hope that it will be useful,
|
||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
// GNU Lesser General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU Lesser General Public License
|
||
|
// along with this program. If not, see http://www.gnu.org/licenses/
|
||
|
//
|
||
|
//--------------------------------------------------------------------------
|
||
|
//
|
||
|
|
||
|
#include "c_dispatch.h"
|
||
|
#include "c_cvars.h"
|
||
|
|
||
|
CUSTOM_CVAR (Int, vid_scalemode, 0, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||
|
{
|
||
|
if (self < 0 || self > 5)
|
||
|
{
|
||
|
self = 0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool ViewportLinearScale()
|
||
|
{
|
||
|
return vid_scalemode == 4 || vid_scalemode == 5;
|
||
|
}
|
||
|
|
||
|
int ViewportScaledWidth(int width)
|
||
|
{
|
||
|
switch (vid_scalemode)
|
||
|
{
|
||
|
default:
|
||
|
case 0: return width;
|
||
|
case 1: return 320;
|
||
|
case 2: return 640;
|
||
|
case 3: return (int)roundf(width * 0.5f);
|
||
|
case 4: return (int)roundf(width * 0.75f);
|
||
|
case 5: return width * 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
int ViewportScaledHeight(int height)
|
||
|
{
|
||
|
switch (vid_scalemode)
|
||
|
{
|
||
|
default:
|
||
|
case 0: return height;
|
||
|
case 1: return 200;
|
||
|
case 2: return 400;
|
||
|
case 3: return (int)roundf(height * 0.5f);
|
||
|
case 4: return (int)roundf(height * 0.75f);
|
||
|
case 5: return height * 2;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool ViewportIsScaled43()
|
||
|
{
|
||
|
switch (vid_scalemode)
|
||
|
{
|
||
|
default: return false;
|
||
|
case 1:
|
||
|
case 2: return true;
|
||
|
}
|
||
|
}
|
||
|
|