commit e7e189c7
Started refactoring the blue font
Changed files
| M | source/code/BlockGameSdl.inc before |
| M | source/code/MenuSystem.cpp before |
| M | source/code/global.hpp before |
| M | source/code/main.cpp before |
diff --git a/source/code/BlockGameSdl.inc b/source/code/BlockGameSdl.inc
index 6607881..437f0cf 100644
--- a/source/code/BlockGameSdl.inc
+++ b/source/code/BlockGameSdl.inc
@@ -378,9 +378,10 @@ public:
#if DEBUG
if (AI_Enabled&&(!bGameOver)) {
+ sagoTextSetBlueFont(aiStatusField);
strHolder = "AI_status: " + std::to_string(AIstatus)+ ", "+ std::to_string(AIlineToClear);
- //NFont_Write( 5, 5, strHolder.c_str());
- globalData.standard_blue_font.draw(globalData.screen, topx+5, topy+5, strHolder.c_str());
+ aiStatusField.SetText(strHolder.c_str());
+ aiStatusField.Draw(globalData.screen, topx+5, topy+5);
}
#endif
if (!bGameOver) {
@@ -458,6 +459,9 @@ private:
sago::SagoTextField buttonRetry;
sago::SagoTextField buttonNext;
sago::SagoTextField stopIntField;
+#if DEBUG
+ sago::SagoTextField aiStatusField;
+#endif
};
diff --git a/source/code/MenuSystem.cpp b/source/code/MenuSystem.cpp
index f2b17c2..4327460 100644
--- a/source/code/MenuSystem.cpp
+++ b/source/code/MenuSystem.cpp
@@ -322,6 +322,8 @@ void Menu::Draw(SDL_Renderer* target) {
static unsigned long int Frames;
static unsigned long int Ticks;
static char FPS[10];
+ static sago::SagoTextField fpsField;
+ sagoTextSetBlueFont(fpsField);
Frames++;
if (SDL_GetTicks() >= Ticks + 1000) {
if (Frames > 999) {
@@ -331,8 +333,8 @@ void Menu::Draw(SDL_Renderer* target) {
Frames = 0;
Ticks = SDL_GetTicks();
}
-
- globalData.standard_blue_font.draw(globalData.screen, 800, 4, FPS);
+ fpsField.SetText(FPS);
+ fpsField.Draw(globalData.screen, 800, 4);
#endif
}
void Menu::ProcessInput(const SDL_Event& event, bool& processed) {
diff --git a/source/code/global.hpp b/source/code/global.hpp
index f2128c5..91bf964 100644
--- a/source/code/global.hpp
+++ b/source/code/global.hpp
@@ -48,6 +48,7 @@ void DrawIMG(const sago::SagoSprite& sprite, SDL_Renderer* target, int x, int y)
void DrawIMG_Bounded(const sago::SagoSprite& sprite, SDL_Renderer* target, int x, int y, int minx, int miny, int maxx, int maxy);
void sagoTextSetHelpFont(sago::SagoTextField& field);
+void sagoTextSetBlueFont(sago::SagoTextField& field);
struct GlobalData {
sago::SagoSprite bHighScore;
diff --git a/source/code/main.cpp b/source/code/main.cpp
index 908c395..5ba8a20 100644
--- a/source/code/main.cpp
+++ b/source/code/main.cpp
@@ -435,6 +435,13 @@ void sagoTextSetHelpFont(sago::SagoTextField& gametypeNameField){
sagoTextSetHelpFont<sago::SagoTextField>(gametypeNameField);
}
+void sagoTextSetBlueFont(sago::SagoTextField& field) {
+ field.SetHolder(&globalData.spriteHolder->GetDataHolder());
+ field.SetFont("freeserif");
+ field.SetFontSize(30);
+ field.SetColor({0,0,255,255});
+}
+
//draws everything
void DrawEverything(int xsize, int ysize,BlockGameSdl* theGame, BlockGameSdl* theGame2) {
SDL_ShowCursor(SDL_DISABLE);