git repos / blockattack-game

commit e554e0a8

sago007 · 2018-03-26 20:57
e554e0a8555edbe7fc1d6eab2cd1794887a10201 patch · browse files
parent 36bbe75108feed83f28545f56648f7786ee56e84

Changed the header and dropped the remains old font from the menu system

Changed files

M source/code/MenuSystem.cpp before
M source/code/MenuSystem.h before
M source/code/menudef.cpp before
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<std::string, sago::SagoTextField*> 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() {