mirror of
https://github.com/FunKey-Project/RetroFE.git
synced 2025-12-13 10:18:53 +01:00
Fonts only need to be reloaded when launching a game with unloadSDL = true.
Reloading it every time the graphics are reallocated has a huge performance impact.
This commit is contained in:
parent
a7f50c9b03
commit
a22bd1c6a1
@ -90,6 +90,17 @@ void Component::allocateGraphicsMemory()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Component::deInitializeFonts()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Component::initializeFonts()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Component::triggerEvent(std::string event, int menuIndex)
|
void Component::triggerEvent(std::string event, int menuIndex)
|
||||||
{
|
{
|
||||||
animationRequestedType_ = event;
|
animationRequestedType_ = event;
|
||||||
|
|||||||
@ -31,6 +31,8 @@ public:
|
|||||||
virtual ~Component();
|
virtual ~Component();
|
||||||
virtual void freeGraphicsMemory();
|
virtual void freeGraphicsMemory();
|
||||||
virtual void allocateGraphicsMemory();
|
virtual void allocateGraphicsMemory();
|
||||||
|
virtual void deInitializeFonts();
|
||||||
|
virtual void initializeFonts();
|
||||||
void triggerEvent(std::string event, int menuIndex = -1);
|
void triggerEvent(std::string event, int menuIndex = -1);
|
||||||
void setPlaylist(std::string name );
|
void setPlaylist(std::string name );
|
||||||
void setNewItemSelected();
|
void setNewItemSelected();
|
||||||
|
|||||||
@ -101,7 +101,6 @@ void ReloadableScrollingText::update(float dt)
|
|||||||
void ReloadableScrollingText::allocateGraphicsMemory( )
|
void ReloadableScrollingText::allocateGraphicsMemory( )
|
||||||
{
|
{
|
||||||
Component::allocateGraphicsMemory( );
|
Component::allocateGraphicsMemory( );
|
||||||
fontInst_->initialize( );
|
|
||||||
reloadTexture( );
|
reloadTexture( );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,11 +108,22 @@ void ReloadableScrollingText::allocateGraphicsMemory( )
|
|||||||
void ReloadableScrollingText::freeGraphicsMemory( )
|
void ReloadableScrollingText::freeGraphicsMemory( )
|
||||||
{
|
{
|
||||||
Component::freeGraphicsMemory( );
|
Component::freeGraphicsMemory( );
|
||||||
fontInst_->deInitialize( );
|
|
||||||
text_.clear( );
|
text_.clear( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReloadableScrollingText::deInitializeFonts( )
|
||||||
|
{
|
||||||
|
fontInst_->deInitialize( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReloadableScrollingText::initializeFonts( )
|
||||||
|
{
|
||||||
|
fontInst_->initialize( );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ReloadableScrollingText::reloadTexture( )
|
void ReloadableScrollingText::reloadTexture( )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,8 @@ public:
|
|||||||
void draw( );
|
void draw( );
|
||||||
void allocateGraphicsMemory( );
|
void allocateGraphicsMemory( );
|
||||||
void freeGraphicsMemory( );
|
void freeGraphicsMemory( );
|
||||||
|
void deInitializeFonts();
|
||||||
|
void initializeFonts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void reloadTexture( );
|
void reloadTexture( );
|
||||||
|
|||||||
@ -71,8 +71,6 @@ void ReloadableText::allocateGraphicsMemory()
|
|||||||
{
|
{
|
||||||
ReloadTexture();
|
ReloadTexture();
|
||||||
|
|
||||||
fontInst_->initialize();
|
|
||||||
|
|
||||||
// NOTICE! needs to be done last to prevent flags from being missed
|
// NOTICE! needs to be done last to prevent flags from being missed
|
||||||
Component::allocateGraphicsMemory();
|
Component::allocateGraphicsMemory();
|
||||||
}
|
}
|
||||||
@ -87,7 +85,17 @@ void ReloadableText::freeGraphicsMemory()
|
|||||||
delete imageInst_;
|
delete imageInst_;
|
||||||
imageInst_ = NULL;
|
imageInst_ = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReloadableText::initializeFonts()
|
||||||
|
{
|
||||||
|
fontInst_->initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ReloadableText::deInitializeFonts()
|
||||||
|
{
|
||||||
fontInst_->deInitialize();
|
fontInst_->deInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
/* This file is part of RetroFE.
|
/* This file is part of RetroFE.
*
|
||||||
*
|
|
||||||
* RetroFE is free software: you can redistribute it and/or modify
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -31,6 +30,8 @@ public:
|
|||||||
void draw();
|
void draw();
|
||||||
void freeGraphicsMemory();
|
void freeGraphicsMemory();
|
||||||
void allocateGraphicsMemory();
|
void allocateGraphicsMemory();
|
||||||
|
void deInitializeFonts();
|
||||||
|
void initializeFonts();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ReloadTexture();
|
void ReloadTexture();
|
||||||
|
|||||||
@ -38,13 +38,21 @@ Text::~Text()
|
|||||||
void Text::freeGraphicsMemory()
|
void Text::freeGraphicsMemory()
|
||||||
{
|
{
|
||||||
Component::freeGraphicsMemory();
|
Component::freeGraphicsMemory();
|
||||||
fontInst_->deInitialize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Text::allocateGraphicsMemory()
|
void Text::allocateGraphicsMemory()
|
||||||
{
|
{
|
||||||
//todo: make the font blend color a parameter that is passed in
|
//todo: make the font blend color a parameter that is passed in
|
||||||
Component::allocateGraphicsMemory();
|
Component::allocateGraphicsMemory();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Text::deInitializeFonts()
|
||||||
|
{
|
||||||
|
fontInst_->deInitialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Text::initializeFonts()
|
||||||
|
{
|
||||||
fontInst_->initialize();
|
fontInst_->initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
/* This file is part of RetroFE.
|
/* This file is part of RetroFE.
*
|
||||||
*
|
|
||||||
* RetroFE is free software: you can redistribute it and/or modify
|
* RetroFE is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -31,6 +30,8 @@ public:
|
|||||||
void setText(std::string text);
|
void setText(std::string text);
|
||||||
void allocateGraphicsMemory();
|
void allocateGraphicsMemory();
|
||||||
void freeGraphicsMemory();
|
void freeGraphicsMemory();
|
||||||
|
void deInitializeFonts();
|
||||||
|
void initializeFonts();
|
||||||
void draw();
|
void draw();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@ -1049,6 +1049,42 @@ void Page::allocateGraphicsMemory()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Page::deInitializeFonts()
|
||||||
|
{
|
||||||
|
for(MenuVector_T::iterator it = menus_.begin(); it != menus_.end(); it++)
|
||||||
|
{
|
||||||
|
for(std::vector<ScrollingList *>::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<Component *>::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<ScrollingList *>::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<Component *>::iterator it = LayerComponents.begin(); it != LayerComponents.end(); ++it)
|
||||||
|
{
|
||||||
|
(*it)->initializeFonts( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Page::launchEnter()
|
void Page::launchEnter()
|
||||||
{
|
{
|
||||||
if(selectSoundChunk_)
|
if(selectSoundChunk_)
|
||||||
|
|||||||
@ -87,6 +87,8 @@ public:
|
|||||||
void draw();
|
void draw();
|
||||||
void freeGraphicsMemory();
|
void freeGraphicsMemory();
|
||||||
void allocateGraphicsMemory();
|
void allocateGraphicsMemory();
|
||||||
|
void deInitializeFonts( );
|
||||||
|
void initializeFonts( );
|
||||||
void launchEnter();
|
void launchEnter();
|
||||||
std::string getCollectionName();
|
std::string getCollectionName();
|
||||||
void setMinShowTime(float value);
|
void setMinShowTime(float value);
|
||||||
|
|||||||
@ -187,6 +187,7 @@ void RetroFE::freeGraphicsMemory( )
|
|||||||
config_.getProperty( "unloadSDL", unloadSDL );
|
config_.getProperty( "unloadSDL", unloadSDL );
|
||||||
if ( unloadSDL )
|
if ( unloadSDL )
|
||||||
{
|
{
|
||||||
|
currentPage_->deInitializeFonts( );
|
||||||
SDL::deInitialize( );
|
SDL::deInitialize( );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +204,7 @@ void RetroFE::allocateGraphicsMemory( )
|
|||||||
if ( unloadSDL )
|
if ( unloadSDL )
|
||||||
{
|
{
|
||||||
SDL::initialize( config_ );
|
SDL::initialize( config_ );
|
||||||
|
currentPage_->initializeFonts( );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate textures
|
// Allocate textures
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user