diff --git a/src/handler/menuHandler.cpp b/src/handler/menuHandler.cpp index 0012c30..8c2e8e4 100644 --- a/src/handler/menuHandler.cpp +++ b/src/handler/menuHandler.cpp @@ -10,7 +10,6 @@ #include "menuHandler.h" #include -#include using std::string; @@ -23,9 +22,10 @@ MenuHandler::MenuHandler(const string &name) _panelMenuBeginX = ScreenWidth() - _mainMenuWidth; _menuButtonRect = iRect(_mainMenuWidth * 2, _panelMenuBeginY, _mainMenuWidth, _panelMenuHeight, ALIGN_RIGHT); - _menuFont = std::unique_ptr(OpenFont("LiberationMono-Bold", _panelMenuHeight / 2, 1)); - SetFont(_menuFont.get(), BLACK); + _menuFont = OpenFont("LiberationMono-Bold", _panelMenuHeight / 2, 1); + + SetFont(_menuFont, BLACK); DrawTextRect(0, _panelMenuBeginY, ScreenWidth(), _panelMenuHeight, name.c_str(), ALIGN_CENTER); DrawTextRect2(&_menuButtonRect, "Menu"); DrawLine(0, _panelMenuHeight - 1, ScreenWidth(), _panelMenuHeight - 1, BLACK); @@ -33,12 +33,18 @@ MenuHandler::MenuHandler(const string &name) _contentRect = iRect(0, _panelMenuHeight, ScreenWidth(), (ScreenHeight() - PanelHeight() - _panelMenuHeight), 0); _loadingScreenRect = iRect(_contentRect.w / 2 - 125, _contentRect.h / 2 - 50, 250, 100, ALIGN_CENTER); - _loadingFont = std::unique_ptr(OpenFont("LiberationMono", _loadingScreenRect.h / 4, 1)); + _loadingFont = OpenFont("LiberationMono", _loadingScreenRect.h / 4, 1); SetHardTimer("PANELUPDATE", panelHandlerStatic, 110000); DrawPanel(NULL, "", NULL, -1); } +MenuHandler::~MenuHandler() +{ + CloseFont(_menuFont); + CloseFont(_loadingFont); +} + void MenuHandler::panelHandlerStatic() { DrawPanel(NULL, "", NULL, -1); @@ -79,7 +85,7 @@ int MenuHandler::createMenu(bool loggedIn, bool workOffline, iv_menuhandler hand void MenuHandler::drawLoadingScreen() { - SetFont(_loadingFont.get(), BLACK); + SetFont(_loadingFont, BLACK); DrawTextRect2(&_loadingScreenRect, "Loading..."); PartialUpdate(_loadingScreenRect.x, _loadingScreenRect.y, _loadingScreenRect.w, _loadingScreenRect.h); } diff --git a/src/handler/menuHandler.h b/src/handler/menuHandler.h index 80ec4b5..4286103 100644 --- a/src/handler/menuHandler.h +++ b/src/handler/menuHandler.h @@ -10,7 +10,6 @@ #define MENU_HANDLER #include -#include using std::string; @@ -24,6 +23,8 @@ public: */ MenuHandler(const string &name); + ~MenuHandler(); + irect *getContentRect() { return &_contentRect; }; irect *getMenuButtonRect() { return &_menuButtonRect; }; @@ -39,8 +40,8 @@ public: void drawLoadingScreen(); private: - std::unique_ptr _menuFont; - std::unique_ptr _loadingFont; + ifont *_menuFont; + ifont *_loadingFont; int _panelMenuBeginX; int _panelMenuBeginY;