diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp
index 7520188..795351b 100644
--- a/RetroFE/Source/Graphics/Component/Component.cpp
+++ b/RetroFE/Source/Graphics/Component/Component.cpp
@@ -90,6 +90,17 @@ void Component::allocateGraphicsMemory()
}
}
+
+void Component::deInitializeFonts()
+{
+}
+
+
+void Component::initializeFonts()
+{
+}
+
+
void Component::triggerEvent(std::string event, int menuIndex)
{
animationRequestedType_ = event;
diff --git a/RetroFE/Source/Graphics/Component/Component.h b/RetroFE/Source/Graphics/Component/Component.h
index 6dd45ed..ad95098 100644
--- a/RetroFE/Source/Graphics/Component/Component.h
+++ b/RetroFE/Source/Graphics/Component/Component.h
@@ -31,6 +31,8 @@ public:
virtual ~Component();
virtual void freeGraphicsMemory();
virtual void allocateGraphicsMemory();
+ virtual void deInitializeFonts();
+ virtual void initializeFonts();
void triggerEvent(std::string event, int menuIndex = -1);
void setPlaylist(std::string name );
void setNewItemSelected();
diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp
index d3f67ea..13e47f7 100644
--- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp
+++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.cpp
@@ -101,7 +101,6 @@ void ReloadableScrollingText::update(float dt)
void ReloadableScrollingText::allocateGraphicsMemory( )
{
Component::allocateGraphicsMemory( );
- fontInst_->initialize( );
reloadTexture( );
}
@@ -109,11 +108,22 @@ void ReloadableScrollingText::allocateGraphicsMemory( )
void ReloadableScrollingText::freeGraphicsMemory( )
{
Component::freeGraphicsMemory( );
- fontInst_->deInitialize( );
text_.clear( );
}
+void ReloadableScrollingText::deInitializeFonts( )
+{
+ fontInst_->deInitialize( );
+}
+
+
+void ReloadableScrollingText::initializeFonts( )
+{
+ fontInst_->initialize( );
+}
+
+
void ReloadableScrollingText::reloadTexture( )
{
diff --git a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h
index cbaf5c6..70cf5a9 100644
--- a/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h
+++ b/RetroFE/Source/Graphics/Component/ReloadableScrollingText.h
@@ -30,6 +30,8 @@ public:
void draw( );
void allocateGraphicsMemory( );
void freeGraphicsMemory( );
+ void deInitializeFonts();
+ void initializeFonts();
private:
void reloadTexture( );
diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.cpp b/RetroFE/Source/Graphics/Component/ReloadableText.cpp
index bcb2ca0..2ae6321 100644
--- a/RetroFE/Source/Graphics/Component/ReloadableText.cpp
+++ b/RetroFE/Source/Graphics/Component/ReloadableText.cpp
@@ -71,8 +71,6 @@ void ReloadableText::allocateGraphicsMemory()
{
ReloadTexture();
- fontInst_->initialize();
-
// NOTICE! needs to be done last to prevent flags from being missed
Component::allocateGraphicsMemory();
}
@@ -87,7 +85,17 @@ void ReloadableText::freeGraphicsMemory()
delete imageInst_;
imageInst_ = NULL;
}
+}
+
+void ReloadableText::initializeFonts()
+{
+ fontInst_->initialize();
+}
+
+
+void ReloadableText::deInitializeFonts()
+{
fontInst_->deInitialize();
}
diff --git a/RetroFE/Source/Graphics/Component/ReloadableText.h b/RetroFE/Source/Graphics/Component/ReloadableText.h
index b5735fa..25069a2 100644
--- a/RetroFE/Source/Graphics/Component/ReloadableText.h
+++ b/RetroFE/Source/Graphics/Component/ReloadableText.h
@@ -1,52 +1,53 @@
-/* This file is part of RetroFE.
- *
- * RetroFE is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * RetroFE is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with RetroFE. If not, see .
- */
-#pragma once
-#include "Component.h"
-#include "Text.h"
-#include "../Font.h"
-#include "../Page.h"
-#include "../../Collection/Item.h"
-#include
-#include
-
-class ReloadableText : public Component
-{
-public:
- ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
- virtual ~ReloadableText();
- void update(float dt);
- void draw();
- void freeGraphicsMemory();
- void allocateGraphicsMemory();
-
-private:
- void ReloadTexture();
-
- Configuration &config_;
- Text *imageInst_;
- std::string type_;
- std::string layoutKey_;
- Font *fontInst_;
- std::string timeFormat_;
- std::string textFormat_;
- std::string singlePrefix_;
- std::string singlePostfix_;
- std::string pluralPrefix_;
- std::string pluralPostfix_;
-
- float scaleX_;
- float scaleY_;
-};
+/* This file is part of RetroFE.
*
+ * RetroFE is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * RetroFE is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with RetroFE. If not, see .
+ */
+#pragma once
+#include "Component.h"
+#include "Text.h"
+#include "../Font.h"
+#include "../Page.h"
+#include "../../Collection/Item.h"
+#include
+#include
+
+class ReloadableText : public Component
+{
+public:
+ ReloadableText(std::string type, Page &page, Configuration &config, Font *font, std::string layoutKey, std::string timeFormat, std::string textFormat, std::string singlePrefix, std::string singlePostfix, std::string pluralPrefix, std::string pluralPostfix, float scaleX, float scaleY);
+ virtual ~ReloadableText();
+ void update(float dt);
+ void draw();
+ void freeGraphicsMemory();
+ void allocateGraphicsMemory();
+ void deInitializeFonts();
+ void initializeFonts();
+
+private:
+ void ReloadTexture();
+
+ Configuration &config_;
+ Text *imageInst_;
+ std::string type_;
+ std::string layoutKey_;
+ Font *fontInst_;
+ std::string timeFormat_;
+ std::string textFormat_;
+ std::string singlePrefix_;
+ std::string singlePostfix_;
+ std::string pluralPrefix_;
+ std::string pluralPostfix_;
+
+ float scaleX_;
+ float scaleY_;
+};
diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp
index 8bcf907..7b66723 100644
--- a/RetroFE/Source/Graphics/Component/Text.cpp
+++ b/RetroFE/Source/Graphics/Component/Text.cpp
@@ -38,13 +38,21 @@ Text::~Text()
void Text::freeGraphicsMemory()
{
Component::freeGraphicsMemory();
- fontInst_->deInitialize();
}
void Text::allocateGraphicsMemory()
{
//todo: make the font blend color a parameter that is passed in
Component::allocateGraphicsMemory();
+}
+
+void Text::deInitializeFonts()
+{
+ fontInst_->deInitialize();
+}
+
+void Text::initializeFonts()
+{
fontInst_->initialize();
}
diff --git a/RetroFE/Source/Graphics/Component/Text.h b/RetroFE/Source/Graphics/Component/Text.h
index 321cd44..97055c2 100644
--- a/RetroFE/Source/Graphics/Component/Text.h
+++ b/RetroFE/Source/Graphics/Component/Text.h
@@ -1,41 +1,42 @@
-/* This file is part of RetroFE.
- *
- * RetroFE is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * RetroFE is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with RetroFE. If not, see .
- */
-#pragma once
-
-#include "Component.h"
-#include "../Page.h"
-#include
-#include
-
-class Font;
-
-class Text : public Component
-{
-public:
- //todo: should have a Font flass that references fontcache, pass that in as an argument
- Text(std::string text, Page &p, Font *font, float scaleX, float scaleY);
- virtual ~Text();
- void setText(std::string text);
- void allocateGraphicsMemory();
- void freeGraphicsMemory();
- void draw();
-
-private:
- std::string textData_;
- Font *fontInst_;
- float scaleX_;
- float scaleY_;
-};
+/* This file is part of RetroFE.
*
+ * RetroFE is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * RetroFE is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with RetroFE. If not, see .
+ */
+#pragma once
+
+#include "Component.h"
+#include "../Page.h"
+#include
+#include
+
+class Font;
+
+class Text : public Component
+{
+public:
+ //todo: should have a Font flass that references fontcache, pass that in as an argument
+ Text(std::string text, Page &p, Font *font, float scaleX, float scaleY);
+ virtual ~Text();
+ void setText(std::string text);
+ void allocateGraphicsMemory();
+ void freeGraphicsMemory();
+ void deInitializeFonts();
+ void initializeFonts();
+ void draw();
+
+private:
+ std::string textData_;
+ Font *fontInst_;
+ float scaleX_;
+ float scaleY_;
+};
diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp
index 4e90ba4..cb74284 100644
--- a/RetroFE/Source/Graphics/Page.cpp
+++ b/RetroFE/Source/Graphics/Page.cpp
@@ -1049,6 +1049,42 @@ void Page::allocateGraphicsMemory()
}
+void Page::deInitializeFonts()
+{
+ for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
+ {
+ for(std::vector::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
+ {
+ ScrollingList *menu = *it2;
+ menu->deInitializeFonts( );
+ }
+ }
+
+ for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
+ {
+ (*it)->deInitializeFonts();
+ }
+}
+
+
+void Page::initializeFonts()
+{
+ for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
+ {
+ for(std::vector::iterator it2 = menus_[std::distance(menus_.begin(), it)].begin(); it2 != menus_[std::distance(menus_.begin(), it)].end(); it2++)
+ {
+ ScrollingList *menu = *it2;
+ menu->initializeFonts( );
+ }
+ }
+
+ for(std::vector::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
+ {
+ (*it)->initializeFonts( );
+ }
+}
+
+
void Page::launchEnter()
{
if(selectSoundChunk_)
diff --git a/RetroFE/Source/Graphics/Page.h b/RetroFE/Source/Graphics/Page.h
index f1f4346..f822780 100644
--- a/RetroFE/Source/Graphics/Page.h
+++ b/RetroFE/Source/Graphics/Page.h
@@ -87,6 +87,8 @@ public:
void draw();
void freeGraphicsMemory();
void allocateGraphicsMemory();
+ void deInitializeFonts( );
+ void initializeFonts( );
void launchEnter();
std::string getCollectionName();
void setMinShowTime(float value);
diff --git a/RetroFE/Source/RetroFE.cpp b/RetroFE/Source/RetroFE.cpp
index c1cf7b2..1753219 100644
--- a/RetroFE/Source/RetroFE.cpp
+++ b/RetroFE/Source/RetroFE.cpp
@@ -187,6 +187,7 @@ void RetroFE::freeGraphicsMemory( )
config_.getProperty( "unloadSDL", unloadSDL );
if ( unloadSDL )
{
+ currentPage_->deInitializeFonts( );
SDL::deInitialize( );
}
@@ -203,6 +204,7 @@ void RetroFE::allocateGraphicsMemory( )
if ( unloadSDL )
{
SDL::initialize( config_ );
+ currentPage_->initializeFonts( );
}
// Allocate textures