Jeck - CommonRes transparently finds themed versions of files. Use JRenderer::LoadTexture for unthemed files, and CommonRes::LoadTexture for themed files. Res/graphics/back.jpg renamed to Res/graphics/backdrop.jpg due to collision with sets/back.jpg.
This commit is contained in:
@@ -20,10 +20,7 @@
|
||||
#include <JSprite.h>
|
||||
#include <JLBFont.h>
|
||||
#include <hge/hgeparticle.h>
|
||||
|
||||
|
||||
#include <JResourceManager.h>
|
||||
|
||||
#include "../include/WResourceManager.h"
|
||||
|
||||
#include "../include/GameState.h"
|
||||
#include "../include/GameOptions.h"
|
||||
@@ -86,7 +83,7 @@ class GameApp: public JApp
|
||||
|
||||
void LoadGameStates();
|
||||
void SetNextState(int state);
|
||||
static JResourceManager * CommonRes;
|
||||
static WResourceManager * CommonRes;
|
||||
static hgeParticleSystem * Particles[6];
|
||||
static int HasMusic;
|
||||
static string systemError;
|
||||
|
||||
@@ -30,6 +30,7 @@ struct Options {
|
||||
static const string OSD;
|
||||
static const string ACTIVE_PROFILE;
|
||||
static const string ACTIVE_THEME;
|
||||
static const string ACTIVE_MODE;
|
||||
};
|
||||
|
||||
struct Metrics {
|
||||
@@ -115,7 +116,6 @@ public:
|
||||
//The sanity=false option returns the adjusted path even if the file doesn't exist.
|
||||
string profileFile(string filename="", string fallback="", bool sanity=true,bool relative=false);
|
||||
string modeFile(string filename, string fallback, bool relative);
|
||||
string themeGraphic(string filename);
|
||||
|
||||
void checkProfile();
|
||||
void createUsersFirstDeck(int setId);
|
||||
|
||||
@@ -172,7 +172,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
}
|
||||
|
||||
|
||||
pspIconsTexture = JRenderer::GetInstance()->LoadTexture(options.themeGraphic("iconspsp.png").c_str(), TEX_TYPE_USE_VRAM);
|
||||
pspIconsTexture = GameApp::CommonRes->LoadTexture("iconspsp.png", TEX_TYPE_USE_VRAM);
|
||||
|
||||
for (int i=0; i < 8; i++){
|
||||
pspIcons[i] = NEW JQuad(pspIconsTexture, i*32, 0, 32, 32);
|
||||
@@ -182,7 +182,7 @@ class GameStateDeckViewer: public GameState, public JGuiListener
|
||||
backQuad = GameApp::CommonRes->GetQuad("back");
|
||||
|
||||
//menuFont = NEW JLBFont("graphics/f3",16);
|
||||
menuFont = GameApp::CommonRes->GetJLBFont("graphics/f3");
|
||||
menuFont = GameApp::CommonRes->GetJLBFont("f3");
|
||||
welcome_menu = NEW SimpleMenu(10,this,menuFont,20,20);
|
||||
int nbDecks = fillDeckMenu(welcome_menu,options.profileFile());
|
||||
welcome_menu->Add(nbDecks+1, "--NEW--");
|
||||
|
||||
47
projects/mtg/include/WResourceManager.h
Normal file
47
projects/mtg/include/WResourceManager.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef _WRESOURCEMANAGER_H_
|
||||
#define _WRESOURCEMANAGER_H_
|
||||
#include <JResourceManager.h>
|
||||
#include <JTypes.h>
|
||||
|
||||
//This class is a wrapper for JResourceManager
|
||||
class WResourceManager
|
||||
{
|
||||
public:
|
||||
WResourceManager();
|
||||
~WResourceManager();
|
||||
|
||||
//Wrapped from JResourceManager
|
||||
int CreateTexture(const string &textureName);
|
||||
JTexture* GetTexture(const string &textureName);
|
||||
JTexture* GetTexture(int id);
|
||||
|
||||
int CreateQuad(const string &quadName, const string &textureName, float x, float y, float width, float height);
|
||||
JQuad* GetQuad(const string &quadName);
|
||||
JQuad* GetQuad(int id);
|
||||
|
||||
int LoadJLBFont(const string &fontName, int height);
|
||||
JLBFont* GetJLBFont(const string &fontName);
|
||||
JLBFont* GetJLBFont(int id);
|
||||
|
||||
int LoadMusic(const string &musicName);
|
||||
JMusic* GetMusic(const string &musicName);
|
||||
JMusic* GetMusic(int id);
|
||||
|
||||
int LoadSample(const string &sampleName);
|
||||
JSample* GetSample(const string &sampleName);
|
||||
JSample* GetSample(int id);
|
||||
|
||||
//Wrapped from JRenderer, if we need it.
|
||||
JTexture* LoadTexture(const char* filename, int mode = 0, int textureFormat = TEXTURE_FORMAT);
|
||||
|
||||
//Our new redirect system.
|
||||
string graphicsFile(const string filename, const string specific = "");
|
||||
string musicFile(const string filename, const string specific = "");
|
||||
string sfxFile(const string filename, const string specific = "");
|
||||
bool fileOK(string filename, bool relative = false);
|
||||
|
||||
private:
|
||||
static JResourceManager * jrm;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user