mirror of
https://github.com/ZDoom/Raze.git
synced 2025-03-13 20:42:11 +00:00
- backend update.
This commit is contained in:
parent
ebe936f03f
commit
e0b2497a56
4 changed files with 42 additions and 10 deletions
|
@ -1384,3 +1384,9 @@ void DrawFrame(F2DDrawer* twod, PalEntry color, int left, int top, int width, in
|
|||
twod->AddColorOnlyQuad(right, top - offset, offset, height + 2 * offset, color);
|
||||
}
|
||||
|
||||
void V_CalcCleanFacs(int designwidth, int designheight, int realwidth, int realheight, int* cleanx, int* cleany, int* _cx1, int* _cx2)
|
||||
{
|
||||
if (designheight < 240 && realheight >= 480) designheight = 240;
|
||||
*cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
|
||||
}
|
||||
|
||||
|
|
|
@ -233,3 +233,39 @@ void VirtualToRealCoordsInt(F2DDrawer* drawer, int& x, int& y, int& w, int& h, i
|
|||
|
||||
extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac;
|
||||
extern int CleanWidth_1, CleanHeight_1, CleanXfac_1, CleanYfac_1;
|
||||
|
||||
void V_CalcCleanFacs(int designwidth, int designheight, int realwidth, int realheight, int* cleanx, int* cleany, int* cx1 = NULL, int* cx2 = NULL);
|
||||
|
||||
class ScaleOverrider
|
||||
{
|
||||
int savedxfac, savedyfac, savedwidth, savedheight;
|
||||
|
||||
public:
|
||||
// This is to allow certain elements to use an optimal fullscreen scale which for the menu would be too large.
|
||||
// The old code contained far too much mess to compensate for the menus which negatively affected everything else.
|
||||
// However, for compatibility reasons the currently used variables cannot be changed so they have to be overridden temporarily.
|
||||
// This class provides a safe interface for this because it ensures that the values get restored afterward.
|
||||
// Currently, the intermission and the level summary screen use this.
|
||||
ScaleOverrider(F2DDrawer *drawer)
|
||||
{
|
||||
savedxfac = CleanXfac;
|
||||
savedyfac = CleanYfac;
|
||||
savedwidth = CleanWidth;
|
||||
savedheight = CleanHeight;
|
||||
|
||||
if (drawer)
|
||||
{
|
||||
V_CalcCleanFacs(320, 200, drawer->GetWidth(), drawer->GetHeight(), &CleanXfac, &CleanYfac);
|
||||
CleanWidth = drawer->GetWidth() / CleanXfac;
|
||||
CleanHeight = drawer->GetHeight() / CleanYfac;
|
||||
}
|
||||
}
|
||||
|
||||
~ScaleOverrider()
|
||||
{
|
||||
CleanXfac = savedxfac;
|
||||
CleanYfac = savedyfac;
|
||||
CleanWidth = savedwidth;
|
||||
CleanHeight = savedheight;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -298,12 +298,6 @@ void V_OutputResized (int width, int height)
|
|||
C_NewModeAdjust();
|
||||
}
|
||||
|
||||
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *_cx1, int *_cx2)
|
||||
{
|
||||
if (designheight < 240 && realheight >= 480) designheight = 240;
|
||||
*cleanx = *cleany = std::min(realwidth / designwidth, realheight / designheight);
|
||||
}
|
||||
|
||||
bool IVideo::SetResolution ()
|
||||
{
|
||||
DFrameBuffer *buff = CreateFrameBuffer();
|
||||
|
|
|
@ -38,9 +38,6 @@
|
|||
#include "basics.h"
|
||||
#include "vectors.h"
|
||||
#include "m_png.h"
|
||||
|
||||
//#include "doomdef.h"
|
||||
//#include "dobject.h"
|
||||
#include "renderstyle.h"
|
||||
#include "c_cvars.h"
|
||||
#include "v_2ddrawer.h"
|
||||
|
@ -118,7 +115,6 @@ extern int DisplayWidth, DisplayHeight;
|
|||
|
||||
void V_UpdateModeSize (int width, int height);
|
||||
void V_OutputResized (int width, int height);
|
||||
void V_CalcCleanFacs (int designwidth, int designheight, int realwidth, int realheight, int *cleanx, int *cleany, int *cx1=NULL, int *cx2=NULL);
|
||||
|
||||
EXTERN_CVAR(Int, vid_rendermode)
|
||||
EXTERN_CVAR(Bool, vid_fullscreen)
|
||||
|
|
Loading…
Reference in a new issue