Refactoring of some of the font management in WResourceManager. This change looks bigger than it actually is - most of the touched files are simply renaming of some font enums that I moved out of MTGDefinitions into the resource manager header files. The main points of this change: collapsing the font containers into a single map, eliminating duplicated functions, and migrating the font building logic into the resource manager class. GameApp doesn't need to know anything about the fonts it uses, and likewise, font users don't need to know what the name of their chosen font is, just the FONT_TYPE enum.
(I did a cursory check to make sure chinese still displays correctly - at a glance, I'm seeing what looks correct to someone who doesn't read the language :) )
This commit is contained in:
@@ -171,11 +171,6 @@ class Constants
|
||||
CHANCE_PURE_OVERRIDE = 50,
|
||||
CHANCE_MIXED_OVERRIDE = 25,
|
||||
|
||||
MAIN_FONT = 0,
|
||||
MENU_FONT = 1,
|
||||
MAGIC_FONT = 2,
|
||||
OPTION_FONT = 1,
|
||||
|
||||
GRADE_SUPPORTED = 0,
|
||||
GRADE_BORDERLINE = 1,
|
||||
GRADE_UNOFFICIAL = 2,
|
||||
|
||||
@@ -6,10 +6,27 @@
|
||||
#include <JSprite.h>
|
||||
#include "config.h"
|
||||
|
||||
namespace Fonts
|
||||
{
|
||||
enum Font_Type
|
||||
{
|
||||
MAIN_FONT = 0,
|
||||
MENU_FONT = 1,
|
||||
OPTION_FONT = 1,
|
||||
MAGIC_FONT = 2,
|
||||
SMALLFACE_FONT = 3
|
||||
};
|
||||
|
||||
// when using gbk languages and we need to keep around single byte font variants,
|
||||
// the single byte fonts will be offset by this value
|
||||
const unsigned int kSingleByteFontOffset = 100;
|
||||
}
|
||||
|
||||
|
||||
class WFont
|
||||
{
|
||||
public:
|
||||
unsigned char id;
|
||||
int mFontID;
|
||||
// Rendering text to screen.
|
||||
virtual void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
|
||||
virtual void DrawString(std::string s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0) = 0;
|
||||
@@ -29,13 +46,16 @@ public:
|
||||
virtual void SetTracking(float tracking) = 0;
|
||||
// Set Base for the character set to use.
|
||||
virtual void SetBase(int base) = 0;
|
||||
WFont(int inID) : mFontID(inID) {};
|
||||
virtual ~WFont() {};
|
||||
};
|
||||
|
||||
class WLBFont : public WFont
|
||||
{
|
||||
public:
|
||||
WLBFont(const char *fontname, int lineheight, bool useVideoRAM=false) {
|
||||
WLBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM=false)
|
||||
: WFont(inFontID)
|
||||
{
|
||||
it = NEW JLBFont(fontname,lineheight,useVideoRAM);
|
||||
};
|
||||
~WLBFont() {SAFE_DELETE(it);};
|
||||
@@ -58,7 +78,7 @@ private:
|
||||
class WFBFont : public WFont
|
||||
{
|
||||
public:
|
||||
WFBFont(const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
WFBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM=false);
|
||||
~WFBFont();
|
||||
|
||||
void DrawString(const char *s, float x, float y, int align=JGETEXT_LEFT, float leftOffset = 0, float width = 0);
|
||||
|
||||
@@ -178,16 +178,12 @@ public:
|
||||
JTexture* GetTexture(const string &textureName);
|
||||
JTexture* GetTexture(int id);
|
||||
|
||||
int reloadWFonts();
|
||||
int reloadWLBFonts();
|
||||
//Wrapped from JResourceManger. TODO: Privatize
|
||||
WFont * LoadWLBFont(const string &fontName, int height);
|
||||
WFont * LoadWFBFont(const string &fontName, int height);
|
||||
WFont * GetWFont(const string &fontName);
|
||||
// Font management functions
|
||||
void InitFonts(const std::string& inLang);
|
||||
int ReloadWFonts();
|
||||
WFont* LoadWFont(const string& inFontname, int inFontHeight, int inFontID);
|
||||
WFont* GetWFont(int id);
|
||||
WFont * GetWLBFont(int id);
|
||||
void RemoveWFonts();
|
||||
void RemoveWLBFonts();
|
||||
|
||||
//Wrapped from JSoundSystem. TODO: Privatize.
|
||||
JMusic * ssLoadMusic(const char *fileName);
|
||||
@@ -219,10 +215,10 @@ private:
|
||||
//Statistics of record.
|
||||
unsigned int lastTime;
|
||||
int lastError;
|
||||
vector<WFont *> mWFontList;
|
||||
map<string, int> mWFontMap;
|
||||
vector<WLBFont *> mWLBFontList;
|
||||
map<string, int> mWLBFontMap;
|
||||
|
||||
typedef std::map<int, WFont*> FontMap;
|
||||
FontMap mWFontMap;
|
||||
std::string mFontFileExtension;
|
||||
};
|
||||
|
||||
extern WResourceManager resources;
|
||||
|
||||
@@ -152,7 +152,7 @@ void AIStats::Render(){
|
||||
if (player == g->players[1]) x0 = 280;
|
||||
JRenderer::GetInstance()->FillRoundRect(x0,10,200,180,5,ARGB(50,0,0,0));
|
||||
|
||||
WFont * f = resources.GetWFont("simon");
|
||||
WFont * f = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
int i = 0;
|
||||
char buffer[512];
|
||||
list<AIStat *>::iterator it;
|
||||
|
||||
@@ -225,7 +225,7 @@ void ActionLayer::setMenuObject(Targetable * object, bool must){
|
||||
|
||||
SAFE_DELETE(abilitiesMenu);
|
||||
|
||||
abilitiesMenu = NEW SimpleMenu(10, this, Constants::MAIN_FONT, 100, 100,object->getDisplayName().c_str());
|
||||
abilitiesMenu = NEW SimpleMenu(10, this, Fonts::MAIN_FONT, 100, 100,object->getDisplayName().c_str());
|
||||
|
||||
for (int i=0;i<mCount;i++){
|
||||
ActionElement * currentAction = (ActionElement *)mObjects[i];
|
||||
|
||||
@@ -37,7 +37,7 @@ void NextGamePhase::Render(){
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
int nextPhase = (g->getCurrentGamePhase() + 1) % Constants::MTG_PHASE_CLEANUP;
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
@@ -66,7 +66,7 @@ const string Interruptible::getDisplayName() const
|
||||
}
|
||||
|
||||
void Interruptible::Render(MTGCardInstance * source, JQuad * targetQuad, string alt1, string alt2, string action, bool bigQuad){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->DrawString(_(action).c_str(), x + 30 , y, JGETEXT_LEFT);
|
||||
@@ -317,7 +317,7 @@ int PutInGraveyard::resolve(){
|
||||
}
|
||||
|
||||
void PutInGraveyard::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
if (!removeFromGame){
|
||||
@@ -354,7 +354,7 @@ int DrawAction::resolve(){
|
||||
}
|
||||
|
||||
void DrawAction::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
@@ -789,7 +789,7 @@ void ActionStack::Render(){
|
||||
if (current->state==NOT_RESOLVED) height += current->mHeight;
|
||||
}
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
@@ -845,7 +845,7 @@ void ActionStack::Render(){
|
||||
if (current->display) height += current->mHeight;
|
||||
}
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ void CardGui::Update(float dt)
|
||||
|
||||
void CardGui::Render()
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
GameObserver * game = GameObserver::GetInstance();
|
||||
@@ -215,7 +215,7 @@ void CardGui::alternateRender(MTGCard * card, const Pos& pos){
|
||||
renderer->RenderQuad(q, x, pos.actY, pos.actT, scale, scale);
|
||||
}
|
||||
// Write the title
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
WFont * font = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
float backup_scale = font->GetScale();
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
@@ -418,7 +418,7 @@ void CardGui::tinyCropRender(MTGCard * card, const Pos& pos, JQuad * quad) {
|
||||
renderer->RenderQuad(quad, x, imgY , pos.actT, imgScale, imgScale);
|
||||
|
||||
// Write the title
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
WFont * font = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
float backup_scale = font->GetScale();
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
@@ -612,7 +612,7 @@ void CardGui::RenderBig(MTGCard* card, const Pos& pos){
|
||||
void CardGui::renderCountersBig(const Pos& pos){
|
||||
// Write Named Counters
|
||||
if (card->counters) {
|
||||
WFont * font = resources.GetWFont("magic");
|
||||
WFont * font = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
font->SetColor(ARGB((int)pos.actA, 0, 0, 0));
|
||||
font->SetScale(kWidthScaleFactor * pos.actZ);
|
||||
std::vector<string> txt = card->formattedText();
|
||||
|
||||
@@ -173,9 +173,9 @@ void Credits::Render(){
|
||||
if (!p1) return;
|
||||
GameObserver * g = GameObserver::GetInstance();
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * f3 = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
WFont * f = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Fonts::MENU_FONT);
|
||||
WFont * f3 = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
f->SetScale(1);
|
||||
f->SetColor(ARGB(255,255,255,255));
|
||||
f2->SetScale(1);
|
||||
|
||||
@@ -139,7 +139,7 @@ int Damage::resolve(){
|
||||
return a;
|
||||
}
|
||||
void Damage::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[200];
|
||||
|
||||
@@ -51,7 +51,7 @@ void DamagerDamaged::clearDamage()
|
||||
void DamagerDamaged::Render(CombatStep mode)
|
||||
{
|
||||
TransientCardView::Render();
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0);
|
||||
|
||||
switch (mode)
|
||||
|
||||
@@ -36,7 +36,7 @@ int ExtraCost::setSource(MTGCardInstance * _source){
|
||||
void ExtraCost::Render(){
|
||||
if (!mCostRenderString.empty())
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(mCostRenderString, 20 ,20, JGETEXT_LEFT);
|
||||
|
||||
@@ -149,18 +149,7 @@ void GameApp::Create()
|
||||
LOG("--Loading fonts");
|
||||
string lang = options[Options::LANG].str;
|
||||
std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);
|
||||
if (lang.compare("cn") == 0) {
|
||||
resources.LoadWFBFont("simon",12);
|
||||
resources.LoadWFBFont("f3",16);
|
||||
resources.LoadWFBFont("magic",16);
|
||||
resources.LoadWFBFont("smallface",12);
|
||||
}
|
||||
resources.LoadWLBFont("simon",11);
|
||||
resources.GetWFont("simon")->SetTracking(-1);
|
||||
resources.LoadWLBFont("f3",16);
|
||||
resources.LoadWLBFont("magic",16);
|
||||
resources.LoadWLBFont("smallface", 7);
|
||||
|
||||
resources.InitFonts(lang);
|
||||
|
||||
LOG("--Loading various textures");
|
||||
resources.RetrieveTexture("phasebar.png",RETRIEVE_MANAGE);
|
||||
@@ -334,7 +323,7 @@ void GameApp::Render()
|
||||
{
|
||||
if (systemError.size()){
|
||||
fprintf(stderr, "%s", systemError.c_str());
|
||||
WFont * mFont= resources.GetWFont("simon");
|
||||
WFont * mFont= resources.GetWFont(Fonts::MAIN_FONT);
|
||||
if (mFont) mFont->DrawString(systemError.c_str(),1,1);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ void GameStateAwards::Update(float dt)
|
||||
case JGE_BTN_MENU:
|
||||
showMenu = true;
|
||||
SAFE_DELETE(menu);
|
||||
menu = NEW SimpleMenu(-102, this,Constants::MENU_FONT, 50,170);
|
||||
menu = NEW SimpleMenu(-102, this,Fonts::MENU_FONT, 50,170);
|
||||
if(mState == STATE_DETAILS)
|
||||
menu->Add(2, "Back to Trophies");
|
||||
menu->Add(1, "Back to Main Menu");
|
||||
|
||||
@@ -132,7 +132,7 @@ void GameStateDeckViewer::switchDisplay(){
|
||||
|
||||
void GameStateDeckViewer::updateDecks(){
|
||||
SAFE_DELETE(welcome_menu);
|
||||
welcome_menu = NEW SimpleMenu( MENU_DECK_SELECTION, this, Constants::MENU_FONT,20,20);
|
||||
welcome_menu = NEW SimpleMenu( MENU_DECK_SELECTION, this, Fonts::MENU_FONT,20,20);
|
||||
DeckManager * deckManager = DeckManager::GetInstance();
|
||||
vector<DeckMetaData *> playerDeckList = fillDeckMenu( welcome_menu,options.profileFile());
|
||||
|
||||
@@ -172,7 +172,7 @@ void GameStateDeckViewer::Start()
|
||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||
displayed_deck = myCollection;
|
||||
//Build menu.
|
||||
menu = NEW SimpleMenu( MENU_DECK_BUILDER, this, Constants::MENU_FONT,SCREEN_WIDTH/2-150,20);
|
||||
menu = NEW SimpleMenu( MENU_DECK_BUILDER, this, Fonts::MENU_FONT,SCREEN_WIDTH/2-150,20);
|
||||
menu->Add( MENU_ITEM_FILTER_BY, "Filter by...");
|
||||
menu->Add( MENU_ITEM_SWITCH_DECKS_NO_SAVE, "Switch decks without saving");
|
||||
menu->Add( MENU_ITEM_SAVE_RENAME, "Save & Rename");
|
||||
@@ -340,7 +340,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
if (card && displayed_deck->count(card)){
|
||||
price = pricelist->getSellPrice(card->getMTGId());
|
||||
sprintf(buffer,"%s : %i %s",_(card->data->getName()).c_str(),price,_("credits").c_str());
|
||||
subMenu = NEW SimpleMenu( MENU_CARD_PURCHASE, this, Constants::MAIN_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,buffer);
|
||||
subMenu = NEW SimpleMenu( MENU_CARD_PURCHASE, this, Fonts::MAIN_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,buffer);
|
||||
subMenu->Add( MENU_ITEM_YES,"Yes");
|
||||
subMenu->Add( MENU_ITEM_NO,"No","",true);
|
||||
}
|
||||
@@ -466,7 +466,7 @@ void GameStateDeckViewer::Update(float dt)
|
||||
|
||||
|
||||
void GameStateDeckViewer::renderOnScreenBasicInfo(){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
char buffer[256];
|
||||
int myD = (displayed_deck == myDeck);
|
||||
|
||||
@@ -500,7 +500,7 @@ int GameStateDeckViewer::getCurrentPos() {
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::renderSlideBar(){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
int total = displayed_deck->Size();
|
||||
if(total == 0)
|
||||
@@ -568,7 +568,7 @@ void GameStateDeckViewer::renderDeckBackground(){
|
||||
|
||||
void GameStateDeckViewer::renderOnScreenMenu(){
|
||||
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
float pspIconsSize = 0.5;
|
||||
@@ -1229,7 +1229,7 @@ int GameStateDeckViewer::countCardsByType(const char * _type) {
|
||||
}
|
||||
|
||||
void GameStateDeckViewer::renderCard(int id, float rotation){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
MTGCard * card = cardIndex[id];
|
||||
|
||||
float max_scale = 0.96f;
|
||||
@@ -1310,7 +1310,7 @@ void GameStateDeckViewer::renderCard (int id){
|
||||
|
||||
void GameStateDeckViewer::Render() {
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
@@ -91,7 +91,7 @@ void GameStateDuel::Start()
|
||||
for (int i = 0; i<2; i ++){
|
||||
if (mParent->players[i] == PLAYER_TYPE_HUMAN){
|
||||
decksneeded = 1;
|
||||
deckmenu = NEW SimpleMenu(DUEL_MENU_CHOOSE_DECK, this, Constants::MENU_FONT, 35, 25, "Choose a Deck");
|
||||
deckmenu = NEW SimpleMenu(DUEL_MENU_CHOOSE_DECK, this, Fonts::MENU_FONT, 35, 25, "Choose a Deck");
|
||||
|
||||
DeckManager *deckManager = DeckManager::GetInstance();
|
||||
vector<DeckMetaData *> playerDeckList = getValidDeckMetaData( options.profileFile() );
|
||||
@@ -236,7 +236,7 @@ bool GameStateDuel::MusicExist(string FileName){
|
||||
|
||||
void GameStateDuel::ensureOpponentMenu(){
|
||||
if (!opponentMenu){
|
||||
opponentMenu = NEW SimpleMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Constants::MENU_FONT, 35, 25, "Choose Opponent");
|
||||
opponentMenu = NEW SimpleMenu(DUEL_MENU_CHOOSE_OPPONENT, this, Fonts::MENU_FONT, 35, 25, "Choose Opponent");
|
||||
opponentMenu->Add( MENUITEM_RANDOM_AI, "Random");
|
||||
if (options[Options::EVILTWIN_MODE_UNLOCKED].number)
|
||||
opponentMenu->Add( MENUITEM_EVIL_TWIN, "Evil Twin", _("Can you play against yourself?").c_str());
|
||||
@@ -375,7 +375,7 @@ void GameStateDuel::Update(float dt)
|
||||
}
|
||||
if (mEngine->GetButtonClick(JGE_BTN_MENU)) {
|
||||
if (!menu) {
|
||||
menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, Constants::MENU_FONT, SCREEN_WIDTH/2-100, 25, game->players[1]->deckName.c_str());
|
||||
menu = NEW SimpleMenu(DUEL_MENU_GAME_MENU, this, Fonts::MENU_FONT, SCREEN_WIDTH/2-100, 25, game->players[1]->deckName.c_str());
|
||||
int cardsinhand = game->players[0]->game->hand->nb_cards;
|
||||
|
||||
//almosthumane - mulligan
|
||||
@@ -428,7 +428,7 @@ void GameStateDuel::Update(float dt)
|
||||
|
||||
void GameStateDuel::Render()
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void GameStateMenu::Create()
|
||||
if (!langChosen){
|
||||
currentState = MENU_STATE_MAJOR_LANG | MENU_STATE_MINOR_NONE;
|
||||
}
|
||||
scroller = NEW TextScroller(Constants::MAIN_FONT, SCREEN_WIDTH/2 - 90 , SCREEN_HEIGHT-17,180);
|
||||
scroller = NEW TextScroller(Fonts::MAIN_FONT, SCREEN_WIDTH/2 - 90 , SCREEN_HEIGHT-17,180);
|
||||
scrollerSet = 0;
|
||||
|
||||
splashTex = NULL;
|
||||
@@ -317,7 +317,7 @@ void GameStateMenu::setLang(int id){
|
||||
|
||||
void GameStateMenu::loadLangMenu(){
|
||||
LOG("GameStateMenu::loadLangMenu");
|
||||
subMenuController = NEW SimpleMenu( MENU_LANGUAGE_SELECTION, this, Constants::MENU_FONT, 150,60);
|
||||
subMenuController = NEW SimpleMenu( MENU_LANGUAGE_SELECTION, this, Fonts::MENU_FONT, 150,60);
|
||||
if (!subMenuController) return;
|
||||
resetDirectory();
|
||||
if (!mDip){
|
||||
@@ -371,7 +371,7 @@ void GameStateMenu::ensureMGuiController(){
|
||||
if (!mGuiController) {
|
||||
mGuiController = NEW JGuiController(100, this);
|
||||
if (mGuiController) {
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"particle1.psi",resources.GetQuad("particles"), true));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"particle2.psi",resources.GetQuad("particles")));
|
||||
@@ -469,7 +469,7 @@ void GameStateMenu::Update(float dt)
|
||||
if (MENU_STATE_MINOR_NONE == (currentState & MENU_STATE_MINOR)) {
|
||||
if (!hasChosenGameType){
|
||||
currentState = MENU_STATE_MAJOR_SUBMENU;
|
||||
subMenuController = NEW SimpleMenu( MENU_FIRST_DUEL_SUBMENU, this, Constants::MENU_FONT, 150,60);
|
||||
subMenuController = NEW SimpleMenu( MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150,60);
|
||||
if (subMenuController){
|
||||
subMenuController->Add(SUBMENUITEM_CLASSIC,"Classic");
|
||||
if (options[Options::MOMIR_MODE_UNLOCKED].number)
|
||||
@@ -547,7 +547,7 @@ void GameStateMenu::Render()
|
||||
return;
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LANG){
|
||||
}else if ((currentState & MENU_STATE_MAJOR) == MENU_STATE_MAJOR_LOADING_CARDS){
|
||||
if(!splashTex){
|
||||
@@ -580,7 +580,7 @@ void GameStateMenu::Render()
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
mFont->DrawString(text,SCREEN_WIDTH/2,SCREEN_HEIGHT - 50,JGETEXT_CENTER);
|
||||
}else{
|
||||
mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
PIXEL_TYPE colors[] =
|
||||
{
|
||||
|
||||
@@ -614,7 +614,7 @@ void GameStateMenu::Render()
|
||||
if(options.newAward())
|
||||
alp = (int)(sin(timeIndex) * 255);
|
||||
float olds = mFont->GetScale();
|
||||
mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
jq->SetColor(ARGB(abs(alp),255,255,255));
|
||||
mFont->SetColor(ARGB(abs(alp),0,0,0));
|
||||
string s = _("Trophy Room");;
|
||||
@@ -622,7 +622,7 @@ void GameStateMenu::Render()
|
||||
mFont->SetScale(50.0f/mFont->GetStringWidth(s.c_str()));
|
||||
renderer->RenderQuad(jq, SCREEN_WIDTH-64, 2);
|
||||
mFont->DrawString(s,SCREEN_WIDTH-10,9,JGETEXT_RIGHT);
|
||||
mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
mFont->SetScale(olds);
|
||||
}
|
||||
}
|
||||
@@ -634,13 +634,13 @@ void GameStateMenu::Render()
|
||||
|
||||
void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
|
||||
DebugTrace("GameStateMenu: controllerId " << controllerId << " selected");
|
||||
switch (controllerId){
|
||||
case MENU_LANGUAGE_SELECTION:
|
||||
setLang(controlId);
|
||||
resources.reloadWFonts(); // Fix for choosing Chinese language at first time.
|
||||
resources.ReloadWFonts(); // Fix for choosing Chinese language at first time.
|
||||
subMenuController->Close();
|
||||
currentState = MENU_STATE_MAJOR_LOADING_CARDS | MENU_STATE_MINOR_SUBMENU_CLOSING;
|
||||
break;
|
||||
@@ -652,7 +652,7 @@ void GameStateMenu::ButtonPressed(int controllerId, int controlId)
|
||||
switch (controlId)
|
||||
{
|
||||
case MENUITEM_PLAY:
|
||||
subMenuController = NEW SimpleMenu( MENU_FIRST_DUEL_SUBMENU, this, Constants::MENU_FONT, 150,60);
|
||||
subMenuController = NEW SimpleMenu( MENU_FIRST_DUEL_SUBMENU, this, Fonts::MENU_FONT, 150,60);
|
||||
if (subMenuController){
|
||||
subMenuController->Add(SUBMENUITEM_1PLAYER,"1 Player");
|
||||
// TODO Put 2 players mode back
|
||||
|
||||
@@ -87,7 +87,7 @@ void GameStateOptions::Start()
|
||||
optionsList->failMsg = "";
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsMenu = NEW SimpleMenu(-102, this,Constants::MENU_FONT, 50,170);
|
||||
optionsMenu = NEW SimpleMenu(-102, this,Fonts::MENU_FONT, 50,170);
|
||||
optionsMenu->Add(2, "Back to Main Menu");
|
||||
optionsMenu->Add(1, "Save & Back to Main Menu");
|
||||
optionsMenu->Add(3, "Cancel");
|
||||
@@ -212,7 +212,7 @@ void GameStateOptions::Render()
|
||||
"Please support this project with donations at http://wololo.net/wagic",
|
||||
};
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
mFont->SetColor(ARGB(255,200,200,200));
|
||||
mFont->SetScale(1.0);
|
||||
float startpos = 272 - timer;
|
||||
|
||||
@@ -166,15 +166,15 @@ string GameStateShop::descPurchase(int controlId, bool tiny){
|
||||
return buffer;
|
||||
}
|
||||
void GameStateShop::beginPurchase(int controlId){
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
mFont->SetScale(DEFAULT_MENU_FONT_SCALE);
|
||||
SAFE_DELETE(menu);
|
||||
if(mInventory[controlId] <= 0){
|
||||
menu = NEW SimpleMenu(-145,this,Constants::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,_("Sold Out").c_str());
|
||||
menu = NEW SimpleMenu(-145,this,Fonts::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,_("Sold Out").c_str());
|
||||
menu->Add(-1,"Ok");
|
||||
}
|
||||
else if(playerdata->credits - mPrices[controlId] < 0){
|
||||
menu = NEW SimpleMenu(-145,this,Constants::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,_("Not enough credits").c_str());
|
||||
menu = NEW SimpleMenu(-145,this,Fonts::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,_("Not enough credits").c_str());
|
||||
menu->Add(-1,"Ok");
|
||||
if(options[Options::CHEATMODE].number) {
|
||||
menu->Add(-2,"Steal it");
|
||||
@@ -186,7 +186,7 @@ void GameStateShop::beginPurchase(int controlId){
|
||||
sprintf(buf,_("Purchase Booster: %i credits").c_str(),mPrices[controlId]);
|
||||
else
|
||||
sprintf(buf,_("Purchase Card: %i credits").c_str(),mPrices[controlId]);
|
||||
menu = NEW SimpleMenu(-145,this,Constants::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,buf);
|
||||
menu = NEW SimpleMenu(-145,this,Fonts::MENU_FONT,SCREEN_WIDTH-300,SCREEN_HEIGHT/2,buf);
|
||||
|
||||
menu->Add(controlId,"Yes");
|
||||
menu->Add(-1,"No");
|
||||
@@ -410,7 +410,7 @@ void GameStateShop::Update(float dt)
|
||||
if (menu)
|
||||
menu->Update(dt);
|
||||
else{
|
||||
menu = NEW SimpleMenu(11,this,Constants::MENU_FONT,SCREEN_WIDTH/2-100,20);
|
||||
menu = NEW SimpleMenu(11,this,Fonts::MENU_FONT,SCREEN_WIDTH/2-100,20);
|
||||
menu->Add(22,"Ask about...");
|
||||
menu->Add(14,"Check task board");
|
||||
if (options[Options::CHEATMODE].number)
|
||||
@@ -433,7 +433,7 @@ void GameStateShop::Update(float dt)
|
||||
return;
|
||||
} else if (taskList->getState() == TaskList::TASKS_ACTIVE && btn == JGE_BTN_MENU){
|
||||
if (!menu) {
|
||||
menu = NEW SimpleMenu(11,this,Constants::MENU_FONT,SCREEN_WIDTH/2-100,20);
|
||||
menu = NEW SimpleMenu(11,this,Fonts::MENU_FONT,SCREEN_WIDTH/2-100,20);
|
||||
menu->Add(15,"Return to shop");
|
||||
menu->Add(12,"Save & Back to Main Menu");
|
||||
menu->Add(13, "Cancel");
|
||||
@@ -550,7 +550,7 @@ void GameStateShop::deleteDisplay(){
|
||||
void GameStateShop::Render()
|
||||
{
|
||||
//Erase
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
r->ClearScreen(ARGB(0,0,0,0));
|
||||
if(mStage == STAGE_FADE_IN)
|
||||
|
||||
@@ -44,7 +44,7 @@ void GameStateStory::loadStoriesMenu(const char * root){
|
||||
flow = NEW StoryFlow(stories[0]);
|
||||
break;
|
||||
default:
|
||||
menu = NEW SimpleMenu(103, this, Constants::MENU_FONT, 150,60);
|
||||
menu = NEW SimpleMenu(103, this, Fonts::MENU_FONT, 150,60);
|
||||
for (size_t i = 0; i < stories.size(); ++i){
|
||||
menu->Add(i, stories[i].c_str());
|
||||
}
|
||||
@@ -60,7 +60,7 @@ void GameStateStory::Start() {
|
||||
|
||||
void GameStateStory::Update(float dt) {
|
||||
if (!menu && mEngine->GetButtonClick(JGE_BTN_MENU)){
|
||||
menu = NEW SimpleMenu(100, this, Constants::MENU_FONT, SCREEN_WIDTH/2-100, 25);
|
||||
menu = NEW SimpleMenu(100, this, Fonts::MENU_FONT, SCREEN_WIDTH/2-100, 25);
|
||||
menu->Add(0,"Back to main menu");
|
||||
menu->Add(-1, "Cancel");
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ void GuiCombat::Render()
|
||||
{
|
||||
go->opponent()->mAvatar->SetHotSpot(18, 25);
|
||||
enemy_avatar.Render(go->opponent()->mAvatar);
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255, 255, 64, 0));
|
||||
{
|
||||
char buf[10]; sprintf(buf, "%i", damage);
|
||||
@@ -310,7 +310,7 @@ void GuiCombat::Render()
|
||||
renderer->DrawLine(0, SCREEN_HEIGHT / 2 + 10, SCREEN_WIDTH, SCREEN_HEIGHT / 2 + 10, ARGB(255, 255, 64, 0));
|
||||
if (FIRST_STRIKE == step)
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255, 64, 255, 64));
|
||||
mFont->DrawString("First strike damage", 370, 2);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void GuiHandSelf::Render()
|
||||
{
|
||||
//Empty hand
|
||||
if (state == Open && cards.size() == 0){
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetColor(ARGB(255,255,0,0));
|
||||
if (OptionHandDirection::HORIZONTAL == options[Options::HANDDIRECTION].number){
|
||||
back->SetColor(ARGB(255,255,0,0));
|
||||
|
||||
@@ -213,7 +213,7 @@ GuiMana::~GuiMana(){
|
||||
void GuiMana::RenderStatic(){
|
||||
int values[Constants::MTG_NB_COLORS];
|
||||
int totalColors = 0;
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
for (int i = 0; i < Constants::MTG_NB_COLORS; ++i)
|
||||
values[i] = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ void GuiPhaseBar::Render()
|
||||
}
|
||||
|
||||
//print phase name
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
string currentP = _("your turn");
|
||||
string interrupt = "";
|
||||
if (g->currentPlayer == g->players[1]){
|
||||
|
||||
@@ -23,7 +23,7 @@ void GuiAvatar::Render()
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
int life = player->life;
|
||||
int poisonCount = player->poisonCount;
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
//Avatar
|
||||
int lifeDiff = life - currentLife;
|
||||
@@ -152,7 +152,7 @@ void GuiGameZone::Render(){
|
||||
JRenderer::GetInstance()->FillRect(actX,actY,quad->mWidth * scale * actZ,quad->mHeight *scale * actZ, ARGB(abs(128 - wave),255,255,255));
|
||||
|
||||
//Number of cards
|
||||
WFont * mFont = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
char buffer[11];
|
||||
int mAlpha = (int)(actA);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
MTGGamePhase::MTGGamePhase(int id):ActionElement(id){
|
||||
animation = 0;
|
||||
currentState = -1;
|
||||
mFont= resources.GetWFont("simon");
|
||||
mFont= resources.GetWFont(Fonts::MAIN_FONT);
|
||||
mFont->SetBase(0); // using 2nd font
|
||||
}
|
||||
|
||||
|
||||
@@ -1034,7 +1034,7 @@ void MTGMomirRule::Update(float dt){
|
||||
|
||||
void MTGMomirRule::Render(){
|
||||
if (!textAlpha) return;
|
||||
WFont * mFont = resources.GetWFont(Constants::MENU_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
mFont->SetScale(2 - (float)textAlpha/130);
|
||||
mFont->SetColor(ARGB(textAlpha,255,255,255));
|
||||
mFont->DrawString(text.c_str(),SCREEN_WIDTH/2,SCREEN_HEIGHT/2,JGETEXT_CENTER);
|
||||
@@ -1130,7 +1130,7 @@ void HUDDisplay::Render(){
|
||||
HUDDisplay::HUDDisplay(int _id):MTGAbility(_id, NULL){
|
||||
timestamp = 0;
|
||||
popdelay = 2;
|
||||
f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
f = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
maxWidth = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ OptionItem::OptionItem( int _id, string _displayValue): WGuiItem(_displayValue)
|
||||
|
||||
//OptionInteger
|
||||
void OptionInteger::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -68,7 +68,7 @@ void OptionSelect::Entering(JButton key){
|
||||
}
|
||||
|
||||
void OptionSelect::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
@@ -165,7 +165,7 @@ void OptionProfile::populate(){
|
||||
|
||||
void OptionProfile::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetScale(1);
|
||||
int spacing = 2+(int)mFont->GetHeight();
|
||||
|
||||
@@ -426,7 +426,7 @@ void OptionTheme::Render(){
|
||||
renderer->RenderQuad(q,x, y,0,scale,scale);
|
||||
}
|
||||
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_HEADER));
|
||||
mFont->DrawString(buf, x + 2, y + 2);
|
||||
if(bChecked && author.size()){
|
||||
@@ -464,7 +464,7 @@ OptionKey::OptionKey(GameStateOptions* g, LocalKeySym from, JButton to) : WGuiIt
|
||||
|
||||
void OptionKey::Update(float dt) { if (btnMenu) btnMenu->Update(dt); }
|
||||
void OptionKey::Render() {
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -514,7 +514,7 @@ void OptionKey::KeyPressed(LocalKeySym key) {
|
||||
g->UngrabKeyboard(this);
|
||||
grabbed = false;
|
||||
|
||||
btnMenu = NEW SimpleMenu(0, this, Constants::MENU_FONT, 80, 10);
|
||||
btnMenu = NEW SimpleMenu(0, this, Fonts::MENU_FONT, 80, 10);
|
||||
for (int i = sizeof(btnList) / sizeof(btnList[0]) - 1; i >= 0; --i) {
|
||||
const KeyRep& rep = translateKey(btnList[i]);
|
||||
btnMenu->Add(i, rep.first.c_str());
|
||||
@@ -524,7 +524,7 @@ bool OptionKey::isModal() { return grabbed || btnMenu; }
|
||||
void OptionKey::Overlay()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(ARGB(255, 0, 0, 0));
|
||||
if (grabbed) {
|
||||
static const int x = 30, y = 45;
|
||||
|
||||
@@ -93,7 +93,7 @@ void SimpleMenu::drawVertPole(int x, int y, int height)
|
||||
}
|
||||
|
||||
void SimpleMenu::Render() {
|
||||
WFont * titleFont = resources.GetWFont("smallface");
|
||||
WFont * titleFont = resources.GetWFont(Fonts::SMALLFACE_FONT);
|
||||
WFont * mFont = resources.GetWFont(fontId);
|
||||
if (0 == mWidth) {
|
||||
float sY = mY + kVerticalMargin;
|
||||
@@ -138,7 +138,7 @@ void SimpleMenu::Render() {
|
||||
if (i > mCount-1) break;
|
||||
if ((static_cast<SimpleMenuItem*>(mObjects[i]))->mY - kLineHeight * startId < mY + height - kLineHeight + 7) {
|
||||
if (static_cast<SimpleMenuItem*>(mObjects[i])->hasFocus()){
|
||||
resources.GetWFont(Constants::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*>(mObjects[i])->desc.c_str(),mX+mWidth+10,mY+15);
|
||||
resources.GetWFont(Fonts::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*>(mObjects[i])->desc.c_str(),mX+mWidth+10,mY+15);
|
||||
mFont->SetColor(ARGB(255,255,255,0));
|
||||
} else
|
||||
mFont->SetColor(ARGB(150,255,255,255));
|
||||
|
||||
@@ -299,7 +299,7 @@ string SimplePad::Finish() {
|
||||
|
||||
void SimplePad::Render(){
|
||||
//This could use some cleaning up to make margins more explicit
|
||||
WFont * mFont = resources.GetWFont("f3");
|
||||
WFont * mFont = resources.GetWFont(Fonts::MENU_FONT);
|
||||
|
||||
float offX = 0, offY = 0;
|
||||
float kH = mFont->GetHeight();
|
||||
|
||||
@@ -386,7 +386,7 @@ StoryDialog::StoryDialog(TiXmlElement* root, StoryFlow * mParent):StoryPage(mPar
|
||||
graphics.push_back(NEW StoryText(text,x,y,align, font));
|
||||
}
|
||||
else if (strcmp(element->Value(), "title")==0) {
|
||||
graphics.push_back(NEW StoryText(text,x,y,"center", Constants::MENU_FONT));
|
||||
graphics.push_back(NEW StoryText(text,x,y,"center", Fonts::MENU_FONT));
|
||||
}
|
||||
else if (strcmp(element->Value(), "img")==0) {
|
||||
//special case to force center
|
||||
|
||||
@@ -431,9 +431,9 @@ void TaskList::Update(float dt) {
|
||||
void TaskList::Render() {
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
//Setup fonts.
|
||||
WFont * f = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Constants::MAGIC_FONT);
|
||||
WFont * f3 = resources.GetWFont(Constants::MENU_FONT); //OPTION_FONT
|
||||
WFont * f = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
WFont * f2 = resources.GetWFont(Fonts::MAGIC_FONT);
|
||||
WFont * f3 = resources.GetWFont(Fonts::MENU_FONT); //OPTION_FONT
|
||||
f2->SetColor(ARGB(255, 205, 237, 240));
|
||||
f3->SetColor(ARGB(255, 219, 206, 151));
|
||||
|
||||
|
||||
@@ -34,16 +34,16 @@ static PIXEL_TYPE gencolor(int id, PIXEL_TYPE color)
|
||||
r0 = g0 = b0 = 255;
|
||||
|
||||
switch (id) {
|
||||
case 0: // simon 245, 228, 156
|
||||
case Fonts::MAIN_FONT: // simon 245, 228, 156
|
||||
r0 = 245; g0 = 228; b0 = 156;
|
||||
break;
|
||||
case 1: // f3 255, 252, 175
|
||||
case Fonts::MENU_FONT: // f3 255, 252, 175
|
||||
r0 = 255; g0 = 252; b0 = 175;
|
||||
break;
|
||||
case 2: // magic 219, 255, 151
|
||||
case Fonts::MAGIC_FONT: // magic 219, 255, 151
|
||||
r0 = 219; g0 = 255; b0 = 151;
|
||||
break;
|
||||
case 3: // smallface 255, 255, 255
|
||||
case Fonts::SMALLFACE_FONT: // smallface 255, 255, 255
|
||||
r0 = 255; g0 = 255; b0 = 255;
|
||||
break;
|
||||
default:
|
||||
@@ -93,7 +93,8 @@ static int genmana(u8 c)
|
||||
|
||||
JRenderer * WFBFont::mRenderer = NULL;
|
||||
|
||||
WFBFont::WFBFont(const char *fontname, int lineheight, bool useVideoRAM)
|
||||
WFBFont::WFBFont(int inFontID, const char *fontname, int lineheight, bool useVideoRAM)
|
||||
: WFont(inFontID)
|
||||
{
|
||||
mRenderer = JRenderer::GetInstance();
|
||||
|
||||
@@ -312,7 +313,9 @@ void WFBFont::DrawString(const char *s, float x, float y, int align, float leftO
|
||||
unsigned char c = *(unsigned short *)s & 0xFF;
|
||||
if (ISGBK(c) || (s[1] == ':' && s[2] == ' ')) {}
|
||||
else {
|
||||
WFont * mFont = resources.GetWLBFont(id);
|
||||
// tricky: the single byte font is always mFontID + kSingleByteFontOffset!
|
||||
// See WResourceManager::InitFonts()
|
||||
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
|
||||
mFont->SetScale(GetScale());
|
||||
mFont->SetColor(GetColor());
|
||||
mFont->DrawString(s, x, y, align, leftOffset, width);
|
||||
@@ -472,7 +475,7 @@ void WFBFont::DrawString(std::string s, float x, float y, int align, float leftO
|
||||
void WFBFont::SetColor(PIXEL_TYPE color)
|
||||
{
|
||||
mColor0 = color;
|
||||
mColor = gencolor(id, color);
|
||||
mColor = gencolor(mFontID, color);
|
||||
}
|
||||
|
||||
float WFBFont::GetStringWidth(const char *s) const
|
||||
@@ -501,7 +504,7 @@ float WFBFont::GetStringWidth(const char *s) const
|
||||
return xx;
|
||||
}
|
||||
else {
|
||||
WFont * mFont = resources.GetWLBFont(id);
|
||||
WFont * mFont = resources.GetWFont(mFontID + Fonts::kSingleByteFontOffset);
|
||||
mFont->SetScale(GetScale());
|
||||
return mFont->GetStringWidth(s);
|
||||
}
|
||||
|
||||
@@ -65,11 +65,11 @@ void WGuiItem::Entering(JButton key){
|
||||
mFocus = true;
|
||||
}
|
||||
float WGuiItem::minWidth(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
return mFont->GetStringWidth(_(displayValue).c_str())+4;
|
||||
}
|
||||
float WGuiItem::minHeight(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
return mFont->GetHeight();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ bool WGuiItem::Leaving(JButton key){
|
||||
|
||||
void WGuiItem::Render(){
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
DWORD oldcolor = mFont->GetColor();
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
float fH = (height-mFont->GetHeight())/2;
|
||||
@@ -162,7 +162,7 @@ PIXEL_TYPE WDecoStyled::getColor(int type){
|
||||
|
||||
//WGuiHeader
|
||||
void WGuiHeader::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
@@ -263,7 +263,7 @@ void WGuiList::Render(){
|
||||
|
||||
//List is empty.
|
||||
if (!items.size() && failMsg != ""){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
||||
mFont->DrawString(_(failMsg).c_str(),x+width/2, y, JGETEXT_RIGHT);
|
||||
return;
|
||||
@@ -401,7 +401,7 @@ string WDecoEnum::lookupVal(int value){
|
||||
|
||||
void WDecoEnum::Render()
|
||||
{
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
mFont->DrawString(_(getDisplay()).c_str(), getX() + 2, getY() + 3);
|
||||
@@ -451,7 +451,7 @@ void WDecoConfirm::Entering(JButton key){
|
||||
|
||||
SAFE_DELETE(confirmMenu);
|
||||
mState = OP_CONFIRMED;
|
||||
confirmMenu = NEW SimpleMenu(444, listener,Constants::MENU_FONT, 50,170);
|
||||
confirmMenu = NEW SimpleMenu(444, listener,Fonts::MENU_FONT, 50,170);
|
||||
confirmMenu->Add(1,confirm.c_str());
|
||||
confirmMenu->Add(2,cancel.c_str());
|
||||
}
|
||||
@@ -968,7 +968,7 @@ void WGuiTabMenu::Add(WGuiBase * it){
|
||||
}
|
||||
|
||||
void WGuiTabMenu::Render(){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
if (!items.size())
|
||||
@@ -1000,7 +1000,7 @@ void WGuiTabMenu::save(){
|
||||
//WGuiAward
|
||||
void WGuiAward::Overlay(){
|
||||
JRenderer * r = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetScale(0.8f);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
@@ -1051,7 +1051,7 @@ void WGuiAward::Render(){
|
||||
return;
|
||||
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetScale(1);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT));
|
||||
|
||||
@@ -1293,7 +1293,7 @@ void WGuiListRow::Render(){
|
||||
|
||||
//List is empty.
|
||||
if (!items.size() && failMsg != ""){
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(getColor(WGuiColor::TEXT_FAIL));
|
||||
mFont->DrawString(_(failMsg).c_str(),x+width/2, y, JGETEXT_RIGHT);
|
||||
return;
|
||||
@@ -1603,7 +1603,7 @@ void WGuiFilterItem::updateValue(){
|
||||
SAFE_DELETE(mParent->subMenu);
|
||||
mState = STATE_CHOOSE_TYPE;
|
||||
SAFE_DELETE(mParent->subMenu);
|
||||
mParent->subMenu = NEW SimpleMenu(-1234,this,Constants::MENU_FONT,20,20,"Filter By...",10);
|
||||
mParent->subMenu = NEW SimpleMenu(-1234,this,Fonts::MENU_FONT,20,20,"Filter By...",10);
|
||||
if(mParent->isAvailable(FILTER_SET)){
|
||||
mParent->subMenu->Add(FILTER_SET,"Set");
|
||||
delMenu = false;
|
||||
@@ -1660,7 +1660,7 @@ void WGuiFilterItem::updateValue(){
|
||||
SAFE_DELETE(mParent->subMenu);
|
||||
mParent->clearArgs();
|
||||
mState = STATE_CHOOSE_VAL;
|
||||
mParent->subMenu = NEW SimpleMenu(-1234,this,Constants::MENU_FONT,20,20,"Filter:");
|
||||
mParent->subMenu = NEW SimpleMenu(-1234,this,Fonts::MENU_FONT,20,20,"Filter:");
|
||||
if(filterType == FILTER_TYPE){
|
||||
mParent->addArg("Artifact","t:Artifact;");
|
||||
mParent->addArg("Artifact Creature","t:Artifact;&t:Creature;");
|
||||
@@ -1892,7 +1892,7 @@ WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm() {
|
||||
confirmationString = ss.str();
|
||||
|
||||
// Then create the menu.
|
||||
confirmMenu = NEW SimpleMenu(0, this, Constants::MENU_FONT, 40, 130, "Conflict");
|
||||
confirmMenu = NEW SimpleMenu(0, this, Fonts::MENU_FONT, 40, 130, "Conflict");
|
||||
confirmMenu->Add(1, _("Cancel and return to the options menu").c_str());
|
||||
confirmMenu->Add(2, _("This is okay, validate and save").c_str());
|
||||
return CONFIRM_NEED;
|
||||
@@ -1913,7 +1913,7 @@ WGuiBase::CONFIRM_TYPE WGuiKeyBinder::needsConfirm() {
|
||||
confirmationString = s;
|
||||
|
||||
confirmingButton = btnToCheck[i];
|
||||
confirmMenu = NEW SimpleMenu(1, this, Constants::MENU_FONT, 40, 130, "Binding missing");
|
||||
confirmMenu = NEW SimpleMenu(1, this, Fonts::MENU_FONT, 40, 130, "Binding missing");
|
||||
confirmMenu->Add(1, _("Cancel and return to the options menu").c_str());
|
||||
confirmMenu->Add(2, _("This is okay, validate and save").c_str());
|
||||
return CONFIRM_NEED;
|
||||
@@ -1936,7 +1936,7 @@ void WGuiKeyBinder::Render() {
|
||||
WGuiList::Render();
|
||||
if (confirmMenu) {
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
WFont * mFont = resources.GetWFont(Constants::OPTION_FONT);
|
||||
WFont * mFont = resources.GetWFont(Fonts::OPTION_FONT);
|
||||
mFont->SetColor(ARGB(255, 255, 0, 0));
|
||||
renderer->FillRect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, ARGB(230, 255, 240, 240));
|
||||
|
||||
|
||||
@@ -16,15 +16,21 @@
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
#include "../include/WFont.h"
|
||||
|
||||
extern bool neofont;
|
||||
|
||||
int idCounter = OTHERS_OFFSET;
|
||||
|
||||
WResourceManager resources;
|
||||
unsigned int vTime = 0;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string kExtension_png(".png");
|
||||
const std::string kExtension_gbk(".gbk");
|
||||
}
|
||||
|
||||
int WResourceManager::RetrieveError(){
|
||||
return lastError;
|
||||
}
|
||||
|
||||
bool WResourceManager::RemoveOldest(){
|
||||
if(sampleWCache.RemoveOldest())
|
||||
return true;
|
||||
@@ -39,7 +45,7 @@ bool WResourceManager::RemoveOldest(){
|
||||
//WResourceManager
|
||||
void WResourceManager::DebugRender(){
|
||||
JRenderer* renderer = JRenderer::GetInstance();
|
||||
WFont * font = resources.GetWFont(Constants::MAIN_FONT);
|
||||
WFont * font = resources.GetWFont(Fonts::MAIN_FONT);
|
||||
font->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
if(!font || !renderer)
|
||||
@@ -173,14 +179,6 @@ WResourceManager::WResourceManager(){
|
||||
mQuadList.reserve(0);
|
||||
mQuadMap.clear();
|
||||
|
||||
mWFontList.clear();
|
||||
mWFontList.reserve(4);
|
||||
mWFontMap.clear();
|
||||
|
||||
mWLBFontList.clear();
|
||||
mWLBFontList.reserve(4);
|
||||
mWLBFontMap.clear();
|
||||
|
||||
psiWCache.Resize(PSI_CACHE_SIZE,20);
|
||||
sampleWCache.Resize(SAMPLES_CACHE_SIZE,MAX_CACHED_SAMPLES);
|
||||
textureWCache.Resize(TEXTURES_CACHE_MINSIZE,MAX_CACHE_OBJECTS);
|
||||
@@ -193,7 +191,6 @@ WResourceManager::~WResourceManager(){
|
||||
LOG("==Destroying WResourceManager==");
|
||||
RemoveAll();
|
||||
RemoveWFonts();
|
||||
RemoveWLBFonts();
|
||||
|
||||
LOG("==Successfully Destroyed WResourceManager==");
|
||||
}
|
||||
@@ -248,7 +245,7 @@ JQuad * WResourceManager::RetrieveCard(MTGCard * card, int style, int submode){
|
||||
}
|
||||
lastError = textureWCache.mError;
|
||||
if(jq){
|
||||
jq->SetHotSpot(jq->mTex->mWidth / 2, jq->mTex->mHeight / 2);
|
||||
jq->SetHotSpot(static_cast<float>(jq->mTex->mWidth / 2), static_cast<float>(jq->mTex->mHeight / 2));
|
||||
return jq;
|
||||
}
|
||||
|
||||
@@ -849,120 +846,81 @@ int WResourceManager::fileOK(string filename, bool relative){
|
||||
return result;
|
||||
}
|
||||
|
||||
int WResourceManager::reloadWLBFonts(){
|
||||
vector<string> fontNames;
|
||||
vector<float> fontSizes;
|
||||
void WResourceManager::InitFonts(const std::string& inLang)
|
||||
{
|
||||
unsigned int idOffset = 0;
|
||||
|
||||
fontNames.resize(mWLBFontList.size());
|
||||
fontSizes.resize(mWLBFontList.size());
|
||||
for ( map<string, int>::iterator itr = mWLBFontMap.begin(); itr != mWLBFontMap.end(); ++itr){
|
||||
fontNames[itr->second] = itr->first;
|
||||
fontSizes[itr->second] = mWLBFontList[itr->second]->GetHeight();
|
||||
}
|
||||
RemoveWLBFonts();
|
||||
for(size_t i = 0; i < fontNames.size(); ++i){
|
||||
LoadWLBFont(fontNames[i],fontSizes[i]);
|
||||
if (inLang.compare("cn") == 0)
|
||||
{
|
||||
mFontFileExtension = kExtension_gbk;
|
||||
LoadWFont("simon", 12, Fonts::MAIN_FONT);
|
||||
LoadWFont("f3", 16, Fonts::MENU_FONT);
|
||||
LoadWFont("magic", 16, Fonts::MAGIC_FONT);
|
||||
LoadWFont("smallface", 12, Fonts::SMALLFACE_FONT);
|
||||
|
||||
idOffset = Fonts::kSingleByteFontOffset;
|
||||
}
|
||||
|
||||
return 1;
|
||||
mFontFileExtension = kExtension_png;
|
||||
LoadWFont("simon", 11, Fonts::MAIN_FONT + idOffset);
|
||||
GetWFont(Fonts::MAIN_FONT)->SetTracking(-1);
|
||||
LoadWFont("f3", 16, Fonts::MENU_FONT + idOffset);
|
||||
LoadWFont("magic", 16, Fonts::MAGIC_FONT + idOffset);
|
||||
LoadWFont("smallface", 7, Fonts::SMALLFACE_FONT + idOffset);
|
||||
}
|
||||
|
||||
int WResourceManager::reloadWFonts(){
|
||||
int WResourceManager::ReloadWFonts(){
|
||||
RemoveWFonts();
|
||||
|
||||
string lang = options[Options::LANG].str;
|
||||
std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);
|
||||
|
||||
if (lang.compare("cn") != 0)
|
||||
RemoveWFonts();
|
||||
else if (mWFontList.size() == 0){
|
||||
resources.LoadWFBFont("simon",12);
|
||||
resources.LoadWFBFont("f3",16);
|
||||
resources.LoadWFBFont("magic",16);
|
||||
resources.LoadWFBFont("smallface",12);
|
||||
}
|
||||
InitFonts(lang);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
WFont* WResourceManager::LoadWFont(const string& inFontname, int inFontHeight, int inFontID)
|
||||
{
|
||||
WFont* font = GetWFont(inFontID);
|
||||
if (font)
|
||||
{
|
||||
return font;
|
||||
}
|
||||
|
||||
WFont * WResourceManager::LoadWLBFont(const string &fontName, int height) {
|
||||
map<string, int>::iterator itr = mWLBFontMap.find(fontName);
|
||||
|
||||
if (itr != mWLBFontMap.end()) return mWLBFontList[itr->second];
|
||||
|
||||
string mFontName = fontName + ".png";
|
||||
string mFontName = inFontname + mFontFileExtension;
|
||||
string path = graphicsFile(mFontName);
|
||||
if (path.size() > 4 ) path = path.substr(0, path.size() - 4); //some stupid manipulation because of the way Font works in JGE
|
||||
int id = mWLBFontList.size();
|
||||
mWLBFontList.push_back(NEW WLBFont(path.c_str(), height, true));
|
||||
mWLBFontMap[fontName] = id;
|
||||
mWLBFontList[id]->id = id;
|
||||
|
||||
return mWLBFontList[id];
|
||||
if (mFontFileExtension == kExtension_gbk)
|
||||
{
|
||||
font = NEW WFBFont(inFontID, path.c_str(), inFontHeight, true);
|
||||
}
|
||||
|
||||
WFont * WResourceManager::LoadWFBFont(const string &fontName, int height) {
|
||||
map<string, int>::iterator itr = mWFontMap.find(fontName);
|
||||
if (itr != mWFontMap.end()) return mWFontList[itr->second];
|
||||
|
||||
string mFontName = fontName + ".gbk";
|
||||
string path = graphicsFile(mFontName);
|
||||
if (path.size() > 4 ) path = path.substr(0, path.size() - 4); //some stupid manipulation because of the way WFont works in JGE
|
||||
|
||||
int id = mWFontList.size();
|
||||
mWFontList.push_back(NEW WFBFont(path.c_str(), height, true));
|
||||
mWFontMap[fontName] = id;
|
||||
mWFontList[id]->id = id;
|
||||
|
||||
return mWFontList[id];
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWFont(const string &fontName) {
|
||||
map<string, int>::iterator itr;
|
||||
|
||||
if (neofont) {
|
||||
itr = mWFontMap.find(fontName);
|
||||
if (itr != mWFontMap.end())
|
||||
return mWFontList[itr->second];
|
||||
else
|
||||
return NULL;
|
||||
} else {
|
||||
itr = mWLBFontMap.find(fontName);
|
||||
if (itr != mWLBFontMap.end())
|
||||
return mWLBFontList[itr->second];
|
||||
else
|
||||
return NULL;
|
||||
{
|
||||
font = NEW WLBFont(inFontID, path.c_str(), inFontHeight, true);
|
||||
}
|
||||
mWFontMap[inFontID] = font;
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWFont(int id) {
|
||||
if (neofont) {
|
||||
return mWFontList[id];
|
||||
} else {
|
||||
if (id >=0 && id < (int)mWLBFontList.size())
|
||||
return mWLBFontList[id];
|
||||
else
|
||||
return NULL;
|
||||
WFont* WResourceManager::GetWFont(int id)
|
||||
{
|
||||
WFont* font = NULL;
|
||||
FontMap::iterator iter = mWFontMap.find(id);
|
||||
if (iter != mWFontMap.end())
|
||||
{
|
||||
font = iter->second;
|
||||
}
|
||||
}
|
||||
|
||||
WFont * WResourceManager::GetWLBFont(int id) {
|
||||
if (id >=0 && id < (int)mWLBFontList.size())
|
||||
return mWLBFontList[id];
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void WResourceManager::RemoveWLBFonts() {
|
||||
for (vector<WLBFont *>::iterator font = mWLBFontList.begin(); font != mWLBFontList.end(); ++font)
|
||||
delete *font;
|
||||
mWLBFontList.clear();
|
||||
mWLBFontMap.clear();
|
||||
return font;
|
||||
}
|
||||
|
||||
void WResourceManager::RemoveWFonts() {
|
||||
for (vector<WFont *>::iterator font = mWFontList.begin(); font != mWFontList.end(); ++font)
|
||||
delete *font;
|
||||
mWFontList.clear();
|
||||
for (FontMap::iterator font = mWFontMap.begin(); font != mWFontMap.end(); ++font)
|
||||
{
|
||||
delete font->second;
|
||||
}
|
||||
mWFontMap.clear();
|
||||
}
|
||||
|
||||
@@ -989,8 +947,7 @@ JMusic * WResourceManager::ssLoadMusic(const char *fileName){
|
||||
|
||||
void WResourceManager::Refresh(){
|
||||
//Really easy cache relinking.
|
||||
reloadWFonts();
|
||||
reloadWLBFonts();
|
||||
ReloadWFonts();
|
||||
sampleWCache.Refresh();
|
||||
textureWCache.Refresh();
|
||||
psiWCache.Refresh();
|
||||
@@ -1337,7 +1294,6 @@ WCache<cacheItem, cacheActual>::~WCache(){
|
||||
for(it=managed.begin();it!=managed.end();it++){
|
||||
SAFE_DELETE(it->second);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user