Commit f1623a30 authored by Bernd Kosmahl's avatar Bernd Kosmahl

Merge branch 'develop' into 'develop'

AnyUnitSize merge: refactoring and cleaning up

See merge request !15
parents 91a46c53 8e00eefe
......@@ -38,18 +38,28 @@ cEventManager& cEventManager::getInstance()
return instance;
}
bool cEventManager::shouldExit() const
{
return isDone;
}
//------------------------------------------------------------------------------
void cEventManager::run()
{
SDL_Event event;
while (SDL_PollEvent (&event))
{
handleSdlEvent (event);
if(!handleSdlEvent (event))
{
isDone = true;
break;
}
}
SDL_Delay(1);
}
//------------------------------------------------------------------------------
void cEventManager::handleSdlEvent (const SDL_Event& event)
bool cEventManager::handleSdlEvent (const SDL_Event& event)
{
switch (event.type)
{
......@@ -70,7 +80,7 @@ void cEventManager::handleSdlEvent (const SDL_Event& event)
mouseWheelEvent (cEventMouseWheel (event.wheel));
break;
case SDL_QUIT:
Quit();
return false;
break;
case SDL_MOUSEMOTION:
mouseMotionEvent (cEventMouseMotion (event.motion));
......@@ -80,4 +90,6 @@ void cEventManager::handleSdlEvent (const SDL_Event& event)
break;
default: break;
}
// Everything is OK, continue the cycle
return true;
}
......@@ -62,12 +62,15 @@ public:
cSignal<void (const cKeyboardEvent&)> keyboardEvent;
cSignal<void (const cTextInputEvent&)> textInputEvent;
bool shouldExit() const;
private:
cEventManager();
cEventManager (const cEventManager& other) MAXR_DELETE_FUNCTION;
cEventManager& operator= (const cEventManager& other) MAXR_DELETE_FUNCTION;
void handleSdlEvent (const SDL_Event& event);
bool handleSdlEvent (const SDL_Event& event);
bool isDone = false;
};
#endif // events_eventmanagerH
......@@ -18,8 +18,8 @@
***************************************************************************/
#include <vector>
#include "extendedtinyxml.h"
#include "utility/log.h"
#include "tinyxml2.h"
using namespace tinyxml2;
using namespace std;
......
......@@ -20,7 +20,7 @@
#ifndef EXTENDEDTINYXML_H
#define EXTENDEDTINYXML_H
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include <stdarg.h>
#include <string>
......
......@@ -27,7 +27,7 @@
#include "utility/autosurface.h"
#include "defines.h"
#include "t_2.h"
#include "utility/t_2.h"
#include "utility/position.h"
#include "utility/signal/signal.h"
#include "game/data/gamesettings.h"
......
......@@ -22,7 +22,7 @@
#include <string>
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
class cModel;
class cSaveGameInfo;
......
......@@ -24,13 +24,14 @@
#include "utility/listhelpers.h"
#include "game/logic/fxeffects.h"
#include "main.h"
#include "pcx.h"
//#include "pcx.h"
#include "netmessage2.h"
#include "game/data/player/player.h"
#include "settings.h"
#include "game/logic/upgradecalculator.h"
#include "game/data/units/vehicle.h"
#include "video.h"
#include "unifonts.h"
#include "utility/unifonts.h"
#include "game/data/report/savedreportsimple.h"
#include "game/data/report/special/savedreportresourcechanged.h"
#include "utility/random.h"
......@@ -194,6 +195,7 @@ cBuilding::~cBuilding()
//----------------------------------------------------
string cBuilding::getStatusStr (const cPlayer* whoWantsToKnow, const cUnitsData& unitsData) const
{
auto font = cUnicodeFont::font.get();
if (isDisabled())
{
string sText;
......@@ -1283,8 +1285,8 @@ sBuildingUIData& sBuildingUIData::operator= (sBuildingUIData && other)
hasOverlay = other.hasOverlay;
buildUpGraphic = other.buildUpGraphic;
powerOnGraphic = other.powerOnGraphic;
isAnimated = isAnimated;
isConnectorGraphic = isConnectorGraphic;
isAnimated = other.isAnimated;
isConnectorGraphic = other.isConnectorGraphic;
hasFrames = other.hasFrames;
return *this;
......
......@@ -20,7 +20,7 @@
#include <algorithm>
#include "unitdata.h"
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include "game/data/player/clans.h"
#include "utility/log.h"
#include "utility/language.h"
......
......@@ -28,12 +28,11 @@
#include "game/logic/fxeffects.h"
#include "utility/log.h"
#include "game/data/map/map.h"
#include "pcx.h"
#include "game/data/player/player.h"
#include "settings.h"
#include "video.h"
#include "sound.h"
#include "unifonts.h"
#include "utility/unifonts.h"
#include "input/mouse/mouse.h"
#include "output/sound/sounddevice.h"
#include "output/sound/soundchannel.h"
......@@ -236,7 +235,9 @@ void cVehicle::render_simple (SDL_Surface* surface, const SDL_Rect& dest, float
// draw player color
if (owner)
{
SDL_BlitSurface (owner->getColor().getTexture(), nullptr, GraphicsData.gfx_tmp.get(), nullptr);
SDL_Surface* src = owner->getColor().getTexture();
SDL_Surface* dst = GraphicsData.gfx_tmp.get();
SDL_BlitSurface(src, nullptr, dst, nullptr);
}
// read the size:
......@@ -454,6 +455,7 @@ bool cVehicle::refreshData()
//-----------------------------------------------------------------------------
string cVehicle::getStatusStr(const cPlayer* player, const cUnitsData& unitsData) const
{
auto font = cUnicodeFont::font.get();
if (isDisabled())
{
string sText;
......
......@@ -23,7 +23,7 @@
#include "game/data/units/unitdata.h"
#include "utility/log.h"
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include "game/data/units/unit.h"
#include "game/data/player/player.h"
......
......@@ -17,7 +17,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include "keys.h"
#include "utility/files.h"
......
......@@ -44,11 +44,11 @@
#include "keys.h"
#include "utility/log.h"
#include "main.h"
#include "pcx.h"
#include "utility/pcx.h"
#include "settings.h"
#include "sound.h"
#include "tinyxml2.h"
#include "unifonts.h"
#include "utility/tinyxml2.h"
#include "utility/unifonts.h"
#include "game/data/units/vehicle.h"
#include "video.h"
#include "debug.h"
......@@ -149,8 +149,8 @@ int LoadData (void* data)
return 0;
}
font = new cUnicodeFont; // init ascii fonts
font->setTargetSurface (cVideo::buffer);
cUnicodeFont::font.reset(new cUnicodeFont()); // init ascii fonts
cUnicodeFont::font->setTargetSurface (cVideo::buffer);
Log.mark();
}
......@@ -347,6 +347,7 @@ int LoadData (void* data)
cout << sTxt << endl;
return;
}
const auto& font = cUnicodeFont::font.get();
const SDL_Rect rDest = {22, 152, 228, Uint16 (font->getFontHeight (FONT_LATIN_BIG_GOLD)) };
const SDL_Rect rDest2 = {250, 152, 230, Uint16 (font->getFontHeight (FONT_LATIN_BIG_GOLD)) };
......
......@@ -43,11 +43,9 @@
#include "game/data/map/map.h"
#include "mveplayer.h"
#include "network.h"
#include "pcx.h"
#include "game/data/player/player.h"
#include "settings.h"
#include "sound.h"
#include "unifonts.h"
#include "game/data/units/vehicle.h"
#include "video.h"
#include "maxrversion.h"
......@@ -64,16 +62,32 @@
using namespace std;
static int initNet();
static int initSDL();
static int initSDL(bool headless);
static int initSound();
static void logMAXRVersion();
static void showIntro();
struct AtExit
{
~AtExit()
{
//unload files here
cSoundDevice::getInstance().close();
SDLNet_Quit();
Video.clearMemory();
SDL_Quit();
Log.write ("EOF");;
}
};
int main (int argc, char* argv[])
{
AtExit exitGuard; // Will clean data global data in its destructor
bool headless = DEDICATED_SERVER;
if (!cSettings::getInstance().isInitialized())
{
Quit();
return -1;
}
......@@ -81,14 +95,14 @@ int main (int argc, char* argv[])
// stop on error during init of SDL basics. WARNINGS will be ignored!
if (initSDL() == -1) return -1;
if (initSDL(headless) == -1) return -1;
// call it once to initialize
is_main_thread();
logMAXRVersion();
if (!DEDICATED_SERVER)
if (!headless)
{
Video.init();
Video.showSplashScreen(); // show splashscreen
......@@ -107,11 +121,11 @@ int main (int argc, char* argv[])
{
Log.write ("Error while loading data!", cLog::eLOG_TYPE_ERROR);
SDL_WaitThread (dataThread, nullptr);
Quit();
return -1;
}
while (SDL_PollEvent (&event))
{
if (!DEDICATED_SERVER
if (!headless
&& event.type == SDL_WINDOWEVENT
&& event.window.event == SDL_WINDOWEVENT_EXPOSED)
{
......@@ -119,14 +133,14 @@ int main (int argc, char* argv[])
}
}
SDL_Delay (100);
if (!DEDICATED_SERVER)
if (!headless)
{
// The draw may be conditionned when screen has changed.
Video.draw();
}
}
if (!DEDICATED_SERVER)
if (!headless)
{
// play intro if we're supposed to and the file exists
if (cSettings::getInstance().shouldShowIntro())
......@@ -141,7 +155,7 @@ int main (int argc, char* argv[])
SDL_WaitThread (dataThread, nullptr);
if (DEDICATED_SERVER)
if (headless)
{
cDedicatedServer::instance().run();
}
......@@ -166,7 +180,6 @@ int main (int argc, char* argv[])
application.execute();
}
Quit();
return 0;
}
......@@ -175,10 +188,10 @@ int main (int argc, char* argv[])
*@author beko
*@return -1 on error<br>0 on success<br>1 with warnings
*/
static int initSDL()
static int initSDL(bool headless)
{
int sdlInitResult = -1;
if (DEDICATED_SERVER)
if (headless)
sdlInitResult = SDL_Init (SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE); // start SDL basics without video
else
sdlInitResult = SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE); // start SDL basics
......@@ -311,23 +324,6 @@ bool is_main_thread()
return main_thread_id == SDL_ThreadID();
}
/**
*Terminates app
*@author beko
*/
void Quit()
{
delete font;
//unload files here
cSoundDevice::getInstance().close();
SDLNet_Quit();
Video.clearMemory();
SDL_Quit();
Log.write ("EOF");
exit (0);
}
string iToStr (int x)
{
stringstream strStream;
......
......@@ -331,6 +331,4 @@ int Round (float num);
std::string getHexValue(unsigned char byte);
unsigned char getByteValue(const std::string& str, int index);
void Quit();
#endif
......@@ -28,6 +28,7 @@
#include "utility/serialization/serialization.h"
#include "ui/graphical/menu/control/menuevents.h"
#include "game/logic/turntimeclock.h"
#include "maxrversion.h"
std::unique_ptr<cNetMessage2> cNetMessage2::createFromBuffer(const unsigned char* data, int length)
{
......@@ -102,6 +103,30 @@ std::unique_ptr<cNetMessage2> cNetMessage2::clone() const
return cNetMessage2::createFromBuffer(serialMessage.data(), serialMessage.size());
}
//------------------------------------------------------------------------------
cNetMessageTcpHello::cNetMessageTcpHello():
cNetMessage2(eNetMessageType::TCP_HELLO),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV)
{}
//------------------------------------------------------------------------------
cNetMessageTcpWantConnect::cNetMessageTcpWantConnect():
cNetMessage2(eNetMessageType::TCP_WANT_CONNECT),
ready(false),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV),
socket(nullptr)
{}
//------------------------------------------------------------------------------
cNetMessageTcpConnected::cNetMessageTcpConnected(int playerNr) :
cNetMessage2(eNetMessageType::TCP_CONNECTED),
playerNr(playerNr),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV)
{}
//------------------------------------------------------------------------------
std::string enumToString(eNetMessageType value)
{
......
......@@ -30,7 +30,6 @@
#include "game/data/report/savedreport.h"
#include "ui/graphical/game/gameguistate.h"
#include "utility/color.h"
#include "maxrversion.h"
#include "mapdownload.h"
#include "game/data/player/playerbasicdata.h"
#include "main.h"
......@@ -364,11 +363,7 @@ private:
class cNetMessageTcpHello : public cNetMessage2
{
public:
cNetMessageTcpHello() :
cNetMessage2(eNetMessageType::TCP_HELLO),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV)
{};
cNetMessageTcpHello();
cNetMessageTcpHello(cBinaryArchiveOut& archive) :
cNetMessage2(eNetMessageType::TCP_HELLO)
{
......@@ -395,13 +390,7 @@ private:
class cNetMessageTcpWantConnect : public cNetMessage2
{
public:
cNetMessageTcpWantConnect() :
cNetMessage2(eNetMessageType::TCP_WANT_CONNECT),
ready(false),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV),
socket(nullptr)
{};
cNetMessageTcpWantConnect();
cNetMessageTcpWantConnect(cBinaryArchiveOut& archive) :
cNetMessage2(eNetMessageType::TCP_WANT_CONNECT)
{
......@@ -436,12 +425,7 @@ private:
class cNetMessageTcpConnected : public cNetMessage2
{
public:
cNetMessageTcpConnected(int playerNr) :
cNetMessage2(eNetMessageType::TCP_CONNECTED),
playerNr(playerNr),
packageVersion(PACKAGE_VERSION),
packageRev(PACKAGE_REV)
{};
cNetMessageTcpConnected(int playerNr);
cNetMessageTcpConnected(cBinaryArchiveOut& archive) :
cNetMessage2(eNetMessageType::TCP_CONNECTED)
{
......
......@@ -36,7 +36,7 @@
#include "utility/files.h"
#include "utility/log.h"
#include "main.h"
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include "video.h"
#include "utility/string/tolower.h"
#include "game/data/player/playercolor.h"
......
......@@ -21,7 +21,7 @@
#include <string>
#include <SDL.h>
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
#include "utility/thread/mutex.h"
#include "utility/signal/signal.h"
#include "utility/color.h"
......
......@@ -25,7 +25,8 @@
#include "settings.h"
#include "video.h"
#include "main.h"
#include "unifonts.h"
#include "utility/unifonts.h"
#include "netmessage2.h"
#include "game/startup/game.h"
#include "utility/runnable.h"
......@@ -70,16 +71,26 @@ cApplication::cApplication() :
//------------------------------------------------------------------------------
cApplication::~cApplication()
{}
{
// Move it to temporary container.
// It allows to break all shared_ptr cross-references broken before
// cApplication is destroyed
{
auto runnables_tmp = std::move(runnables);
}
}
//------------------------------------------------------------------------------
void cApplication::execute()
{
cWindow* lastActiveWindow = nullptr;
bool lastClosed = false;
while (!modalWindows.empty())
cEventManager& eventManager = cEventManager::getInstance();
while (!modalWindows.empty() && !eventManager.shouldExit())
{
cEventManager::getInstance().run();
eventManager.run();
for (auto i = runnables.begin(); i != runnables.end(); /*erase in loop*/)
{
......@@ -235,12 +246,12 @@ void cApplication::addRunnable (std::shared_ptr<cRunnable> runnable)
}
//------------------------------------------------------------------------------
std::shared_ptr<cRunnable> cApplication::removeRunnable (const cRunnable& runnable)
std::shared_ptr<cRunnable> cApplication::removeRunnable(std::shared_ptr<cRunnable> runnable)
{
std::shared_ptr<cRunnable> result;
for (auto i = runnables.begin(); i != runnables.end();)
{
if (i->get() == &runnable)
if (*i == runnable)
{
result = std::move (*i);
i = runnables.erase (i);
......@@ -495,5 +506,6 @@ void cApplication::drawFramesPerSecond (unsigned int fps, bool draw)
{
SDL_Rect dest = {0, 0, 55, 10};
SDL_FillRect (cVideo::buffer, &dest, 0);
if (draw) font->showText (0, 0, "FPS: " + iToStr (fps));
if (draw)
cUnicodeFont::font->showText (0, 0, "FPS: " + iToStr (fps));
}
......@@ -77,7 +77,7 @@ public:
bool hasKeyFocus() const;
void addRunnable (std::shared_ptr<cRunnable> runnable);
std::shared_ptr<cRunnable> removeRunnable (const cRunnable& runnable);
std::shared_ptr<cRunnable> removeRunnable (std::shared_ptr<cRunnable> runnable);
cShortcut* addShortcut (std::unique_ptr<cShortcut> shortcut);
......
......@@ -152,7 +152,7 @@ cGameGuiController::cGameGuiController (cApplication& application_, std::shared_
//------------------------------------------------------------------------------
cGameGuiController::~cGameGuiController()
{
application.removeRunnable (*animationTimer);
application.removeRunnable (animationTimer);
}
//------------------------------------------------------------------------------
......
......@@ -96,6 +96,7 @@ cGameGui::cGameGui (std::shared_ptr<const cStaticMap> staticMap_, std::shared_pt
hudPanels = addChild (std::make_unique<cHudPanels> (getPosition(), getSize().y(), animationTimer));
auto font = cUnicodeFont::font.get();
primiaryInfoLabel = addChild (std::make_unique<cLabel> (cBox<cPosition> (cPosition (cHud::panelLeftWidth, 235), cPosition (getEndPosition().x() - cHud::panelRightWidth, 235 + font->getFontHeight (FONT_LATIN_BIG))), "", FONT_LATIN_BIG, toEnumFlag (eAlignmentType::CenterHorizontal) | eAlignmentType::Top));
primiaryInfoLabel->disable();
primiaryInfoLabel->hide();
......@@ -867,6 +868,8 @@ void cGameGui::handleResolutionChange()
resize (hud->getSize());
auto font = cUnicodeFont::font.get();
// TODO: remove duplication of widget areas with the ones during initialization
hudPanels->resize (cPosition (hudPanels->getSize().x(), getSize().y()));
......
......@@ -24,7 +24,7 @@
#include "utility/serialization/serialization.h"
#include "utility/position.h"
#include "tinyxml2.h"
#include "utility/tinyxml2.h"
class cUnitSelection;
class cUnitLockList;
......
......@@ -33,7 +33,7 @@
#include "defines.h"
#include "settings.h"
#include "video.h"
#include "pcx.h"
#include "utility/pcx.h"
#include "main.h"
#include "game/data/units/unit.h"
#include "keys.h"
......
......@@ -93,7 +93,7 @@ cChatBox<ChatListItemType, PlayerListItemType>::cChatBox (const cBox<cPosition>&
chatList->disableSelectable();
chatList->setBeginMargin (cPosition (2, 2));
chatList->setEndMargin (cPosition (2, 2));
chatList->setScrollOffset (font->getFontHeight() + 3);
chatList->setScrollOffset (cUnicodeFont::font->getFontHeight() + 3);
chatLineEdit = addChild (std::make_unique<cLineEdit> (cBox<cPosition> (cPosition (getPosition().x() + 2, getEndPosition().y() - 12), cPosition (getEndPosition().x() - 164, getEndPosition().y() - 2))));
signalConnectionManager.connect (chatLineEdit->returnPressed, std::bind (&cChatBox::sendCommand, this));
......
......@@ -25,7 +25,7 @@
#include "game/logic/client.h"
#include "game/logic/server2.h"
#include "video.h"
#include "unifonts.h"
#include "utility/unifonts.h"
#include "game/data/units/building.h"
#include "game/data/units/vehicle.h"
#include "utility/string/toString.h"
......@@ -142,10 +142,12 @@ void cDebugOutputWidget::draw (SDL_Surface& destination, const cBox<cPosition>&
if (!client) return;
auto font = cUnicodeFont::font.get();
const cPlayer& player = client->getActivePlayer();
setPrintPosition(cPosition(getEndPosition().x() - 200, getPosition().y()));
if (debugPlayers)
{
print("Players: " + toString(client->model.getPlayerList().size()));
......@@ -363,8 +365,8 @@ void cDebugOutputWidget::setPrintPosition(cPosition position)
//------------------------------------------------------------------------------
void cDebugOutputWidget::print(const std::string& text, eUnicodeFontType font_ /*= FONT_LATIN_SMALL_WHITE*/)
{
font->showText(drawPosition.x(), drawPosition.y(), text, font_);
drawPosition.y() += font->getFontHeight(font_);
cUnicodeFont::font->showText(drawPosition.x(), drawPosition.y(), text, font_);
drawPosition.y() += cUnicodeFont::font->getFontHeight(font_);
}
//------------------------------------------------------------------------------
......@@ -408,6 +410,8 @@ void cDebugOutputWidget::traceVehicle (const cVehicle& vehicle, cPosition& drawP
{
std::string tmpString;
auto font = cUnicodeFont::font.get();
tmpString = "name: \"" + vehicle.getDisplayName() + "\" id: \"" + iToStr (vehicle.iID) + "\" owner: \"" + vehicle.getOwner()->getName() + "\" posX: +" + iToStr (vehicle.getPosition().x()) + " posY: " + iToStr (vehicle.getPosition().y()) + " offX: " + iToStr (vehicle.getMovementOffset().x()) + " offY: " + iToStr (vehicle.getMovementOffset().y());
font->showText (drawPosition, tmpString, FONT_LATIN_SMALL_WHITE);
drawPosition.y() += 8;
......@@ -472,6 +476,8 @@ void cDebugOutputWidget::traceBuilding (const cBuilding& building, cPosition& dr
{
std::string tmpString;
auto font = cUnicodeFont::font.get();
tmpString = "name: \"" + building.getDisplayName() + "\" id: \"" + iToStr (building.iID) + "\" owner: \"" + (building.getOwner() ? building.getOwner()->getName() : "<null>") + "\" posX: +" + iToStr (building.getPosition().x()) + " posY: " + iToStr (building.getPosition().y());
font->showText (drawPosition, tmpString, FONT_LATIN_SMALL_WHITE);
drawPosition.y() += 8;
......@@ -540,12 +546,14 @@ void cDebugOutputWidget::drawDetectedByPlayerList()
const auto tileDrawingRange = gameMap->computeTileDrawingRange();
const auto zoomedStartTilePixelOffset = gameMap->getZoomedStartTilePixelOffset();
auto font = cUnicodeFont::font.get();
for (auto i = makeIndexIterator(tileDrawingRange.first, tileDrawingRange.second); i.hasMore(); i.next())
{
auto& mapField = map.getField(*i);
auto building = mapField.getBuilding();
if (building == nullptr) continue;
auto drawDestination = gameMap->computeTileDrawingArea (zoomedTileSize, zoomedStartTilePixelOffset, tileDrawingRange.first, building->getPosition());
drawDestination.x += 4;
drawDestination.y += 4;
......@@ -599,6 +607,8 @@ void cDebugOutputWidget::drawDetectionMaps()
const auto tileDrawingRange = gameMap->computeTileDrawingRange();
const auto zoomedStartTilePixelOffset = gameMap->getZoomedStartTilePixelOffset();
auto font = cUnicodeFont::font.get();
for (auto i = makeIndexIterator(tileDrawingRange.first, tileDrawingRange.second); i.hasMore(); i.next())
{
auto drawDestination = gameMap->computeTileDrawingArea(zoomedTileSize, zoomedStartTilePixelOffset, tileDrawingRange.first, *i);
......
......@@ -21,7 +21,7 @@
#define ui_graphical_game_widgets_debugoutputidgetH
#include "ui/graphical/widget.h"
#include "unifonts.h"
#include "utility/unifonts.h"
class cClient;
class cServer2;
......
......@@ -102,6 +102,7 @@ void cUnitRenameWidget::setUnit (const cUnit* unit, const cUnitsData& unitsData)
selectedUnitNameEdit->enable();
auto font = cUnicodeFont::font.get();
const auto xPosition = selectedUnitNamePrefixLabel->getPosition().x() + font->getTextWide (