mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- Moved high level parts of view border drawing to status bar.
This commit is contained in:
parent
86acb876f1
commit
848d9c3750
7 changed files with 70 additions and 66 deletions
|
@ -760,15 +760,15 @@ void D_Display ()
|
|||
{
|
||||
AM_Drawer (hud_althud? viewheight : StatusBar->GetTopOfStatusbar());
|
||||
}
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
screen->RefreshViewBorder ();
|
||||
}
|
||||
|
||||
// for timing the statusbar code.
|
||||
//cycle_t stb;
|
||||
//stb.Reset();
|
||||
//stb.Clock();
|
||||
if (!automapactive || viewactive)
|
||||
{
|
||||
StatusBar->RefreshViewBorder ();
|
||||
}
|
||||
if (hud_althud && viewheight == SCREENHEIGHT && screenblocks > 10)
|
||||
{
|
||||
StatusBar->DrawBottomStuff (HUD_AltHud);
|
||||
|
|
12
src/dobjgc.h
12
src/dobjgc.h
|
@ -183,7 +183,7 @@ public:
|
|||
T operator=(std::nullptr_t nul)
|
||||
{
|
||||
o = nullptr;
|
||||
return nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// To allow NULL, too.
|
||||
|
@ -191,7 +191,15 @@ public:
|
|||
{
|
||||
assert(val == 0);
|
||||
o = nullptr;
|
||||
return nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// To allow NULL, too. In Clang NULL is a long.
|
||||
T operator=(const long val)
|
||||
{
|
||||
assert(val == 0);
|
||||
o = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
operator T() throw()
|
||||
|
|
|
@ -453,6 +453,7 @@ public:
|
|||
|
||||
|
||||
void RefreshBackground () const;
|
||||
void RefreshViewBorder ();
|
||||
|
||||
private:
|
||||
DObject *AltHud = nullptr;
|
||||
|
|
|
@ -774,6 +774,49 @@ void DBaseStatusBar::ShowPlayerName ()
|
|||
1.5f, 0.92f, 0, 0, color, 2.f, 0.35f), MAKE_ID('P','N','A','M'));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
//
|
||||
//
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
static FTextureID GetBorderTexture(FLevelLocals *Level)
|
||||
{
|
||||
if (Level != nullptr && Level->info != nullptr && Level->info->BorderTexture.Len() != 0)
|
||||
{
|
||||
auto picnum = TexMan.CheckForTexture (Level->info->BorderTexture, ETextureType::Flat);
|
||||
if (picnum.isValid()) return picnum;
|
||||
}
|
||||
return TexMan.CheckForTexture (gameinfo.BorderFlat, ETextureType::Flat);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_RefreshViewBorder
|
||||
//
|
||||
// Draws the border around the player view, if needed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DBaseStatusBar::RefreshViewBorder ()
|
||||
{
|
||||
if (setblocks < 10)
|
||||
{
|
||||
int Width = screen->GetWidth();
|
||||
if (viewwidth == Width)
|
||||
{
|
||||
return;
|
||||
}
|
||||
auto tex = GetBorderTexture(&level);
|
||||
screen->DrawBorder (tex, 0, 0, Width, viewwindowy);
|
||||
screen->DrawBorder (tex, 0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
screen->DrawBorder (tex, viewwindowx + viewwidth, viewwindowy, Width, viewheight + viewwindowy);
|
||||
screen->DrawBorder (tex, 0, viewwindowy + viewheight, Width, StatusBar->GetTopOfStatusbar());
|
||||
|
||||
screen->DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//
|
||||
// RefreshBackground
|
||||
|
@ -788,12 +831,16 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
x = ST_X;
|
||||
y = SBarTop;
|
||||
|
||||
if (x == 0 && y == SCREENHEIGHT) return;
|
||||
|
||||
auto tex = GetBorderTexture(&level);
|
||||
|
||||
if(!CompleteBorder)
|
||||
{
|
||||
if(y < SCREENHEIGHT)
|
||||
{
|
||||
screen->DrawBorder (x+1, y, SCREENWIDTH, y+1);
|
||||
screen->DrawBorder (x+1, SCREENHEIGHT-1, SCREENWIDTH, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, x+1, y, SCREENWIDTH, y+1);
|
||||
screen->DrawBorder (tex, x+1, SCREENHEIGHT-1, SCREENWIDTH, SCREENHEIGHT);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -812,8 +859,8 @@ void DBaseStatusBar::RefreshBackground () const
|
|||
x2 = SCREENWIDTH;
|
||||
}
|
||||
|
||||
screen->DrawBorder (0, y, x+1, SCREENHEIGHT);
|
||||
screen->DrawBorder (x2-1, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, 0, y, x+1, SCREENHEIGHT);
|
||||
screen->DrawBorder (tex, x2-1, y, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
if (setblocks >= 10)
|
||||
{
|
||||
|
|
|
@ -254,7 +254,7 @@ sector_t *FGLRenderer::RenderView(player_t* player)
|
|||
bool saved_niv = NoInterpolateView;
|
||||
NoInterpolateView = false;
|
||||
// prepare all camera textures that have been used in the last frame
|
||||
auto Level = player->mo->__GetLevel();
|
||||
auto Level = &level;
|
||||
gl_RenderState.CheckTimer(Level->ShaderStartTime);
|
||||
Level->canvasTextureInfo.UpdateAll([&](AActor *camera, FCanvasTexture *camtex, double fov)
|
||||
{
|
||||
|
|
|
@ -1339,19 +1339,8 @@ DEFINE_ACTION_FUNCTION(_Screen, DrawFrame)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawBorder (int x1, int y1, int x2, int y2)
|
||||
void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
FTextureID picnum;
|
||||
|
||||
if (level.info != NULL && level.info->BorderTexture.Len() != 0)
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (level.info->BorderTexture, ETextureType::Flat);
|
||||
}
|
||||
else
|
||||
{
|
||||
picnum = TexMan.CheckForTexture (gameinfo.BorderFlat, ETextureType::Flat);
|
||||
}
|
||||
|
||||
if (picnum.isValid())
|
||||
{
|
||||
FlatFill (x1, y1, x2, y2, TexMan.GetTexture(picnum, false));
|
||||
|
@ -1362,46 +1351,7 @@ void DFrameBuffer::DrawBorder (int x1, int y1, int x2, int y2)
|
|||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_DrawViewBorder
|
||||
//
|
||||
// Draws the border around the view for different size windows
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::DrawViewBorder (void)
|
||||
{
|
||||
if (viewwidth == Width)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DrawBorder (0, 0, Width, viewwindowy);
|
||||
DrawBorder (0, viewwindowy, viewwindowx, viewheight + viewwindowy);
|
||||
DrawBorder (viewwindowx + viewwidth, viewwindowy, Width, viewheight + viewwindowy);
|
||||
DrawBorder (0, viewwindowy + viewheight, Width, StatusBar->GetTopOfStatusbar());
|
||||
|
||||
DrawFrame (viewwindowx, viewwindowy, viewwidth, viewheight);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// R_RefreshViewBorder
|
||||
//
|
||||
// Draws the border around the player view, if needed.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void DFrameBuffer::RefreshViewBorder ()
|
||||
{
|
||||
if (setblocks < 10)
|
||||
{
|
||||
DrawViewBorder();
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
///==========================================================================
|
||||
//
|
||||
// Draws a blend over the entire view
|
||||
//
|
||||
|
|
|
@ -538,9 +538,7 @@ public:
|
|||
void DrawChar(FFont *font, int normalcolor, double x, double y, int character, VMVa_List &args);
|
||||
|
||||
void DrawFrame(int left, int top, int width, int height);
|
||||
void DrawBorder(int x1, int y1, int x2, int y2);
|
||||
void DrawViewBorder();
|
||||
void RefreshViewBorder();
|
||||
void DrawBorder(FTextureID, int x1, int y1, int x2, int y2);
|
||||
|
||||
// Calculate gamma table
|
||||
void CalcGamma(float gamma, uint8_t gammalookup[256]);
|
||||
|
|
Loading…
Reference in a new issue