- added ability to display both error and normal messagebox in non overlapping way simultaneously

- added new hotkey to toggle photomode in game (f8)
This commit is contained in:
Mark Vejvoda 2010-09-11 16:14:03 +00:00
parent 52916bdc6e
commit ceca2de4b1
5 changed files with 63 additions and 42 deletions

View File

@ -43,6 +43,7 @@ ChatTeamMode=H
ToggleMusic=K
SaveGUILayout=vkF11
ReloadINI=vkF5
TogglePhotoMode=vkF8
; === propertyMap File ===

View File

@ -359,7 +359,7 @@ bool GraphicListBox::mouseClick(int x, int y){
const int GraphicMessageBox::defH= 240;
const int GraphicMessageBox::defW= 350;
void GraphicMessageBox::init(const string &button1Str, const string &button2Str){
void GraphicMessageBox::init(const string &button1Str, const string &button2Str) {
init(button1Str);
button1.init(x+(w-GraphicButton::defW)/4, y+25);
@ -369,7 +369,21 @@ void GraphicMessageBox::init(const string &button1Str, const string &button2Str)
buttonCount= 2;
}
void GraphicMessageBox::init(const string &button1Str){
void GraphicMessageBox::setX(int x) {
this->x= x;
button1.init(x+(w-GraphicButton::defW)/4, y+25);
button2.init(x+3*(w-GraphicButton::defW)/4, y+25);
}
void GraphicMessageBox::setY(int y) {
this->y= y;
button1.init(x+(w-GraphicButton::defW)/4, y+25);
button2.init(x+3*(w-GraphicButton::defW)/4, y+25);
}
void GraphicMessageBox::init(const string &button1Str) {
font= CoreData::getInstance().getMenuFontNormal();
h= defH;

View File

@ -59,33 +59,33 @@ public:
virtual ~GraphicComponent(){}
static void clearRegisteredComponents(std::string containerName="");
void registerGraphicComponent(std::string containerName, std::string objName);
virtual void registerGraphicComponent(std::string containerName, std::string objName);
static GraphicComponent * findRegisteredComponent(std::string containerName, std::string objName);
static void applyAllCustomProperties(std::string containerName);
void applyCustomProperties(std::string containerName);
virtual void applyCustomProperties(std::string containerName);
static bool saveAllCustomProperties(std::string containerName);
bool saveCustomProperties(std::string containerName);
virtual bool saveCustomProperties(std::string containerName);
void init(int x, int y, int w, int h);
virtual void init(int x, int y, int w, int h);
int getX() const {return x;}
int getY() const {return y;}
int getW() const {return w;}
int getH() const {return h;}
const string &getText() const {return text;}
const Font2D *getFont() const {return font;}
bool getEnabled() const {return enabled;}
bool getEditable() const {return editable;}
bool getVisible() const {return visible;}
virtual int getX() const {return x;}
virtual int getY() const {return y;}
virtual int getW() const {return w;}
virtual int getH() const {return h;}
virtual const string &getText() const {return text;}
virtual const Font2D *getFont() const {return font;}
virtual bool getEnabled() const {return enabled;}
virtual bool getEditable() const {return editable;}
virtual bool getVisible() const {return visible;}
void setX(int x) {this->x= x;}
void setY(int y) {this->y= y;}
void setText(const string &text) {this->text= text;}
void setFont(const Font2D *font) {this->font= font;}
void setEnabled(bool enabled) {this->enabled= enabled;}
void setEditable(bool editable) {this->editable= editable;}
void setVisible(bool value) {this->visible = value;}
virtual void setX(int x) {this->x= x;}
virtual void setY(int y) {this->y= y;}
virtual void setText(const string &text) {this->text= text;}
virtual void setFont(const Font2D *font) {this->font= font;}
virtual void setEnabled(bool enabled) {this->enabled= enabled;}
virtual void setEditable(bool editable) {this->editable= editable;}
virtual void setVisible(bool value) {this->visible = value;}
virtual bool mouseMove(int x, int y);
virtual bool mouseClick(int x, int y);
@ -194,6 +194,9 @@ public:
const GraphicButton *getButton1() const {return &button1;}
const GraphicButton *getButton2() const {return &button2;}
string getHeader() const {return header;}
virtual void setX(int x);
virtual void setY(int y);
void setHeader(string header) {this->header= header;}

View File

@ -49,8 +49,6 @@ Game::Game(Program *program, const GameSettings *gameSettings):
original_updateFps = GameConstants::updateFps;
original_cameraFps = GameConstants::cameraFps;
// GameConstants::updateFps= 20;
// GameConstants::cameraFps= 50;
GameConstants::updateFps= 40;
GameConstants::cameraFps= 100;
captureAvgTestStatus = false;
@ -63,7 +61,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
this->gameSettings= *gameSettings;
scrollSpeed = Config::getInstance().getFloat("UiScrollSpeed","1.5");
photoModeEnabled = Config::getInstance().getBool("PhotoMode","false");
//MIN_RENDER_FPS_ALLOWED = Config::getInstance().getInt("MIN_RENDER_FPS_ALLOWED",intToStr(MIN_RENDER_FPS_ALLOWED).c_str());
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] MIN_RENDER_FPS_ALLOWED = %d\n",__FILE__,__FUNCTION__,__LINE__,MIN_RENDER_FPS_ALLOWED);
@ -528,6 +526,7 @@ void Game::init()
//mesage box
errorMessageBox.init(lang.get("Ok"));
errorMessageBox.setEnabled(false);
errorMessageBox.setY(mainMessageBox.getY() - mainMessageBox.getH() - 10);
//init world, and place camera
commander.init(&world);
@ -1113,7 +1112,7 @@ void Game::eventMouseWheel(int x, int y, int zDelta) {
}
}
void Game::keyDown(char key){
void Game::keyDown(char key) {
try {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = [%c] [%d]\n",__FILE__,__FUNCTION__,__LINE__,key,key);
@ -1123,7 +1122,7 @@ void Game::keyDown(char key){
//send key to the chat manager
chatManager.keyDown(key);
if(!chatManager.getEditEnabled()){
if(chatManager.getEditEnabled() == false) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] key = %d\n",__FILE__,__FUNCTION__,__LINE__,key);
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
@ -1134,6 +1133,9 @@ void Game::keyDown(char key){
else if(key == configKeys.getCharKey("ShowFullConsole")) {
showFullConsole= true;
}
else if(key == configKeys.getCharKey("TogglePhotoMode")) {
photoModeEnabled = !photoModeEnabled;
}
//Toggle music
else if(key == configKeys.getCharKey("ToggleMusic")) {
Config &config = Config::getInstance();
@ -1274,6 +1276,8 @@ void Game::keyDown(char key){
}
}
}
//throw runtime_error("Test Error!");
}
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
@ -1287,17 +1291,14 @@ void Game::keyDown(char key){
void Game::keyUp(char key){
try {
if(chatManager.getEditEnabled()){
if(chatManager.getEditEnabled()) {
//send key to the chat manager
chatManager.keyUp(key);
}
else {
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
if(key == configKeys.getCharKey("RenderNetworkStatus")) {
//renderNetworkStatus= false;
}
else if(key == configKeys.getCharKey("ShowFullConsole")) {
if(key == configKeys.getCharKey("ShowFullConsole")) {
showFullConsole= false;
}
else if(key == configKeys.getCharKey("CameraRotateLeft") ||
@ -1469,7 +1470,7 @@ void Game::render2d(){
renderer.renderDisplay();
//minimap
if(!config.getBool("PhotoMode")){
if(photoModeEnabled == false) {
renderer.renderMinimap();
}
@ -1477,12 +1478,12 @@ void Game::render2d(){
renderer.renderSelectionQuad();
//exit message box
if(mainMessageBox.getEnabled()){
renderer.renderMessageBox(&mainMessageBox);
}
if(errorMessageBox.getEnabled()){
if(errorMessageBox.getEnabled()) {
renderer.renderMessageBox(&errorMessageBox);
}
if(mainMessageBox.getEnabled()) {
renderer.renderMessageBox(&mainMessageBox);
}
//script message box
if( mainMessageBox.getEnabled() == false &&
@ -1656,7 +1657,7 @@ void Game::render2d(){
}
//resource info
if(config.getBool("PhotoMode") == false) {
if(photoModeEnabled == false) {
renderer.renderResourceStatus();
renderer.renderConsole(&console,showFullConsole);
}
@ -1799,11 +1800,11 @@ void Game::checkWinnerStandard(){
}
}
void Game::checkWinnerScripted(){
if(scriptManager.getGameOver()){
void Game::checkWinnerScripted() {
if(scriptManager.getGameOver()) {
gameOver= true;
for(int i= 0; i<world.getFactionCount(); ++i){
if(scriptManager.getPlayerModifiers(i)->getWinner()){
for(int i= 0; i<world.getFactionCount(); ++i) {
if(scriptManager.getPlayerModifiers(i)->getWinner()) {
world.getStats()->setVictorious(i);
}
}

View File

@ -95,6 +95,8 @@ private:
int updateFpsAvgTest;
int renderFpsAvgTest;
bool photoModeEnabled;
public:
Game(Program *program, const GameSettings *gameSettings);
~Game();