Jeck - Some warnings cleanup.
This commit is contained in:
@@ -52,7 +52,7 @@ class GameStateMenu: public GameState, public JGuiListener
|
||||
virtual void Render();
|
||||
virtual void ButtonPressed(int controllerId, int controlId);
|
||||
|
||||
int nextDirectory(char * root, char * file); // Retrieves the next directory to have matching file
|
||||
int nextDirectory(const char * root, const char * file); // Retrieves the next directory to have matching file
|
||||
void resetDirectory();
|
||||
void createUsersFirstDeck(int setId);
|
||||
virtual ostream& toString(ostream& out) const;
|
||||
|
||||
@@ -32,7 +32,7 @@ public:
|
||||
|
||||
string buffer;
|
||||
string title;
|
||||
int cursorPos();
|
||||
unsigned int cursorPos();
|
||||
bool isActive() {return bActive;};
|
||||
void Render();
|
||||
void Update(float dt);
|
||||
@@ -57,7 +57,7 @@ private:
|
||||
bool bShowCancel, bShowNumpad;
|
||||
bool bCanceled;
|
||||
int nbitems;
|
||||
int cursor;
|
||||
unsigned int cursor;
|
||||
int selected;
|
||||
int priorKey; //The prior key from those places.
|
||||
SimpleKey * keys[KPD_MAX];
|
||||
|
||||
@@ -93,7 +93,7 @@ PIXEL_TYPE GameOption::asColor(PIXEL_TYPE fallback)
|
||||
if(str[i] == ','){
|
||||
if(temp == "")
|
||||
return fallback;
|
||||
color[subpixel] = atoi(temp.c_str());
|
||||
color[subpixel] = (unsigned char) atoi(temp.c_str());
|
||||
temp = "";
|
||||
subpixel++;
|
||||
continue;
|
||||
@@ -106,7 +106,7 @@ PIXEL_TYPE GameOption::asColor(PIXEL_TYPE fallback)
|
||||
}
|
||||
|
||||
if(temp != "")
|
||||
color[subpixel] = atoi(temp.c_str());
|
||||
color[subpixel] = (unsigned char) atoi(temp.c_str());
|
||||
if(subpixel == 2)
|
||||
color[3] = 255;
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ void GameStateMenu::resetDirectory(){
|
||||
mDip = NULL;
|
||||
}
|
||||
}
|
||||
int GameStateMenu::nextDirectory(char * root, char * file){
|
||||
int GameStateMenu::nextDirectory(const char * root, const char * file){
|
||||
int found = 0;
|
||||
if (!mDip){
|
||||
mDip = opendir(root);
|
||||
|
||||
@@ -87,11 +87,11 @@ void GameStateOptions::Update(float dt)
|
||||
else if (mState == SHOW_OPTIONS){
|
||||
|
||||
switch(optionsTabs->Submode()){
|
||||
// case OPTIONS_SUBMODE_RELOAD:
|
||||
// optionsTabs->acceptSubmode();
|
||||
// optionsTabs->reloadValues();
|
||||
// mState = SHOW_OPTIONS;
|
||||
// break;
|
||||
case OPTIONS_SUBMODE_RELOAD:
|
||||
optionsTabs->acceptSubmode();
|
||||
optionsTabs->reloadValues();
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
case OPTIONS_SUBMODE_PROFILE:
|
||||
mState = SHOW_OPTIONS_PROFILE;
|
||||
break;
|
||||
@@ -188,13 +188,13 @@ void GameStateOptions::ButtonPressed(int controllerId, int controlId)
|
||||
switch (controlId){
|
||||
case 1:
|
||||
//Load the new profile.
|
||||
//optionsTabs->acceptSubmode();
|
||||
//optionsTabs->reloadValues();
|
||||
optionsTabs->acceptSubmode();
|
||||
optionsTabs->reloadValues();
|
||||
//Reset the current settings to those of the profile...
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
case 2:
|
||||
//optionsTabs->cancelSubmode();
|
||||
optionsTabs->cancelSubmode();
|
||||
mState = SHOW_OPTIONS;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,6 @@ void OptionProfile::Update(float dt){
|
||||
}
|
||||
|
||||
void OptionProfile::Entering(){
|
||||
JLBFont * menuFont = GameApp::CommonRes->GetJLBFont(Constants::MENU_FONT);
|
||||
hasFocus = true;
|
||||
bCheck = false;
|
||||
initialValue = value;
|
||||
@@ -310,6 +309,7 @@ void OptionProfile::cancelSubmode()
|
||||
options[Options::ACTIVE_PROFILE] = selections[initialValue];
|
||||
value = initialValue;
|
||||
populate();
|
||||
bCheck = false;
|
||||
}
|
||||
void OptionProfile::acceptSubmode()
|
||||
{
|
||||
@@ -319,6 +319,7 @@ void OptionProfile::acceptSubmode()
|
||||
options[Options::ACTIVE_PROFILE] = selections[value];
|
||||
initialValue = value;
|
||||
populate();
|
||||
bCheck = false;
|
||||
}
|
||||
|
||||
//OptionDirectory
|
||||
|
||||
@@ -134,33 +134,32 @@ SimpleKey * SimplePad::Add(string display, unsigned char id){
|
||||
}
|
||||
void SimplePad::pressKey(unsigned char key){
|
||||
string input = "";
|
||||
int tCursor = cursor;
|
||||
|
||||
if(isalpha(key)) {
|
||||
if(bCapslock)
|
||||
input += toupper(key);
|
||||
else
|
||||
input += key;
|
||||
|
||||
if(cursor < 0 || cursor > buffer.size())
|
||||
tCursor = buffer.size();
|
||||
else
|
||||
|
||||
if(cursor < buffer.size())
|
||||
cursor++;
|
||||
buffer.insert(tCursor,input);
|
||||
|
||||
buffer.insert(cursor,input);
|
||||
}
|
||||
else if(key == KPD_CAPS)
|
||||
bCapslock = !bCapslock;
|
||||
else if(key == KPD_DEL) {
|
||||
if(cursor < 0 || cursor > buffer.size())
|
||||
cursor = buffer.size();
|
||||
if(cursor == buffer.size())
|
||||
buffer = buffer.substr(0,cursor-1);
|
||||
else if(cursor > 0)
|
||||
buffer = buffer.substr(0,cursor) + buffer.substr(cursor+1);
|
||||
else
|
||||
return;
|
||||
if(!buffer.size())
|
||||
return;
|
||||
|
||||
cursor--;
|
||||
if(cursor >= buffer.size()) {
|
||||
cursor = buffer.size();
|
||||
buffer = buffer.substr(0,cursor-1);
|
||||
}
|
||||
else
|
||||
buffer = buffer.substr(0,cursor) + buffer.substr(cursor+1);
|
||||
|
||||
cursor--;
|
||||
}
|
||||
else if(key == KPD_OK)
|
||||
Finish();
|
||||
@@ -206,21 +205,18 @@ void SimplePad::Update(float dt){
|
||||
else if (mEngine->GetButtonClick(PSP_CTRL_LEFT)||mEngine->GetButtonClick(PSP_CTRL_RIGHT)
|
||||
||mEngine->GetButtonClick(PSP_CTRL_UP)||mEngine->GetButtonClick(PSP_CTRL_DOWN))
|
||||
selected = priorKey;
|
||||
} //Moving in/from the text field.
|
||||
} //Moving within/from the text field.
|
||||
else if(selected == KPD_INPUT){
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_DOWN) )
|
||||
selected = priorKey;
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_LEFT) && cursor > -1){
|
||||
if(cursor > buffer.size())
|
||||
cursor = buffer.size() - 1;
|
||||
else
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_LEFT)){
|
||||
if(cursor > 0)
|
||||
cursor--;
|
||||
}
|
||||
else if (mEngine->GetButtonClick(PSP_CTRL_RIGHT))
|
||||
else if (mEngine->GetButtonClick(PSP_CTRL_RIGHT)){
|
||||
if(cursor < buffer.size())
|
||||
cursor++;
|
||||
else
|
||||
cursor = buffer.size() + 1;
|
||||
}
|
||||
}
|
||||
else if(selected >= 0 && keys[selected]){
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_LEFT))
|
||||
@@ -239,17 +235,14 @@ void SimplePad::Update(float dt){
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_CIRCLE))
|
||||
pressKey(keys[selected]->id);
|
||||
}
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_CROSS) && buffer.size() > 0)
|
||||
if (buffer.size() > 0 && mEngine->GetButtonClick(PSP_CTRL_CROSS))
|
||||
buffer = buffer.substr(0,buffer.size() - 1);
|
||||
if (mEngine->GetButtonClick(PSP_CTRL_LTRIGGER)){
|
||||
if(buffer.size() != 0 && cursor != 0)
|
||||
if(cursor < 0 || cursor >= buffer.size())
|
||||
cursor = buffer.size() - 1;
|
||||
else
|
||||
if (buffer.size() && mEngine->GetButtonClick(PSP_CTRL_LTRIGGER)){
|
||||
if(cursor > 0)
|
||||
cursor--;
|
||||
}
|
||||
else if (mEngine->GetButtonClick(PSP_CTRL_RTRIGGER)){
|
||||
if(cursor > -1 && cursor < buffer.size())
|
||||
if(cursor < buffer.size())
|
||||
cursor++;
|
||||
else{
|
||||
buffer += ' ';
|
||||
@@ -290,6 +283,7 @@ void SimplePad::Render(){
|
||||
int offX = 0, offY = 0;
|
||||
int kH = mFont->GetHeight();
|
||||
int hSpacing = mFont->GetStringWidth("W");
|
||||
int rowLen = mFont->GetStringWidth("JKLMNOPQR") + 14*7;
|
||||
int vSpacing = 0;
|
||||
int kW = hSpacing;
|
||||
|
||||
@@ -317,17 +311,16 @@ void SimplePad::Render(){
|
||||
}
|
||||
|
||||
//Draw cursor.
|
||||
int cPos = cursor;
|
||||
if(cPos > -1 && cPos < buffer.size())
|
||||
if(cursor < buffer.size())
|
||||
{
|
||||
kW = mFont->GetStringWidth(buffer.substr(cPos,1).c_str());
|
||||
renderer->FillRoundRect(mX+mFont->GetStringWidth(buffer.substr(0,cPos).c_str()),mY+kH-4,
|
||||
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)));
|
||||
}
|
||||
else
|
||||
{
|
||||
cPos = buffer.size();
|
||||
renderer->FillRoundRect(mX+mFont->GetStringWidth(buffer.substr(0,cPos).c_str()),mY+kH-4,
|
||||
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)));
|
||||
}
|
||||
|
||||
@@ -335,7 +328,6 @@ void SimplePad::Render(){
|
||||
mFont->DrawString(buffer.c_str(),mX,mY);
|
||||
offY += kH + 12;
|
||||
|
||||
int rowLen[4];
|
||||
if(!bShowNumpad)
|
||||
vSpacing -= kH + 12;
|
||||
|
||||
@@ -350,23 +342,15 @@ void SimplePad::Render(){
|
||||
offX = 0;
|
||||
offY = vSpacing;
|
||||
break;
|
||||
case KPD_9:
|
||||
rowLen[0] = offX;
|
||||
break;
|
||||
case KPD_A:
|
||||
offX = 0;
|
||||
offY = vSpacing+(kH+12)*1;
|
||||
break;
|
||||
case KPD_Z:
|
||||
rowLen[3] = offX;
|
||||
break;
|
||||
case KPD_J:
|
||||
rowLen[1] = offX;
|
||||
offX = 0;
|
||||
offY = vSpacing+(kH+12)*2;
|
||||
break;
|
||||
case KPD_S:
|
||||
rowLen[2] = offX;
|
||||
offX = 0;
|
||||
offY = vSpacing+(kH+12)*3;
|
||||
break;
|
||||
@@ -375,19 +359,19 @@ void SimplePad::Render(){
|
||||
offY = vSpacing+(kH+12)*4;
|
||||
break;
|
||||
case KPD_OK:
|
||||
offX = rowLen[1] + hSpacing;
|
||||
offX = rowLen + hSpacing;
|
||||
offY = vSpacing+(kH+12)*3;
|
||||
break;
|
||||
case KPD_CANCEL:
|
||||
offX = rowLen[1] + hSpacing;
|
||||
offX = rowLen + hSpacing;
|
||||
offY = vSpacing+(kH+12)*4;
|
||||
break;
|
||||
case KPD_DEL:
|
||||
offX = rowLen[1] + hSpacing;
|
||||
offX = rowLen + hSpacing;
|
||||
offY = vSpacing+(kH+12)*1;
|
||||
break;
|
||||
case KPD_CAPS:
|
||||
offX = rowLen[1] + hSpacing;
|
||||
offX = rowLen + hSpacing;
|
||||
offY = vSpacing+(kH+12)*2;
|
||||
break;
|
||||
}
|
||||
@@ -418,8 +402,8 @@ void SimplePad::Render(){
|
||||
}
|
||||
}
|
||||
|
||||
int SimplePad::cursorPos(){
|
||||
if(cursor < 0 || cursor > buffer.size())
|
||||
unsigned int SimplePad::cursorPos(){
|
||||
if(cursor > buffer.size())
|
||||
return buffer.size();
|
||||
|
||||
return cursor;
|
||||
|
||||
Reference in New Issue
Block a user