- renamed WResourceManager::autoResize() to ResetCacheLimits(), since the function doesn't actually resize anything. It's merely setting clamping limits on when we should purge the cache.
- fixed the debug framerate calculation / drawing code (consolidated duplicated functions & variables mDelta vs a win-only mDeltaTime, no reason to have two), repositioned it to draw on the bottom left (it was colliding with other debug text for the cache info). - for debug testing purposes, added a #define override to force the image cache to work with less memory (I've picked 8 megs, which is what the psp seems to use - the normal default on win/linux is 20 megs).
This commit is contained in:
@@ -235,12 +235,12 @@ void GameApp::Destroy()
|
||||
{
|
||||
LOG("==Destroying GameApp==");
|
||||
for (int i=GAME_STATE_MENU;i<=GAME_STATE_MAX-1;i++)
|
||||
{
|
||||
if (mGameStates[i]){
|
||||
mGameStates[i]->Destroy();
|
||||
SAFE_DELETE(mGameStates[i]);
|
||||
}
|
||||
{
|
||||
if (mGameStates[i]){
|
||||
mGameStates[i]->Destroy();
|
||||
SAFE_DELETE(mGameStates[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (collection){
|
||||
collection->destroyAllCards();
|
||||
@@ -361,7 +361,7 @@ void GameApp::Render()
|
||||
sprintf(buf, "avg:%.02f - %.02f fps",totalFPS/nbUpdates, fps);
|
||||
if (mFont) {
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(buf,1,10);
|
||||
mFont->DrawString(buf, 10, SCREEN_HEIGHT-15);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -445,7 +445,7 @@ void GameStateMenu::Update(float dt)
|
||||
genNbCardsStr();
|
||||
resetDirectory();
|
||||
//All major things have been loaded, resize the cache to use it as efficiently as possible
|
||||
resources.autoResize();
|
||||
resources.ResetCacheLimits();
|
||||
}
|
||||
break;
|
||||
case MENU_STATE_MAJOR_FIRST_TIME :
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#endif
|
||||
#include "WFont.h"
|
||||
|
||||
//#define FORCE_LOW_CACHE_MEMORY
|
||||
const unsigned int kConstrainedCacheLimit = 8 * 1024 * 1024;
|
||||
|
||||
extern bool neofont;
|
||||
int idCounter = OTHERS_OFFSET;
|
||||
WResourceManager resources;
|
||||
@@ -933,9 +936,13 @@ void WResourceManager::RemoveWFonts() {
|
||||
mWFontMap.clear();
|
||||
}
|
||||
|
||||
void WResourceManager::autoResize(){
|
||||
void WResourceManager::ResetCacheLimits(){
|
||||
#if defined WIN32 || defined LINUX
|
||||
#ifdef FORCE_LOW_CACHE_MEMORY
|
||||
textureWCache.Resize(kConstrainedCacheLimit, MAX_CACHE_OBJECTS);
|
||||
#else
|
||||
textureWCache.Resize(HUGE_CACHE_LIMIT,MAX_CACHE_OBJECTS);
|
||||
#endif
|
||||
#else
|
||||
unsigned int ram = ramAvailable();
|
||||
unsigned int myNewSize = ram - OPERATIONAL_SIZE + textureWCache.totalSize;
|
||||
|
||||
Reference in New Issue
Block a user