diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp index e26d889..4ecd8e1 100644 --- a/source/code/MenuSystem.cpp +++ b/source/code/MenuSystem.cpp @@ -132,7 +132,7 @@ void Menu::drawSelf(SDL_Renderer* target) { drawToScreen(*b); } drawToScreen(exit); - standardButton.thefont->draw(target, 50, 50, title.c_str()); + standardButton.getLabel(title)->Draw(target, 50, 50); } diff --git a/source/code/MenuSystem.h b/source/code/MenuSystem.h index fa91362..7e595d7 100644 --- a/source/code/MenuSystem.h +++ b/source/code/MenuSystem.h @@ -42,10 +42,14 @@ struct ButtonGfx //The size of the buttons, so we don't have to ask w and h from the SDL Surfaces each time int xsize = 0; int ysize = 0; - //A TTFont used for writing the label on the buttons - FontWrapper* thefont; sago::SagoTextField* getLabel(const std::string& text); void setSurfaces(); + ~ButtonGfx() { + for (auto& label : labels) { + delete label.second; + } + labels.clear(); + } private: std::map labels; }; diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp index 0092344..bedca17 100644 --- a/source/code/menudef.cpp +++ b/source/code/menudef.cpp @@ -96,7 +96,6 @@ void Button_changekey::doAction() { void InitMenues() { standardButton.setSurfaces(); - standardButton.thefont = &globalData.button_font; } static void runSinglePlayerEndless() {