Jeck - Some basic options handling rewrites, main menu update, example alternate theme (for testing). I'm closing issues 44 and 45, as hopefully this resolves them satisfactorily.
* The alternate theme is just useful for testing themes, but please comment on the changes to the main theme. * Options reading and initializing separated from UI. * Options UI abstracted a bit, made more easily extensible. * With some extension, the options UI could be used as the basis for more complicated themes, if we load a file and use it to do stuff like GameStateOptions::Start()
This commit is contained in:
@@ -36,7 +36,6 @@ GameApp::GameApp(): JApp()
|
||||
nbUpdates = 0;
|
||||
totalFPS = 0;
|
||||
#endif
|
||||
|
||||
mScreenShotCount = 0;
|
||||
|
||||
for (int i=0; i < MAX_STATE ; i++)
|
||||
|
||||
+178
-204
@@ -10,6 +10,12 @@
|
||||
#include <JGE.h>
|
||||
|
||||
const char * Options::optionNames[] = {
|
||||
//Global options
|
||||
"Profile",
|
||||
"prx_handler",
|
||||
"prx_rimom",
|
||||
"prx_eviltwin",
|
||||
"prx_rnddeck",
|
||||
//Options set on a per-profile basis
|
||||
"Theme",
|
||||
"Mode",
|
||||
@@ -40,42 +46,6 @@ const char * Options::optionNames[] = {
|
||||
"interruptEndTurn",
|
||||
"interruptCleanup",
|
||||
"interruptAfterEnd",
|
||||
//Global options
|
||||
"_gProfile",
|
||||
"_gprx_handler",
|
||||
"_gprx_rimom",
|
||||
"_gprx_eviltwin",
|
||||
"_gprx_rnddeck",
|
||||
//Theme metrics
|
||||
"_tLoadingTC",
|
||||
"_tStatsTC",
|
||||
"_tScrollerTC",
|
||||
"_tScrollerFC",
|
||||
"_tMainMenuTC",
|
||||
"_tPopupMenuFC",
|
||||
"_tPopupMenuTC",
|
||||
"_tPopupMenuTCH",
|
||||
"_tMsgFailTC",
|
||||
"_tOptionItemFC",
|
||||
"_tOptionItemTC",
|
||||
"_tOptionItemTCH",
|
||||
"_tOptionHeaderFC",
|
||||
"_tOptionHeaderTC",
|
||||
"_tOptionScrollbarFC",
|
||||
"_tOptionScrollbarFCH",
|
||||
"_tOptionHeaderFC",
|
||||
"_tOptionHeaderFCH",
|
||||
"_tOptionTabTC",
|
||||
"_tOptionHeaderTCH",
|
||||
"_tOptionTextTC",
|
||||
"_tOptionTextFC",
|
||||
"_tKeyTC",
|
||||
"_tKeyTCH",
|
||||
"_tKeyFC",
|
||||
"_tKeyFCH",
|
||||
"_tKeypadFC",
|
||||
"_tKeypadFCH",
|
||||
"_tKeypadTC"
|
||||
};
|
||||
int Options::getID(string name){
|
||||
if(!name.size())
|
||||
@@ -184,39 +154,6 @@ int Options::optionInterrupt(int gamePhase){
|
||||
return INVALID_OPTION;
|
||||
}
|
||||
|
||||
//Theme metrics
|
||||
/*
|
||||
const string Metrics::LOADING_TC = "_tLoadingTC";
|
||||
const string Metrics::STATS_TC = "_tStatsTC";
|
||||
const string Metrics::SCROLLER_TC = "_tScrollerTC";
|
||||
const string Metrics::SCROLLER_FC = "_tScrollerFC";
|
||||
const string Metrics::MAINMENU_TC = "_tMainMenuTC";
|
||||
const string Metrics::POPUP_MENU_FC = "_tPopupMenuFC";
|
||||
const string Metrics::POPUP_MENU_TC = "_tPopupMenuTC";
|
||||
const string Metrics::POPUP_MENU_TCH = "_tPopupMenuTCH";
|
||||
const string Metrics::MSG_FAIL_TC = "_tMsgFailTC";
|
||||
const string Metrics::OPTION_ITEM_FC = "_tOptionItemFC";
|
||||
const string Metrics::OPTION_ITEM_TC = "_tOptionItemTC";
|
||||
const string Metrics::OPTION_ITEM_TCH = "_tOptionItemTCH";
|
||||
const string Metrics::OPTION_HEADER_FC = "_tOptionHeaderFC";
|
||||
const string Metrics::OPTION_HEADER_TC = "_tOptionHeaderTC";
|
||||
const string Metrics::OPTION_SCROLLBAR_FC = "_tOptionScrollbarFC";
|
||||
const string Metrics::OPTION_SCROLLBAR_FCH = "_tOptionScrollbarFCH";
|
||||
const string Metrics::OPTION_TAB_FC = "_tOptionHeaderFC";
|
||||
const string Metrics::OPTION_TAB_FCH = "_tOptionHeaderFCH";
|
||||
const string Metrics::OPTION_TAB_TC = "_tOptionTabTC";
|
||||
const string Metrics::OPTION_TAB_TCH = "_tOptionHeaderTCH";
|
||||
const string Metrics::OPTION_TEXT_TC = "_tOptionTextTC";
|
||||
const string Metrics::OPTION_TEXT_FC = "_tOptionTextFC";
|
||||
const string Metrics::KEY_TC = "_tKeyTC";
|
||||
const string Metrics::KEY_TCH = "_tKeyTCH";
|
||||
const string Metrics::KEY_FC = "_tKeyFC";
|
||||
const string Metrics::KEY_FCH = "_tKeyFCH";
|
||||
const string Metrics::KEYPAD_FC = "_tKeypadFC";
|
||||
const string Metrics::KEYPAD_FCH = "_tKeypadFCH";
|
||||
const string Metrics::KEYPAD_TC = "_tKeypadTC"; */
|
||||
|
||||
|
||||
GameOption::GameOption(int value) : number(value){}
|
||||
GameOption::GameOption(string value) : number(0), str(value) {}
|
||||
GameOption::GameOption(int num, string str) : number(num), str(str) {}
|
||||
@@ -267,16 +204,10 @@ PIXEL_TYPE GameOption::asColor(PIXEL_TYPE fallback)
|
||||
return ARGB(color[3],color[0],color[1],color[2]);
|
||||
}
|
||||
|
||||
GameOptions::GameOptions(string filename){
|
||||
mFilename = filename;
|
||||
load();
|
||||
}
|
||||
|
||||
bool GameOptions::read_default(int id, string input){
|
||||
bool GameOption::read(string input){
|
||||
bool bNumeric = true;
|
||||
|
||||
if(!input.size()){
|
||||
values[id] = GameOption(0);
|
||||
return true; //Default reader doesn't care about invalid formatting.
|
||||
}
|
||||
|
||||
@@ -289,41 +220,47 @@ bool GameOptions::read_default(int id, string input){
|
||||
}
|
||||
|
||||
if(bNumeric)
|
||||
values[id] = GameOption(atoi(input.c_str()));
|
||||
number = atoi(input.c_str());
|
||||
else
|
||||
values[id] = GameOption(input);
|
||||
|
||||
str = input;
|
||||
return true;
|
||||
}
|
||||
bool GameOptions::read_enum(int id, string input, EnumDefinition * def){
|
||||
if(!def)
|
||||
string GameOption::menuStr(){
|
||||
if(number){
|
||||
char buf[12];
|
||||
sprintf(buf,"%d",number);
|
||||
}
|
||||
|
||||
if(str.size())
|
||||
return str;
|
||||
|
||||
return "0";
|
||||
}
|
||||
bool GameOption::write(std::ofstream * file, string name){
|
||||
char writer[1024];
|
||||
|
||||
if(!file)
|
||||
return false;
|
||||
|
||||
std::transform(input.begin(),input.end(),input.begin(),::tolower);
|
||||
if(str ==""){
|
||||
if(number == 0) //This is absolutely default. No need to write it.
|
||||
return true;
|
||||
|
||||
vector<EnumDefinition::assoc>::iterator it;
|
||||
for(it=def->values.begin();it != def->values.end();it++){
|
||||
if(it->second == input){
|
||||
values[id] = GameOption(it->first);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//It's a number!
|
||||
sprintf(writer,"%s=%d\n", name.c_str(), number);
|
||||
}
|
||||
else
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), str.c_str());
|
||||
|
||||
return false;
|
||||
(*file)<<writer;
|
||||
return true;
|
||||
}
|
||||
bool GameOptions::load_option(int id, string input){
|
||||
switch(id){
|
||||
case Options::HANDDIRECTION:
|
||||
return read_enum(id, input, OptionHandDirection::getDefinition());
|
||||
case Options::CLOSEDHAND:
|
||||
return read_enum(id, input, OptionClosedHand::getDefinition());
|
||||
case Options::MANADISPLAY:
|
||||
return read_enum(id, input, OptionManaDisplay::getDefinition());
|
||||
default:
|
||||
return read_default(id, input);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
GameOptions::GameOptions(string filename){
|
||||
mFilename = filename;
|
||||
values.reserve(Options::LAST_NAMED); //Reserve space for all named options.
|
||||
load();
|
||||
}
|
||||
|
||||
int GameOptions::load(){
|
||||
@@ -341,79 +278,25 @@ int GameOptions::load(){
|
||||
if(id == INVALID_OPTION)
|
||||
continue;
|
||||
|
||||
load_option(id,val);
|
||||
(*this)[id].read(val);
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool GameOptions::save_option(std::ofstream * file, int id, string name, GameOption * opt){
|
||||
if(!opt)
|
||||
return false;
|
||||
|
||||
switch(id){
|
||||
case Options::HANDDIRECTION:
|
||||
return write_enum(file, name, opt, OptionHandDirection::getDefinition());
|
||||
case Options::CLOSEDHAND:
|
||||
return write_enum(file, name, opt, OptionClosedHand::getDefinition());
|
||||
case Options::MANADISPLAY:
|
||||
return write_enum(file, name, opt, OptionManaDisplay::getDefinition());
|
||||
default:
|
||||
return write_default(file, name, opt);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GameOptions::write_default(std::ofstream * file, string name, GameOption * opt){
|
||||
char writer[1024];
|
||||
|
||||
if(!file || !opt)
|
||||
return false;
|
||||
|
||||
if(opt->str ==""){
|
||||
if(opt->number == 0) //This is absolutely default. No need to write it.
|
||||
return true;
|
||||
|
||||
//It's a number!
|
||||
sprintf(writer,"%s=%d\n", name.c_str(), opt->number);
|
||||
}
|
||||
else
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), opt->str.c_str());
|
||||
|
||||
(*file)<<writer;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameOptions::write_enum(std::ofstream * file, string name, GameOption * opt, EnumDefinition * def){
|
||||
|
||||
if(!file || !def || !opt)
|
||||
return false;
|
||||
|
||||
if(opt->number < 0 || opt->number >= (int) def->values.size())
|
||||
return false;
|
||||
|
||||
char writer[1024];
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), def->values[opt->number].second.c_str());
|
||||
|
||||
(*file)<<writer;
|
||||
return true;
|
||||
}
|
||||
|
||||
int GameOptions::save(){
|
||||
std::ofstream file(mFilename.c_str());
|
||||
if (file){
|
||||
map<int, GameOption>::iterator it;
|
||||
for ( it=values.begin() ; it != values.end(); it++ ){
|
||||
for ( int x=0; x < (int) values.size(); x++ ){
|
||||
|
||||
//Check that this is a valid option.
|
||||
string name = Options::getName(it->first);
|
||||
if(!name.size())
|
||||
string name = Options::getName(x);
|
||||
GameOption * opt = get(x);
|
||||
if(!name.size() || !opt)
|
||||
continue;
|
||||
|
||||
//Save it.
|
||||
save_option(&file, it->first, name, &it->second);
|
||||
opt->write(&file, name);
|
||||
}
|
||||
|
||||
file.close();
|
||||
@@ -421,11 +304,58 @@ int GameOptions::save(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
GameOption& GameOptions::operator[](int optionID) {
|
||||
GameOption& GameOptions::operator[](int optionID){
|
||||
GameOption * go = get(optionID);
|
||||
if(!go)
|
||||
return GameSettings::invalid_option;
|
||||
|
||||
return *go;
|
||||
}
|
||||
|
||||
GameOption * GameOptions::get(int optionID) {
|
||||
GameOption * go = NULL;
|
||||
GameOptionEnum * goEnum = NULL;
|
||||
|
||||
//Invalid options!
|
||||
if(optionID < 0)
|
||||
return NULL;
|
||||
|
||||
//Option doesn't exist, so build it
|
||||
int x = (int) values.size();
|
||||
values.reserve(optionID);
|
||||
|
||||
while(x <= optionID){
|
||||
switch(optionID){
|
||||
case Options::HANDDIRECTION:
|
||||
goEnum = NEW GameOptionEnum();
|
||||
goEnum->def = OptionHandDirection::getInstance();
|
||||
go = goEnum;
|
||||
break;
|
||||
case Options::CLOSEDHAND:
|
||||
goEnum = NEW GameOptionEnum();
|
||||
goEnum->def = OptionClosedHand::getInstance();
|
||||
go = goEnum;
|
||||
break;
|
||||
case Options::MANADISPLAY:
|
||||
goEnum = NEW GameOptionEnum();
|
||||
goEnum->def = OptionManaDisplay::getInstance();
|
||||
go = goEnum;
|
||||
break;
|
||||
default:
|
||||
go = NEW GameOption();
|
||||
break;
|
||||
}
|
||||
values.push_back(go);
|
||||
x++;
|
||||
}
|
||||
|
||||
return values[optionID];
|
||||
}
|
||||
|
||||
GameOptions::~GameOptions(){
|
||||
for(vector<GameOption*>::iterator it=values.begin();it!=values.end();it++)
|
||||
SAFE_DELETE(*it);
|
||||
values.clear();
|
||||
}
|
||||
|
||||
GameSettings options;
|
||||
@@ -435,7 +365,6 @@ GameSettings::GameSettings()
|
||||
globalOptions = NULL;
|
||||
theGame = NULL;
|
||||
profileOptions = NULL;
|
||||
themeOptions = NULL;
|
||||
//reloadProfile should be before using options.
|
||||
}
|
||||
|
||||
@@ -443,41 +372,30 @@ GameSettings::~GameSettings(){
|
||||
//Destructor no longer saves, to prevent conflicts when MtgSets::SetsList == NULL
|
||||
SAFE_DELETE(globalOptions);
|
||||
SAFE_DELETE(profileOptions);
|
||||
SAFE_DELETE(themeOptions);
|
||||
SAFE_DELETE(keypad);
|
||||
SAFE_DELETE(OptionHandDirection::definition);
|
||||
SAFE_DELETE(OptionClosedHand::definition);
|
||||
SAFE_DELETE(OptionManaDisplay::definition);
|
||||
}
|
||||
|
||||
GameOption GameSettings::invalid_option = GameOption(0);
|
||||
|
||||
GameOption& GameSettings::operator[](int optionID){
|
||||
GameOption * go = get(optionID);
|
||||
if(!go)
|
||||
return invalid_option;
|
||||
|
||||
return *go;
|
||||
}
|
||||
|
||||
GameOption* GameSettings::get(int optionID){
|
||||
string option_name = Options::getName(optionID);
|
||||
|
||||
//Last chance sanity checking.
|
||||
if(!option_name.size()){
|
||||
OutputDebugString("Error: Accessing invalid option.\n");
|
||||
invalid_option.number = 0;
|
||||
invalid_option.str = "";
|
||||
return invalid_option;
|
||||
}
|
||||
if(optionID < 0)
|
||||
return &invalid_option;
|
||||
else if(globalOptions && optionID <= Options::LAST_GLOBAL)
|
||||
return globalOptions->get(optionID);
|
||||
else if(profileOptions)
|
||||
return profileOptions->get(optionID);
|
||||
|
||||
if(option_name.size() > 2){
|
||||
if(option_name[0] == '_' && option_name[1] == 't'){
|
||||
if(themeOptions)
|
||||
return (*themeOptions)[optionID];
|
||||
}
|
||||
else if(option_name[0] == '_' && option_name[1] == 'g'){
|
||||
if(globalOptions)
|
||||
return (*globalOptions)[optionID];
|
||||
}
|
||||
}
|
||||
|
||||
if(profileOptions)
|
||||
return (*profileOptions)[optionID];
|
||||
|
||||
return invalid_option;
|
||||
return &invalid_option;
|
||||
}
|
||||
|
||||
|
||||
@@ -543,31 +461,18 @@ string GameSettings::profileFile(string filename, string fallback,bool sanity, b
|
||||
|
||||
void GameSettings::reloadProfile(bool images){
|
||||
SAFE_DELETE(profileOptions);
|
||||
SAFE_DELETE(themeOptions);
|
||||
checkProfile();
|
||||
if(images)
|
||||
resources.Refresh(); //Update images
|
||||
}
|
||||
|
||||
void GameSettings::checkProfile(){
|
||||
char buf[512];
|
||||
|
||||
if(!globalOptions)
|
||||
globalOptions = NEW GameOptions(GLOBAL_SETTINGS);
|
||||
|
||||
//If it doesn't exist, load current profile.
|
||||
if(!profileOptions)
|
||||
profileOptions = NEW GameOptions(profileFile(PLAYER_SETTINGS,"",false));
|
||||
|
||||
//Load theme options
|
||||
if(!themeOptions){
|
||||
if(!profileOptions || (*profileOptions)[Options::ACTIVE_THEME].isDefault())
|
||||
sprintf(buf,RESPATH"/graphics/metrics.txt");
|
||||
else
|
||||
sprintf(buf,RESPATH"/themes/%s/metrics.txt",(*profileOptions)[Options::ACTIVE_THEME].str.c_str());
|
||||
|
||||
themeOptions = NEW GameOptions(buf);
|
||||
}
|
||||
|
||||
//Validation of collection, etc, only happens if the game is up.
|
||||
if(theGame == NULL || theGame->collection == NULL)
|
||||
@@ -694,5 +599,74 @@ int EnumDefinition::findIndex(int value){
|
||||
return it - values.begin();
|
||||
}
|
||||
|
||||
return 0; //Default!
|
||||
return INVALID_ID; //Failed!
|
||||
}
|
||||
|
||||
string GameOptionEnum::menuStr(){
|
||||
if(def){
|
||||
int idx = def->findIndex(number);
|
||||
if(idx != INVALID_ID)
|
||||
return def->values[idx].second;
|
||||
}
|
||||
|
||||
char buf[32];
|
||||
sprintf(buf,"%d",number);
|
||||
return buf;
|
||||
}
|
||||
|
||||
bool GameOptionEnum::write(std::ofstream * file, string name){
|
||||
if(!file || !def || number < 0 || number >= (int) def->values.size())
|
||||
return false;
|
||||
|
||||
char writer[1024];
|
||||
sprintf(writer,"%s=%s\n", name.c_str(), menuStr().c_str());
|
||||
|
||||
(*file)<<writer;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GameOptionEnum::read(string input){
|
||||
if(!def)
|
||||
return false;
|
||||
|
||||
std::transform(input.begin(),input.end(),input.begin(),::tolower);
|
||||
|
||||
vector<EnumDefinition::assoc>::iterator it;
|
||||
for(it=def->values.begin();it != def->values.end();it++){
|
||||
if(it->second == input){
|
||||
number = it->first;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
OptionClosedHand OptionClosedHand::mDef;
|
||||
OptionClosedHand::OptionClosedHand(){
|
||||
mDef.values.push_back(EnumDefinition::assoc(INVISIBLE, "invisible"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(VISIBLE, "visible"));
|
||||
};
|
||||
|
||||
OptionHandDirection OptionHandDirection::mDef;
|
||||
OptionHandDirection::OptionHandDirection(){
|
||||
mDef.values.push_back(EnumDefinition::assoc(VERTICAL, "vertical"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(HORIZONTAL, "horizontal"));
|
||||
};
|
||||
OptionManaDisplay OptionManaDisplay::mDef;
|
||||
OptionManaDisplay::OptionManaDisplay(){
|
||||
mDef.values.push_back(EnumDefinition::assoc(STATIC, "Simple"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(DYNAMIC, "Eye candy"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(BOTH, "Both"));
|
||||
};
|
||||
OptionVolume OptionVolume::mDef;
|
||||
OptionVolume::OptionVolume(){
|
||||
mDef.values.push_back(EnumDefinition::assoc(MUTE, "Mute"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(MAX, "Max"));
|
||||
};
|
||||
OptionDifficulty OptionDifficulty::mDef;
|
||||
OptionDifficulty::OptionDifficulty(){
|
||||
mDef.values.push_back(EnumDefinition::assoc(NORMAL, "Normal"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(HARDER, "Harder"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(HARD, "Hard"));
|
||||
mDef.values.push_back(EnumDefinition::assoc(EVIL, "Evil"));
|
||||
};
|
||||
@@ -66,7 +66,6 @@ GameStateMenu::GameStateMenu(GameApp* parent): GameState(parent)
|
||||
gameTypeMenu = NULL;
|
||||
mSplash = NULL;
|
||||
mBg = NULL;
|
||||
mMovingW = NULL;
|
||||
//bgMusic = NULL;
|
||||
timeIndex = 0;
|
||||
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
||||
@@ -81,6 +80,7 @@ GameStateMenu::~GameStateMenu() {}
|
||||
void GameStateMenu::Create()
|
||||
{
|
||||
mDip = NULL;
|
||||
mGuiController = NULL;
|
||||
mReadConf = 0;
|
||||
mCurrentSetName[0] = 0;
|
||||
|
||||
@@ -97,18 +97,6 @@ void GameStateMenu::Create()
|
||||
}
|
||||
}
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::MENU_FONT);
|
||||
mFont->SetColor(options[Metrics::LOADING_TC].asColor());
|
||||
mGuiController = NEW JGuiController(100, this);
|
||||
if (mGuiController)
|
||||
{
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_PLAY, mFont, "Play", 80, 50 + SCREEN_HEIGHT/2, mIcons[8], mIcons[9],"graphics/particle1.psi",resources.GetQuad("particles"), true));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_DECKEDITOR, mFont, "Deck Editor", 160, 50 + SCREEN_HEIGHT/2, mIcons[2], mIcons[3],"graphics/particle2.psi",resources.GetQuad("particles")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"graphics/particle3.psi",resources.GetQuad("particles")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"graphics/particle4.psi",resources.GetQuad("particles")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"graphics/particle5.psi",resources.GetQuad("particles")));
|
||||
}
|
||||
|
||||
currentState = MENU_STATE_MAJOR_LOADING_CARDS | MENU_STATE_MINOR_NONE;
|
||||
scroller = NEW TextScroller(resources.GetJLBFont(Constants::MAIN_FONT), SCREEN_WIDTH/2 - 90 , SCREEN_HEIGHT-17,180);
|
||||
scrollerSet = 0;
|
||||
@@ -122,13 +110,25 @@ void GameStateMenu::Destroy()
|
||||
SAFE_DELETE(subMenuController);
|
||||
SAFE_DELETE(gameTypeMenu);
|
||||
resources.Release(bgTexture);
|
||||
resources.Release(movingWTexture);
|
||||
SAFE_DELETE(scroller);
|
||||
}
|
||||
|
||||
void GameStateMenu::Start(){
|
||||
JRenderer::GetInstance()->EnableVSync(true);
|
||||
subMenuController = NULL;
|
||||
SAFE_DELETE(mGuiController);
|
||||
mGuiController = NEW JGuiController(100, this);
|
||||
if (mGuiController)
|
||||
{
|
||||
JLBFont * mFont = resources.GetJLBFont(Constants::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")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_SHOP, mFont, "Shop", 240, 50 + SCREEN_HEIGHT/2, mIcons[0], mIcons[1],"particle3.psi",resources.GetQuad("particles")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_OPTIONS, mFont, "Options", 320, 50 + SCREEN_HEIGHT/2, mIcons[6], mIcons[7],"particle4.psi",resources.GetQuad("particles")));
|
||||
mGuiController->Add(NEW MenuItem(MENUITEM_EXIT, mFont, "Exit", 400, 50 + SCREEN_HEIGHT/2, mIcons[4], mIcons[5],"particle5.psi",resources.GetQuad("particles")));
|
||||
}
|
||||
|
||||
|
||||
if (GameApp::HasMusic && !GameApp::music && options[Options::MUSICVOLUME].number > 0){
|
||||
GameApp::music = resources.ssLoadMusic("Track0.mp3");
|
||||
@@ -145,13 +145,9 @@ void GameStateMenu::Start(){
|
||||
if (options[Options::RANDOMDECK_MODE_UNLOCKED].number) hasChosenGameType = 0;
|
||||
|
||||
bgTexture = resources.RetrieveTexture("menutitle.png", RETRIEVE_LOCK);
|
||||
movingWTexture = resources.RetrieveTexture("movingW.png", RETRIEVE_LOCK);
|
||||
mBg = resources.RetrieveQuad("menutitle.png", 0, 0, 256, 166); // Create background quad for rendering.
|
||||
mMovingW = resources.RetrieveQuad("movingW.png", 2, 2, 84, 62);
|
||||
|
||||
mBg->SetHotSpot(105,50);
|
||||
mMovingW->SetHotSpot(72,16);
|
||||
|
||||
mBg->SetHotSpot(128,50);
|
||||
|
||||
//How many cards total ?
|
||||
PlayerData * playerdata = NEW PlayerData(mParent->collection);
|
||||
@@ -274,18 +270,14 @@ void GameStateMenu::End()
|
||||
JRenderer::GetInstance()->EnableVSync(false);
|
||||
|
||||
resources.Release(bgTexture);
|
||||
resources.Release(movingWTexture);
|
||||
|
||||
|
||||
resources.Release(mBg);
|
||||
resources.Release(mMovingW);
|
||||
SAFE_DELETE(mGuiController);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void GameStateMenu::Update(float dt)
|
||||
{
|
||||
|
||||
timeIndex += dt * 2;
|
||||
switch (MENU_STATE_MAJOR & currentState)
|
||||
{
|
||||
@@ -376,6 +368,13 @@ void GameStateMenu::Update(float dt)
|
||||
case MENU_STATE_MINOR_NONE :
|
||||
;// Nothing to do.
|
||||
}
|
||||
|
||||
if(mEngine->GetButtonState(PSP_CTRL_LTRIGGER)) {
|
||||
//Reset deck of cards
|
||||
angleMultiplier = MIN_ANGLE_MULTIPLIER;
|
||||
yW = 55;
|
||||
}
|
||||
|
||||
if (yW <= 55)
|
||||
{
|
||||
if (mEngine->GetButtonState(PSP_CTRL_SQUARE)) angleMultiplier += STEP_ANGLE_MULTIPLIER;
|
||||
@@ -386,7 +385,7 @@ void GameStateMenu::Update(float dt)
|
||||
if (mEngine->GetButtonState(PSP_CTRL_TRIANGLE) && (dt != 0))
|
||||
{
|
||||
angleMultiplier = (cos(timeIndex)*angleMultiplier - M_PI/3 - 0.1 - angleW) / dt;
|
||||
yW = yW + 5*dt + (yW - 55) *5* dt;
|
||||
yW = yW + 5*dt + (yW - 45) *5* dt;
|
||||
}
|
||||
else
|
||||
angleW = cos(timeIndex)*angleMultiplier - M_PI/3 - 0.1;
|
||||
@@ -422,29 +421,29 @@ void GameStateMenu::Render()
|
||||
}else{
|
||||
mFont = resources.GetJLBFont(Constants::MAIN_FONT);
|
||||
PIXEL_TYPE colors[] =
|
||||
{
|
||||
ARGB(255, 3, 2, 0),
|
||||
ARGB(255, 8, 3, 0),
|
||||
ARGB(255,21,12, 0),
|
||||
ARGB(255,50,34, 0)
|
||||
};
|
||||
{
|
||||
|
||||
ARGB(255,3,3,0),
|
||||
ARGB(255,8,8,0),
|
||||
ARGB(255,21,21,10),
|
||||
ARGB(255,50,50,30),
|
||||
};
|
||||
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
|
||||
|
||||
renderer->FillRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT,colors);
|
||||
renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50);
|
||||
if (yW < 2*SCREEN_HEIGHT) renderer->RenderQuad(mMovingW, SCREEN_WIDTH/2 - 10, yW, angleW);
|
||||
if (mGuiController!=NULL)
|
||||
mGuiController->Render();
|
||||
|
||||
mFont->SetScale(DEFAULT_MAIN_FONT_SCALE);
|
||||
mFont->SetColor(options[Metrics::STATS_TC].asColor(ARGB(128,255,255,255)));
|
||||
mFont->SetColor(ARGB(128,255,255,255));
|
||||
mFont->DrawString(GAME_VERSION, SCREEN_WIDTH-10,5,JGETEXT_RIGHT);
|
||||
mFont->DrawString(nbcardsStr,10, 5);
|
||||
mFont->SetScale(1.f);
|
||||
mFont->SetColor(options[Metrics::SCROLLER_TC].asColor());
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
renderer->FillRoundRect(SCREEN_WIDTH/2 - 100,SCREEN_HEIGHT-20, 191,6,5,options[Metrics::SCROLLER_FC].asColor(ARGB(100,10,5,0)));
|
||||
renderer->FillRoundRect(SCREEN_WIDTH/2 - 100,SCREEN_HEIGHT-20, 191,6,5,ARGB(100,10,5,0));
|
||||
scroller->Render();
|
||||
|
||||
renderer->RenderQuad(mBg, SCREEN_WIDTH/2, 50);
|
||||
if (subMenuController){
|
||||
subMenuController->Render();
|
||||
}
|
||||
@@ -569,9 +568,7 @@ ostream& GameStateMenu::toString(ostream& out) const
|
||||
<< " ; hasChosenGameType : " << hasChosenGameType
|
||||
<< " ; mIcons : " << mIcons
|
||||
<< " ; bgTexture : " << bgTexture
|
||||
<< " ; movingWTexture : " << movingWTexture
|
||||
<< " ; mBg : " << mBg
|
||||
<< " ; mMovingW : " << mMovingW
|
||||
<< " ; mCreditsYPos : " << mCreditsYPos
|
||||
<< " ; currentState : " << currentState
|
||||
<< " ; mVolume : " << mVolume
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
GameStateOptions::GameStateOptions(GameApp* parent): GameState(parent) {
|
||||
optionsTabs = NULL;
|
||||
optionsMenu = NULL;
|
||||
confirmMenu = NULL;
|
||||
mReload = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,57 +20,61 @@ GameStateOptions::~GameStateOptions() {
|
||||
|
||||
void GameStateOptions::Start()
|
||||
{
|
||||
newProfile = "";
|
||||
timer = 0;
|
||||
mState = SHOW_OPTIONS;
|
||||
JRenderer::GetInstance()->EnableVSync(true);
|
||||
|
||||
OptionsList * optionsList;
|
||||
WGuiList * optionsList;
|
||||
|
||||
optionsList = NEW OptionsList("Settings");
|
||||
optionsList = NEW WGuiList("Settings");
|
||||
|
||||
optionsList->Add(NEW OptionHeader("General Options"));
|
||||
if (GameApp::HasMusic) optionsList->Add(NEW OptionVolume(Options::MUSICVOLUME, "Music volume", true));
|
||||
optionsList->Add(NEW OptionVolume(Options::SFXVOLUME, "SFX volume"));
|
||||
optionsList->Add(NEW WGuiHeader("General Options"));
|
||||
if (GameApp::HasMusic)
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MUSICVOLUME,"Music volume",100,10,100),OptionVolume::getInstance()));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::SFXVOLUME,"SFX volume",100,10,100),OptionVolume::getInstance()));
|
||||
optionsList->Add(NEW OptionInteger(Options::OSD, "Display InGame extra information"));
|
||||
if (options[Options::DIFFICULTY_MODE_UNLOCKED].number)
|
||||
optionsList->Add(NEW OptionInteger(Options::DIFFICULTY, "Difficulty", 3, 1));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::DIFFICULTY,"Difficulty",3,1,0),OptionDifficulty::getInstance()));
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPT_SECONDS, "Seconds to pause for an Interrupt", 20, 1));
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYSPELLS, "Interrupt my spells"));
|
||||
optionsList->Add(NEW OptionInteger(Options::INTERRUPTMYABILITIES, "Interrupt my abilities"));
|
||||
optionsTabs = NEW OptionsMenu();
|
||||
optionsTabs = NEW WGuiTabMenu();
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsList = NEW OptionsList("Game");
|
||||
optionsList->Add(NEW OptionClosedHand(Options::CLOSEDHAND, "Closed hand"));
|
||||
optionsList->Add(NEW OptionHandDirection(Options::HANDDIRECTION, "Hand direction"));
|
||||
optionsList->Add(NEW OptionManaDisplay(Options::MANADISPLAY, "Mana display"));
|
||||
optionsList = NEW WGuiList("Game");
|
||||
optionsList->Add(NEW WGuiHeader("Interface Options"));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND,"Closed hand",2,1,0)));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::CLOSEDHAND,"Hand direction",2,1,0)));
|
||||
optionsList->Add(NEW WDecoEnum(NEW OptionInteger(Options::MANADISPLAY,"Mana display",3,1,0)));
|
||||
optionsList->Add(NEW OptionInteger(Options::REVERSETRIGGERS, "Reverse left and right triggers"));
|
||||
optionsList->Add(NEW OptionInteger(Options::DISABLECARDS,"Disable card image loading"));
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
optionsList = NEW OptionsList("Profiles");
|
||||
OptionNewProfile * key = NEW OptionNewProfile("New Profile");
|
||||
key->bShowValue = false;
|
||||
optionsList->Add(key);
|
||||
OptionProfile * pickProf = NEW OptionProfile(mParent);
|
||||
optionsList->Add(pickProf);
|
||||
OptionTheme * theme = NEW OptionTheme();
|
||||
optionsList->Add(theme);
|
||||
optionsList = NEW WGuiList("User");
|
||||
optionsList->Add(NEW WGuiHeader("User Options"));
|
||||
|
||||
WDecoConfirm * cPrf = NEW WDecoConfirm(this,NEW OptionProfile(mParent,this));
|
||||
cPrf->confirm = "Use this Profile";
|
||||
OptionDirectory * od = NEW OptionTheme();
|
||||
WDecoConfirm * cThm = NEW WDecoConfirm(this,od);
|
||||
cThm->confirm = "Use this Theme";
|
||||
|
||||
optionsList->Add(NEW WGuiSplit(cPrf,cThm));
|
||||
optionsList->Add(NEW WGuiButton(NEW WGuiHeader("New Profile"),-102,4,this));
|
||||
optionsTabs->Add(optionsList);
|
||||
optionsList = NEW OptionsList("Credits");
|
||||
|
||||
optionsList = NEW WGuiList("Credits");
|
||||
optionsList->failMsg = "";
|
||||
optionsTabs->Add(optionsList);
|
||||
|
||||
JLBFont * mFont = resources.GetJLBFont("f3");
|
||||
optionsMenu = NEW SimpleMenu(102, this,mFont, 50,170);
|
||||
optionsMenu = NEW SimpleMenu(-102, this,mFont, 50,170);
|
||||
optionsMenu->Add(1, "Save & Back to Main Menu");
|
||||
optionsMenu->Add(2, "Back to Main Menu");
|
||||
optionsMenu->Add(3, "Cancel");
|
||||
|
||||
confirmMenu = NEW SimpleMenu(103, this,mFont, 50,170);
|
||||
confirmMenu->Add(1, "Use this profile");
|
||||
confirmMenu->Add(2, "Cancel");
|
||||
optionsTabs->Current()->Entering(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +83,6 @@ void GameStateOptions::End()
|
||||
JRenderer::GetInstance()->EnableVSync(false);
|
||||
SAFE_DELETE(optionsTabs);
|
||||
SAFE_DELETE(optionsMenu);
|
||||
SAFE_DELETE(confirmMenu);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,30 +92,29 @@ void GameStateOptions::Update(float dt)
|
||||
|
||||
if(options.keypadActive()){
|
||||
options.keypadUpdate(dt);
|
||||
}
|
||||
else if (mState == SHOW_OPTIONS){
|
||||
|
||||
switch(optionsTabs->Submode()){
|
||||
case OPTIONS_SUBMODE_RELOAD:
|
||||
optionsTabs->acceptSubmode();
|
||||
optionsTabs->reloadValues();
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
case OPTIONS_SUBMODE_PROFILE:
|
||||
mState = SHOW_OPTIONS_PROFILE;
|
||||
break;
|
||||
default:
|
||||
if (PSP_CTRL_START == mEngine->ReadButton() )
|
||||
mState = SHOW_OPTIONS_MENU;
|
||||
|
||||
optionsTabs->Update(dt);
|
||||
break;
|
||||
}
|
||||
|
||||
}else if(mState == SHOW_OPTIONS_MENU){
|
||||
optionsMenu->Update(dt);
|
||||
}else if(mState == SHOW_OPTIONS_PROFILE){
|
||||
confirmMenu->Update(dt);
|
||||
if(newProfile != ""){
|
||||
newProfile = options.keypadFinish();
|
||||
if(newProfile != ""){
|
||||
options[Options::ACTIVE_PROFILE] = newProfile;
|
||||
options.reloadProfile(false);
|
||||
optionsTabs->Reload();
|
||||
}
|
||||
newProfile = "";
|
||||
}
|
||||
}
|
||||
else switch(mState){
|
||||
default:
|
||||
case SHOW_OPTIONS:
|
||||
optionsTabs->Update(dt);
|
||||
|
||||
if (mEngine->ReadButton() == PSP_CTRL_START){
|
||||
mState = SHOW_OPTIONS_MENU;
|
||||
}
|
||||
break;
|
||||
case SHOW_OPTIONS_MENU:
|
||||
optionsMenu->Update(dt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,24 +163,22 @@ void GameStateOptions::Render()
|
||||
|
||||
optionsTabs->Render();
|
||||
|
||||
switch(mState){
|
||||
case SHOW_OPTIONS_MENU:
|
||||
optionsMenu->Render();
|
||||
break;
|
||||
case SHOW_OPTIONS_PROFILE:
|
||||
confirmMenu->Render();
|
||||
break;
|
||||
if(mReload){
|
||||
optionsTabs->Reload();
|
||||
mReload = false;
|
||||
}
|
||||
|
||||
if(mState == SHOW_OPTIONS_MENU)
|
||||
optionsMenu->Render();
|
||||
|
||||
if(options.keypadActive())
|
||||
options.keypadRender();
|
||||
}
|
||||
|
||||
|
||||
void GameStateOptions::ButtonPressed(int controllerId, int controlId)
|
||||
{
|
||||
//Exit menu?
|
||||
if(controllerId == 102)
|
||||
if(controllerId == -102)
|
||||
switch (controlId){
|
||||
case 1:
|
||||
optionsTabs->save();
|
||||
@@ -188,22 +188,14 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
|
||||
case 3:
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
}
|
||||
//Profile confirmation?
|
||||
else if(controllerId == 103)
|
||||
switch (controlId){
|
||||
case 1:
|
||||
//Load the New profile.
|
||||
optionsTabs->acceptSubmode();
|
||||
optionsTabs->reloadValues();
|
||||
//Reset the current settings to those of the profile...
|
||||
mState = SHOW_OPTIONS;
|
||||
case 4:
|
||||
options.keypadStart("",&newProfile);
|
||||
options.keypadTitle("New Profile");
|
||||
break;
|
||||
case 2:
|
||||
optionsTabs->cancelSubmode();
|
||||
mState = SHOW_OPTIONS;
|
||||
case 5:
|
||||
mReload = true;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
else
|
||||
optionsTabs->ButtonPressed(controllerId, controlId);
|
||||
};
|
||||
@@ -7,7 +7,7 @@ MenuItem::MenuItem(int id, JLBFont *font, string text, int x, int y, JQuad * _of
|
||||
{
|
||||
mText = _(text);
|
||||
updatedSinceLastRender = 1;
|
||||
mParticleSys = NEW hgeParticleSystem(particle, particleTex);
|
||||
mParticleSys = NEW hgeParticleSystem(resources.RetrievePSI(particle, particleTex));
|
||||
mParticleSys->MoveTo(mX, mY);
|
||||
|
||||
mHasFocus = hasFocus;
|
||||
@@ -27,14 +27,27 @@ void MenuItem::Render()
|
||||
{
|
||||
JRenderer * renderer = JRenderer::GetInstance();
|
||||
|
||||
|
||||
if (mHasFocus)
|
||||
{
|
||||
PIXEL_TYPE start = ARGB(46,255,255,200);
|
||||
if(mParticleSys)
|
||||
start = mParticleSys->info.colColorStart.GetHWColor();
|
||||
|
||||
PIXEL_TYPE colors[] =
|
||||
{
|
||||
ARGB(0,0,0,0),
|
||||
start,
|
||||
ARGB(0,0,0,0),
|
||||
start,
|
||||
};
|
||||
renderer->FillRect(255,0,SCREEN_WIDTH-155,SCREEN_HEIGHT,colors);
|
||||
// set additive blending
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE);
|
||||
mParticleSys->Render();
|
||||
// set normal blending
|
||||
renderer->SetTexBlend(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA);
|
||||
mFont->SetColor(options[Metrics::MAINMENU_TC].asColor());
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
onQuad->SetColor(ARGB(70,255,255,255));
|
||||
renderer->RenderQuad(onQuad, SCREEN_WIDTH , SCREEN_HEIGHT/2 , 0,8,8);
|
||||
onQuad->SetColor(ARGB(255,255,255,255));
|
||||
|
||||
+747
-527
File diff suppressed because it is too large
Load Diff
@@ -117,7 +117,7 @@ void SimpleMenu::Render() {
|
||||
float height = mHeight;
|
||||
if (timeOpen < 1) height *= timeOpen > 0 ? timeOpen : -timeOpen;
|
||||
|
||||
renderer->FillRect(mX, mY, mWidth, height, options[Metrics::POPUP_MENU_FC].asColor(ARGB(180,0,0,0)));
|
||||
renderer->FillRect(mX, mY, mWidth, height, ARGB(180,0,0,0));
|
||||
|
||||
drawVertPole(mX, mY - 16, height + 32);
|
||||
drawVertPole(mX + mWidth, mY - 16, height + 32);
|
||||
@@ -135,9 +135,9 @@ void SimpleMenu::Render() {
|
||||
if ((static_cast<SimpleMenuItem*>(mObjects[i]))->mY - LINE_HEIGHT * startId < mY + height - LINE_HEIGHT + 7) {
|
||||
if (static_cast<SimpleMenuItem*>(mObjects[i])->hasFocus()){
|
||||
resources.GetJLBFont(Constants::MAIN_FONT)->DrawString(static_cast<SimpleMenuItem*>(mObjects[i])->desc.c_str(),mX+mWidth+10,mY+15);
|
||||
mFont->SetColor(options[Metrics::POPUP_MENU_TCH].asColor(ARGB(255,255,255,0)));
|
||||
mFont->SetColor(ARGB(255,255,255,0));
|
||||
} else {
|
||||
mFont->SetColor(options[Metrics::POPUP_MENU_TC].asColor(ARGB(150,255,255,255)));
|
||||
mFont->SetColor(ARGB(150,255,255,255));
|
||||
}
|
||||
(static_cast<SimpleMenuItem*>(mObjects[i]))->RenderWithOffset(-LINE_HEIGHT*startId);
|
||||
}
|
||||
|
||||
@@ -319,10 +319,10 @@ void SimplePad::Render(){
|
||||
if(bShowNumpad)
|
||||
offY += kH+14;
|
||||
//Draw Keypad Background.
|
||||
renderer->FillRoundRect(mX-kW,mY-kH,(kW+12)*11,(kH+14)*5+offY,2,options[Metrics::POPUP_MENU_FC].asColor(ARGB(180,0,0,0)));
|
||||
renderer->FillRoundRect(mX-kW,mY-kH,(kW+12)*11,(kH+14)*5+offY,2,ARGB(180,0,0,0));
|
||||
offY = vSpacing;
|
||||
//Draw text entry bubble
|
||||
renderer->FillRoundRect(mX-kW/2,mY+offY,(kW+12)*9+kW/2,kH,2,options[Metrics::KEYPAD_FCH].asColor(ARGB(255,255,255,255)));
|
||||
renderer->FillRoundRect(mX-kW/2,mY+offY,(kW+12)*9+kW/2,kH,2,ARGB(255,255,255,255));
|
||||
|
||||
//Draw text-entry title, if we've got one.
|
||||
if(title != ""){
|
||||
@@ -335,16 +335,16 @@ void SimplePad::Render(){
|
||||
{
|
||||
kW = mFont->GetStringWidth(buffer.substr(cursor,1).c_str());
|
||||
renderer->FillRoundRect(mX+mFont->GetStringWidth(buffer.substr(0,cursor).c_str()),mY+kH-4,
|
||||
kW,4,2,options[Metrics::KEY_FCH].asColor(ARGB(150,150,150,0)));
|
||||
kW,4,2,ARGB(150,150,150,0));
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor = buffer.size();
|
||||
renderer->FillRoundRect(mX+mFont->GetStringWidth(buffer.substr(0,cursor).c_str()),mY+kH-4,
|
||||
kW,4,2,options[Metrics::KEY_FCH].asColor(ARGB(150,150,150,0)));
|
||||
kW,4,2,ARGB(150,150,150,0));
|
||||
}
|
||||
|
||||
mFont->SetColor(options[Metrics::KEYPAD_TC].asColor(ARGB(255,0,0,0)));
|
||||
mFont->SetColor(ARGB(255,0,0,0));
|
||||
mFont->DrawString(buffer.c_str(),mX,mY);
|
||||
offY += kH + 12;
|
||||
|
||||
@@ -399,12 +399,12 @@ void SimplePad::Render(){
|
||||
kW = mFont->GetStringWidth(keys[x]->displayValue.c_str());
|
||||
//Render a key.
|
||||
if(x != selected){
|
||||
renderer->FillRoundRect(mX+offX-4,mY+offY-4,kW+8,kH+4,2,options[Metrics::POPUP_MENU_FC].asColor(ARGB(180,50,50,50)));
|
||||
mFont->SetColor(options[Metrics::POPUP_MENU_TCH].asColor(ARGB(255,255,255,0)));
|
||||
renderer->FillRoundRect(mX+offX-4,mY+offY-4,kW+8,kH+4,2,ARGB(180,50,50,50));
|
||||
mFont->SetColor(ARGB(255,255,255,0));
|
||||
}
|
||||
else{
|
||||
renderer->FillRoundRect(mX+offX-4,mY+offY-4,kW+8,kH+4,2,options[Metrics::POPUP_MENU_FC].asColor(ARGB(255,100,100,100)));
|
||||
mFont->SetColor(options[Metrics::POPUP_MENU_TC].asColor(ARGB(255,255,255,255)));
|
||||
renderer->FillRoundRect(mX+offX-4,mY+offY-4,kW+8,kH+4,2,ARGB(255,100,100,100));
|
||||
mFont->SetColor(ARGB(255,255,255,255));
|
||||
}
|
||||
|
||||
char vkey[2];
|
||||
|
||||
@@ -253,7 +253,9 @@ bool WCachedTexture::Attempt(string filename, int submode, int & error){
|
||||
string realname;
|
||||
|
||||
//Form correct filename.
|
||||
if(submode & TEXTURE_SUB_CARD){
|
||||
if(submode & TEXTURE_SUB_EXACT)
|
||||
realname = filename;
|
||||
else if(submode & TEXTURE_SUB_CARD){
|
||||
if(submode & TEXTURE_SUB_THUMB){
|
||||
for(string::size_type i= 0;i < filename.size();i++){
|
||||
if(filename[i] == '\\' || filename[i] == '/'){
|
||||
|
||||
Reference in New Issue
Block a user