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