2010-04-07 22:20:28 +00:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
|
|
|
|
//
|
2011-01-10 05:06:00 +00:00
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
2010-04-07 22:20:28 +00:00
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
|
|
#include "menu_state_graphic_info.h"
|
|
|
|
|
|
|
|
|
|
#include "renderer.h"
|
|
|
|
|
#include "sound_renderer.h"
|
|
|
|
|
#include "core_data.h"
|
|
|
|
|
#include "menu_state_options.h"
|
2010-09-09 21:07:39 +00:00
|
|
|
|
#include "config.h"
|
2010-04-07 22:20:28 +00:00
|
|
|
|
#include "leak_dumper.h"
|
|
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
|
// class MenuStateGraphicInfo
|
|
|
|
|
// =====================================================
|
|
|
|
|
|
2011-01-10 05:06:00 +00:00
|
|
|
|
MenuStateGraphicInfo::MenuStateGraphicInfo(Program *program, MainMenu *mainMenu):
|
2010-04-07 22:20:28 +00:00
|
|
|
|
MenuState(program, mainMenu, "info")
|
|
|
|
|
{
|
2010-09-09 21:07:39 +00:00
|
|
|
|
containerName = "GraphicInfo";
|
2010-09-09 06:42:39 +00:00
|
|
|
|
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
2011-01-10 05:06:00 +00:00
|
|
|
|
buttonReturn.init(100, 540, 125);
|
2010-09-09 06:42:39 +00:00
|
|
|
|
|
|
|
|
|
labelInfo.registerGraphicComponent(containerName,"labelInfo");
|
2010-04-07 22:20:28 +00:00
|
|
|
|
labelInfo.init(100, 700);
|
2010-09-09 06:42:39 +00:00
|
|
|
|
|
|
|
|
|
labelMoreInfo.registerGraphicComponent(containerName,"labelMoreInfo");
|
2011-01-10 05:06:00 +00:00
|
|
|
|
labelMoreInfo.init(100, 520);
|
2010-04-07 22:20:28 +00:00
|
|
|
|
labelMoreInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
|
|
|
|
|
2010-09-09 06:42:39 +00:00
|
|
|
|
GraphicComponent::applyAllCustomProperties(containerName);
|
|
|
|
|
|
2010-04-07 22:20:28 +00:00
|
|
|
|
Renderer &renderer= Renderer::getInstance();
|
|
|
|
|
glInfo= renderer.getGlInfo();
|
|
|
|
|
glMoreInfo= renderer.getGlMoreInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateGraphicInfo::mouseClick(int x, int y, MouseButton mouseButton){
|
|
|
|
|
CoreData &coreData= CoreData::getInstance();
|
|
|
|
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
|
|
|
|
|
|
|
|
|
if(buttonReturn.mouseClick(x,y)){
|
|
|
|
|
soundRenderer.playFx(coreData.getClickSoundA());
|
|
|
|
|
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
2011-01-10 05:06:00 +00:00
|
|
|
|
}
|
2010-04-07 22:20:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateGraphicInfo::mouseMove(int x, int y, const MouseState *ms){
|
|
|
|
|
buttonReturn.mouseMove(x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MenuStateGraphicInfo::render(){
|
2011-01-10 05:06:00 +00:00
|
|
|
|
|
2010-04-07 22:20:28 +00:00
|
|
|
|
Renderer &renderer= Renderer::getInstance();
|
|
|
|
|
Lang &lang= Lang::getInstance();
|
2011-01-10 05:06:00 +00:00
|
|
|
|
|
2010-04-07 22:20:28 +00:00
|
|
|
|
buttonReturn.setText(lang.get("Return"));
|
|
|
|
|
labelInfo.setText(glInfo);
|
|
|
|
|
labelMoreInfo.setText(glMoreInfo);
|
|
|
|
|
|
|
|
|
|
renderer.renderButton(&buttonReturn);
|
|
|
|
|
renderer.renderLabel(&labelInfo);
|
|
|
|
|
renderer.renderLabel(&labelMoreInfo);
|
2011-04-15 01:05:36 +00:00
|
|
|
|
|
|
|
|
|
renderer.renderConsole(&console,false,true);
|
2010-04-07 22:20:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-09-09 21:07:39 +00:00
|
|
|
|
void MenuStateGraphicInfo::keyDown(char key) {
|
|
|
|
|
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
|
|
|
|
if(key == configKeys.getCharKey("SaveGUILayout")) {
|
|
|
|
|
bool saved = GraphicComponent::saveAllCustomProperties(containerName);
|
|
|
|
|
//Lang &lang= Lang::getInstance();
|
|
|
|
|
//console.addLine(lang.get("GUILayoutSaved") + " [" + (saved ? lang.get("Yes") : lang.get("No"))+ "]");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-07 22:20:28 +00:00
|
|
|
|
}}//end namespace
|