- moved stats.cpp to common.

This commit is contained in:
Christoph Oelckers 2020-04-11 19:43:17 +02:00
parent fa99fc5346
commit 932f5c64c2
9 changed files with 39 additions and 14 deletions

View file

@ -1131,6 +1131,7 @@ set (PCH_SOURCES
common/filesystem/file_whres.cpp
common/filesystem/file_directory.cpp
common/filesystem/resourcefile.cpp
common/engine/stats.cpp
common/engine/sc_man.cpp
common/engine/palettecontainer.cpp
common/engine/stringtable.cpp
@ -1165,7 +1166,6 @@ set (PCH_SOURCES
utility/nodebuilder/nodebuild_extract.cpp
utility/nodebuilder/nodebuild_gl.cpp
utility/nodebuilder/nodebuild_utility.cpp
utility/stats.cpp
utility/m_bbox.cpp
utility/v_collection.cpp
)

View file

@ -32,11 +32,13 @@
**
*/
#include "doomtype.h"
#include "stats.h"
#include "v_video.h"
#include "v_text.h"
#include "v_font.h"
#include "c_console.h"
#include "c_dispatch.h"
#include "printf.h"
FStat *FStat::FirstStat;
@ -114,7 +116,7 @@ void FStat::PrintStat ()
// Count number of linefeeds but ignore terminating ones.
if (stattext[i] == '\n') y -= fontheight;
}
screen->DrawText(NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext,
DrawText(twod, NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext,
DTA_VirtualWidth, screen->GetWidth() / textScale,
DTA_VirtualHeight, screen->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);

View file

@ -206,25 +206,25 @@ public:
{
if (scale == 1)
{
screen->DrawChar(CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', TAG_DONE);
screen->DrawText(CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c', TAG_DONE);
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
&Text[StartPos], TAG_DONE);
if (cursor)
{
screen->DrawChar(CurrentConsoleFont, CR_YELLOW,
DrawChar(twod, CurrentConsoleFont, CR_YELLOW,
x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb),
y, '\xb', TAG_DONE);
}
}
else
{
screen->DrawChar(CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DrawChar(twod, CurrentConsoleFont, CR_ORANGE, x, y, '\x1c',
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
DTA_KeepRatio, true, TAG_DONE);
screen->DrawText(CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
DrawText(twod, CurrentConsoleFont, CR_ORANGE, x + CurrentConsoleFont->GetCharWidth(0x1c), y,
&Text[StartPos],
DTA_VirtualWidth, screen->GetWidth() / scale,
DTA_VirtualHeight, screen->GetHeight() / scale,
@ -232,7 +232,7 @@ public:
if (cursor)
{
screen->DrawChar(CurrentConsoleFont, CR_YELLOW,
DrawChar(twod, CurrentConsoleFont, CR_YELLOW,
x + CurrentConsoleFont->GetCharWidth(0x1c) + (CursorPosCells - StartPosCells) * CurrentConsoleFont->GetCharWidth(0xb),
y, '\xb',
DTA_VirtualWidth, screen->GetWidth() / scale,

View file

@ -34,6 +34,8 @@
#include "vm.h"
#include "c_buttons.h"
F2DDrawer* twod;
EXTERN_CVAR(Float, transsouls)
IMPLEMENT_CLASS(DShape2DTransform, false, false)

View file

@ -173,5 +173,10 @@ public:
bool mIsFirstPass = true;
};
extern F2DDrawer* twod;
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...);
void DrawText(F2DDrawer* twod, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...);
void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...);
void DrawTexture(F2DDrawer* drawer, FTexture* img, double x, double y, int tags_first, ...);
#endif

View file

@ -433,6 +433,25 @@ void DFrameBuffer::DrawText(FFont *font, int normalcolor, double x, double y, co
DrawTextCommon(font, normalcolor, x, y, string, parms);
}
void DrawText(F2DDrawer *twod, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...)
{
Va_List tags;
DrawParms parms;
if (font == NULL || string == NULL)
return;
va_start(tags.list, tag_first);
bool res = screen->ParseDrawTextureTags(nullptr, 0, 0, tag_first, tags, &parms, true);
va_end(tags.list);
if (!res)
{
return;
}
screen->DrawTextCommon(font, normalcolor, x, y, string, parms);
}
void DFrameBuffer::DrawText(FFont *font, int normalcolor, double x, double y, const char *string, VMVa_List &args)
{
DrawParms parms;

View file

@ -357,6 +357,7 @@ class FTexture;
class DFrameBuffer
{
friend void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...);
friend void DrawText(F2DDrawer* twod, FFont* font, int normalcolor, double x, double y, const char32_t* string, int tag_first, ...);
friend void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...);
friend void DrawTexture(F2DDrawer* drawer, FTexture* img, double x, double y, int tags_first, ...);
protected:
@ -681,8 +682,4 @@ public:
};
void DrawText(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, const char* string, int tag_first, ...);
void DrawChar(F2DDrawer* drawer, FFont* font, int normalcolor, double x, double y, int character, int tag_first, ...);
void DrawTexture(F2DDrawer* drawer, FTexture* img, double x, double y, int tags_first, ...);
#endif // __V_VIDEO_H__

View file

@ -29,7 +29,7 @@
#include "actor.h"
#include "i_time.h"
#include "g_game.h"
#include "gamedata/fonts/v_text.h"
#include "v_text.h"
#include "hwrenderer/utility/hw_clock.h"
#include "hwrenderer/utility/hw_vrmodes.h"