TSAGE: Added display logic for character selection dialog in R2RW

This commit is contained in:
Paul Gilbert 2011-11-01 21:07:57 +11:00
parent acdeb1fb31
commit 5ae9c15cdc
4 changed files with 60 additions and 0 deletions

View File

@ -176,6 +176,7 @@ void RightClickDialog::execute() {
break;
case 4:
// Change player
CharacterDialog::show();
break;
case 5:
// Options dialog
@ -188,6 +189,43 @@ void RightClickDialog::execute() {
_gfxManager.deactivate();
}
/*--------------------------------------------------------------------------*/
void CharacterDialog::show() {
CharacterDialog *dlg = new CharacterDialog();
dlg->draw();
GfxButton *btn = dlg->execute(&dlg->_btnCancel);
dlg->remove();
delete dlg;
}
CharacterDialog::CharacterDialog() {
// Set the element text
_msgTitle.set(CHAR_TITLE, 140, ALIGN_LEFT);
_btnQuinn.setText(CHAR_QUINN_MSG);
_btnSeeker.setText(CHAR_SEEKER_MSG);
_btnMiranda.setText(CHAR_MIRANDA_MSG);
_btnCancel.setText(CHAR_CANCEL_MSG);
// Set position of the elements
_msgTitle._bounds.moveTo(5, 5);
_btnQuinn._bounds.moveTo(25, _msgTitle._bounds.bottom + 1);
_btnSeeker._bounds.moveTo(25, _btnQuinn._bounds.bottom + 1);
_btnMiranda._bounds.moveTo(25, _btnSeeker._bounds.bottom + 1);
_btnCancel._bounds.moveTo(25, _btnMiranda._bounds.bottom + 1);
// Add the items to the dialog
addElements(&_msgTitle, &_btnQuinn, &_btnSeeker, &_btnMiranda, &_btnCancel, NULL);
// Set the dialog size and position
frame();
_bounds.collapse(-6, -6);
setCenter(160, 100);
}
} // End of namespace Ringworld2
} // End of namespace TsAGE

View File

@ -59,6 +59,18 @@ public:
void execute();
};
class CharacterDialog: public GfxDialog {
private:
GfxMessage _msgTitle;
GfxButton _btnQuinn, _btnMiranda, _btnSeeker;
GfxButton _btnCancel;
public:
CharacterDialog();
virtual ~CharacterDialog() {}
static void show();
};
} // End of namespace Ringworld2
} // End of namespace TsAGE

View File

@ -193,6 +193,11 @@ const char *CONSOLE_MESSAGES[] = {
};
const char *HELP_MSG = "\x1\rRETURN TO\r RINGWORLD\x14";
const char *CHAR_TITLE = "\x01Select Character:";
const char *CHAR_QUINN_MSG = " Quinn ";
const char *CHAR_SEEKER_MSG = " Seeker ";
const char *CHAR_MIRANDA_MSG = "Miranda";
const char *CHAR_CANCEL_MSG = " Cancel ";
} // End of namespace Ringworld2

View File

@ -151,6 +151,11 @@ extern const char *CONSOLE_MESSAGES[];
// Dialog messages
extern const char *HELP_MSG;
extern const char *CHAR_TITLE;
extern const char *CHAR_QUINN_MSG;
extern const char *CHAR_SEEKER_MSG;
extern const char *CHAR_MIRANDA_MSG;
extern const char *CHAR_CANCEL_MSG;
} // End of namespace Ringworld2