From 53a6b9ee593f3a1f638688b660318a43008413c9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Oct 2020 15:02:23 +0100 Subject: [PATCH] - moved status bar base class to 'common'. --- src/CMakeLists.txt | 4 +++- src/common/scripting/interface/vmnatives.cpp | 4 ++-- src/{g_statusbar => common/statusbar}/base_sbar.cpp | 2 +- src/{g_statusbar => common/statusbar}/base_sbar.h | 9 +++++++-- 4 files changed, 13 insertions(+), 6 deletions(-) rename src/{g_statusbar => common/statusbar}/base_sbar.cpp (99%) rename src/{g_statusbar => common/statusbar}/base_sbar.h (95%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 650529989..79bb46b8f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -588,6 +588,7 @@ file( GLOB HEADER_FILES common/utility/*.h common/engine/*.h common/menu/*.h + common/statusbar/*.h common/fonts/*.h common/objects/*.h common/filesystem/*.h @@ -905,7 +906,6 @@ set (PCH_SOURCES g_statusbar/sbarinfo.cpp g_statusbar/sbar_mugshot.cpp g_statusbar/shared_sbar.cpp - g_statusbar/base_sbar.cpp rendering/2d/f_wipe.cpp rendering/2d/v_blend.cpp rendering/hwrenderer/hw_entrypoint.cpp @@ -1107,6 +1107,7 @@ set (PCH_SOURCES common/menu/resolutionmenu.cpp common/menu/menudef.cpp common/menu/savegamemanager.cpp + common/statusbar/base_sbar.cpp common/rendering/v_framebuffer.cpp common/rendering/v_video.cpp @@ -1245,6 +1246,7 @@ include_directories( . common/console common/engine common/menu + common/statusbar common/fonts common/objects common/rendering diff --git a/src/common/scripting/interface/vmnatives.cpp b/src/common/scripting/interface/vmnatives.cpp index 4b065e6d1..3f34c3b2a 100644 --- a/src/common/scripting/interface/vmnatives.cpp +++ b/src/common/scripting/interface/vmnatives.cpp @@ -289,7 +289,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DStatusBarCore, BeginHUD, BeginHUD) DHUDFont* CreateHudFont(FFont* fnt, int spac, int mono, int sx, int sy) { - return (Create(fnt, spac, EMonospacing(mono), sy, sy)); + return Create(fnt, spac, EMonospacing(mono), sy, sy); } DEFINE_ACTION_FUNCTION_NATIVE(DHUDFont, Create, CreateHudFont) @@ -300,7 +300,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(DHUDFont, Create, CreateHudFont) PARAM_INT(mono); PARAM_INT(sx); PARAM_INT(sy); - ACTION_RETURN_POINTER(Create(fnt, spac, EMonospacing(mono), sy, sy)); + ACTION_RETURN_POINTER(CreateHudFont(fnt, spac, mono, sy, sy)); } diff --git a/src/g_statusbar/base_sbar.cpp b/src/common/statusbar/base_sbar.cpp similarity index 99% rename from src/g_statusbar/base_sbar.cpp rename to src/common/statusbar/base_sbar.cpp index fde2a1c96..7457b39ce 100644 --- a/src/g_statusbar/base_sbar.cpp +++ b/src/common/statusbar/base_sbar.cpp @@ -52,7 +52,7 @@ static int CrosshairNum; IMPLEMENT_CLASS(DStatusBarCore, true, false) -IMPLEMENT_CLASS(DHUDFont, true, false); +IMPLEMENT_CLASS(DHUDFont, false, false); CVAR(Color, crosshaircolor, 0xff0000, CVAR_ARCHIVE); diff --git a/src/g_statusbar/base_sbar.h b/src/common/statusbar/base_sbar.h similarity index 95% rename from src/g_statusbar/base_sbar.h rename to src/common/statusbar/base_sbar.h index 4d575c3d3..96fdd3d1b 100644 --- a/src/g_statusbar/base_sbar.h +++ b/src/common/statusbar/base_sbar.h @@ -51,8 +51,11 @@ enum DI_Flags DI_SCREEN_LEFT_TOP = DI_SCREEN_TOP | DI_SCREEN_LEFT, DI_SCREEN_RIGHT_TOP = DI_SCREEN_TOP | DI_SCREEN_RIGHT, DI_SCREEN_LEFT_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_LEFT, + DI_SCREEN_LEFT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_LEFT, DI_SCREEN_RIGHT_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_RIGHT, + DI_SCREEN_RIGHT_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_RIGHT, DI_SCREEN_CENTER = DI_SCREEN_VCENTER | DI_SCREEN_HCENTER, + DI_SCREEN_CENTER_TOP = DI_SCREEN_TOP | DI_SCREEN_HCENTER, DI_SCREEN_CENTER_BOTTOM = DI_SCREEN_BOTTOM | DI_SCREEN_HCENTER, DI_SCREEN_OFFSETS = DI_SCREEN_HOFFSET | DI_SCREEN_VOFFSET, @@ -101,10 +104,10 @@ enum DI_Flags // //============================================================================ -class DHUDFont : public DObject +class DHUDFont : public DObject { // this blocks CreateNew on this class which is the intent here. - DECLARE_ABSTRACT_CLASS(DHUDFont, DObject); + DECLARE_CLASS(DHUDFont, DObject); public: FFont* mFont; @@ -113,6 +116,8 @@ public: int mShadowX; int mShadowY; + DHUDFont() = default; + DHUDFont(FFont* f, int sp, EMonospacing ms, int sx, int sy) : mFont(f), mSpacing(sp), mMonospacing(ms), mShadowX(sx), mShadowY(sy) {}