mirror of
https://github.com/glest/glest-source.git
synced 2025-01-17 21:28:21 +01:00
glest_game/menu:reformat/restyle source code
* used 'indent -nut -i2 -bli0 -ppi 3 *`
This commit is contained in:
parent
0f469061ec
commit
643aff1aa3
File diff suppressed because it is too large
Load Diff
@ -1,143 +1,199 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MAINMENU_H_
|
||||
#define _GLEST_GAME_MAINMENU_H_
|
||||
# define _GLEST_GAME_MAINMENU_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "lang.h"
|
||||
#include "console.h"
|
||||
#include "vec.h"
|
||||
#include "world.h"
|
||||
#include "program.h"
|
||||
#include "components.h"
|
||||
#include "menu_background.h"
|
||||
#include "game_settings.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "lang.h"
|
||||
# include "console.h"
|
||||
# include "vec.h"
|
||||
# include "world.h"
|
||||
# include "program.h"
|
||||
# include "components.h"
|
||||
# include "menu_background.h"
|
||||
# include "game_settings.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Shared { namespace Graphics {
|
||||
class VideoPlayer;
|
||||
}}
|
||||
namespace Shared
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
class VideoPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
class MenuState;
|
||||
class MenuState;
|
||||
|
||||
// =====================================================
|
||||
// class MainMenu
|
||||
// class MainMenu
|
||||
//
|
||||
/// Main menu ProgramState
|
||||
/// Main menu ProgramState
|
||||
// =====================================================
|
||||
|
||||
class MainMenu: public ProgramState {
|
||||
|
||||
private:
|
||||
static MenuState *oldstate;
|
||||
//up
|
||||
Program *program;
|
||||
|
||||
//shared
|
||||
GameSettings gameSettings;
|
||||
MenuBackground menuBackground;
|
||||
::Shared::Graphics::VideoPlayer *menuBackgroundVideo;
|
||||
class MainMenu:public ProgramState
|
||||
{
|
||||
|
||||
MenuState *state;
|
||||
private:
|
||||
static MenuState *oldstate;
|
||||
//up
|
||||
Program *program;
|
||||
|
||||
//shared
|
||||
int mouseX, mouseY;
|
||||
int mouse2dAnim;
|
||||
//shared
|
||||
GameSettings gameSettings;
|
||||
MenuBackground menuBackground;
|
||||
::Shared::Graphics::VideoPlayer * menuBackgroundVideo;
|
||||
|
||||
void initBackgroundVideo();
|
||||
MenuState *state;
|
||||
|
||||
public:
|
||||
explicit MainMenu(Program *program);
|
||||
virtual ~MainMenu();
|
||||
//shared
|
||||
int mouseX, mouseY;
|
||||
int mouse2dAnim;
|
||||
|
||||
MenuBackground *getMenuBackground() {return &menuBackground;}
|
||||
const MenuBackground *getConstMenuBackground() const {return &menuBackground;}
|
||||
void initBackgroundVideo ();
|
||||
|
||||
virtual void render();
|
||||
virtual void update();
|
||||
virtual void init();
|
||||
virtual void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
virtual void mouseDownLeft(int x, int y);
|
||||
virtual void mouseDownRight(int x, int y);
|
||||
virtual void mouseUpLeft(int x, int y);
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyUp(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent key);
|
||||
|
||||
void setState(MenuState *state);
|
||||
virtual bool isInSpecialKeyCaptureEvent();
|
||||
public:
|
||||
explicit MainMenu (Program * program);
|
||||
virtual ~ MainMenu ();
|
||||
|
||||
int getMouseX() const {return mouseX;}
|
||||
int getMouseY() const {return mouseY;}
|
||||
int getMouse2dAnim() const {return mouse2dAnim;}
|
||||
virtual void consoleAddLine(string line);
|
||||
virtual void reloadUI();
|
||||
};
|
||||
MenuBackground *getMenuBackground ()
|
||||
{
|
||||
return &menuBackground;
|
||||
}
|
||||
const MenuBackground *getConstMenuBackground () const
|
||||
{
|
||||
return &menuBackground;
|
||||
}
|
||||
|
||||
virtual void render ();
|
||||
virtual void update ();
|
||||
virtual void init ();
|
||||
virtual void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
virtual void mouseDownLeft (int x, int y);
|
||||
virtual void mouseDownRight (int x, int y);
|
||||
virtual void mouseUpLeft (int x, int y);
|
||||
virtual bool textInput (std::string text);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
virtual void keyUp (SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent key);
|
||||
|
||||
void setState (MenuState * state);
|
||||
virtual bool isInSpecialKeyCaptureEvent ();
|
||||
|
||||
int getMouseX () const
|
||||
{
|
||||
return mouseX;
|
||||
}
|
||||
int getMouseY () const
|
||||
{
|
||||
return mouseY;
|
||||
}
|
||||
int getMouse2dAnim () const
|
||||
{
|
||||
return mouse2dAnim;
|
||||
}
|
||||
virtual void consoleAddLine (string line);
|
||||
virtual void reloadUI ();
|
||||
};
|
||||
|
||||
|
||||
// ===============================
|
||||
// class MenuState
|
||||
// class MenuState
|
||||
// ===============================
|
||||
|
||||
class MenuState {
|
||||
protected:
|
||||
Program *program;
|
||||
class MenuState
|
||||
{
|
||||
protected:
|
||||
Program * program;
|
||||
|
||||
MainMenu *mainMenu;
|
||||
Camera camera;
|
||||
MainMenu *mainMenu;
|
||||
Camera camera;
|
||||
|
||||
const char *containerName;
|
||||
Console console;
|
||||
const char *containerName;
|
||||
Console console;
|
||||
|
||||
//vector<int> textCharLength;
|
||||
//vector<int> textCharLength;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
void setActiveInputLabel(GraphicLabel *newLabel, GraphicLabel **activeInputLabelPtr);
|
||||
bool textInputEditLabel(string input, GraphicLabel **activeInputLabelPtr);
|
||||
bool keyPressEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInputLabelPtr);
|
||||
bool keyDownEditLabel(SDL_KeyboardEvent c, GraphicLabel **activeInputLabelPtr);
|
||||
void setActiveInputLabel (GraphicLabel * newLabel,
|
||||
GraphicLabel ** activeInputLabelPtr);
|
||||
bool textInputEditLabel (string input,
|
||||
GraphicLabel ** activeInputLabelPtr);
|
||||
bool keyPressEditLabel (SDL_KeyboardEvent c,
|
||||
GraphicLabel ** activeInputLabelPtr);
|
||||
bool keyDownEditLabel (SDL_KeyboardEvent c,
|
||||
GraphicLabel ** activeInputLabelPtr);
|
||||
|
||||
public:
|
||||
MenuState(Program *program, MainMenu *mainMenu, const string &stateName);
|
||||
virtual ~MenuState();
|
||||
virtual void mouseClick(int x, int y, MouseButton mouseButton)=0;
|
||||
virtual void mouseUp(int x, int y, const MouseButton mouseButton){};
|
||||
virtual void mouseMove(int x, int y, const MouseState *mouseState)=0;
|
||||
virtual void render()=0;
|
||||
virtual void update(){};
|
||||
public:
|
||||
MenuState (Program * program, MainMenu * mainMenu,
|
||||
const string & stateName);
|
||||
virtual ~ MenuState ();
|
||||
virtual void mouseClick (int x, int y, MouseButton mouseButton) = 0;
|
||||
virtual void mouseUp (int x, int y, const MouseButton mouseButton)
|
||||
{
|
||||
};
|
||||
virtual void mouseMove (int x, int y, const MouseState * mouseState) =
|
||||
0;
|
||||
virtual void render () = 0;
|
||||
virtual void update ()
|
||||
{
|
||||
};
|
||||
|
||||
virtual bool textInput(std::string text) {return false; }
|
||||
virtual void keyDown(SDL_KeyboardEvent key){};
|
||||
virtual void keyPress(SDL_KeyboardEvent c){};
|
||||
virtual void keyUp(SDL_KeyboardEvent key){};
|
||||
virtual bool textInput (std::string text)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void keyDown (SDL_KeyboardEvent key)
|
||||
{
|
||||
};
|
||||
virtual void keyPress (SDL_KeyboardEvent c)
|
||||
{
|
||||
};
|
||||
virtual void keyUp (SDL_KeyboardEvent key)
|
||||
{
|
||||
};
|
||||
|
||||
virtual bool isMasterserverMode() const {return false;}
|
||||
const Camera *getCamera() const {return &camera;}
|
||||
virtual bool isMasterserverMode () const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
const Camera *getCamera () const
|
||||
{
|
||||
return &camera;
|
||||
}
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return false; }
|
||||
virtual void consoleAddLine(string line);
|
||||
virtual void reloadUI();
|
||||
virtual bool isInSpecialKeyCaptureEvent ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual void consoleAddLine (string line);
|
||||
virtual void reloadUI ();
|
||||
|
||||
virtual bool isVideoPlaying() { return false; };
|
||||
};
|
||||
virtual bool isVideoPlaying ()
|
||||
{
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
} //end namespace
|
||||
|
||||
#endif
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_background.h"
|
||||
@ -22,216 +22,306 @@
|
||||
#include "game_util.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace Shared::Xml;
|
||||
using namespace Shared::Graphics;
|
||||
using namespace
|
||||
Shared::Util;
|
||||
using namespace
|
||||
Shared::Xml;
|
||||
using namespace
|
||||
Shared::Graphics;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace
|
||||
Glest
|
||||
{
|
||||
namespace
|
||||
Game
|
||||
{
|
||||
|
||||
// =====================================================
|
||||
// class MenuBackground
|
||||
// class MenuBackground
|
||||
// =====================================================
|
||||
|
||||
MenuBackground::MenuBackground() : rps(NULL) {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
MenuBackground::MenuBackground ():
|
||||
rps (NULL)
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
//load data
|
||||
string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||
//load data
|
||||
string
|
||||
data_path =
|
||||
getGameReadWritePath (GameConstants::path_data_CacheLookupKey);
|
||||
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(getGameCustomCoreDataPath(data_path, "data/core/menu/menu.xml"),Properties::getTagReplacementValues());
|
||||
const XmlNode *menuNode= xmlTree.getRootNode();
|
||||
XmlTree
|
||||
xmlTree;
|
||||
xmlTree.
|
||||
load (getGameCustomCoreDataPath (data_path, "data/core/menu/menu.xml"),
|
||||
Properties::getTagReplacementValues ());
|
||||
const XmlNode *
|
||||
menuNode = xmlTree.getRootNode ();
|
||||
|
||||
//water
|
||||
const XmlNode *waterNode= menuNode->getChild("water");
|
||||
water= waterNode->getAttribute("value")->getBoolValue();
|
||||
if(water){
|
||||
waterHeight= waterNode->getAttribute("height")->getFloatValue();
|
||||
//water
|
||||
const XmlNode *
|
||||
waterNode = menuNode->getChild ("water");
|
||||
water = waterNode->getAttribute ("value")->getBoolValue ();
|
||||
if (water)
|
||||
{
|
||||
waterHeight = waterNode->getAttribute ("height")->getFloatValue ();
|
||||
|
||||
//water texture
|
||||
waterTexture= renderer.newTexture2D(rsMenu);
|
||||
if(waterTexture) {
|
||||
waterTexture->getPixmap()->init(4);
|
||||
waterTexture->getPixmap()->load(getGameCustomCoreDataPath(data_path, "data/core/menu/textures/water.tga"));
|
||||
}
|
||||
}
|
||||
//water texture
|
||||
waterTexture = renderer.newTexture2D (rsMenu);
|
||||
if (waterTexture)
|
||||
{
|
||||
waterTexture->getPixmap ()->init (4);
|
||||
waterTexture->
|
||||
getPixmap ()->
|
||||
load (getGameCustomCoreDataPath
|
||||
(data_path, "data/core/menu/textures/water.tga"));
|
||||
}
|
||||
}
|
||||
|
||||
//fog
|
||||
const XmlNode *fogNode= menuNode->getChild("fog");
|
||||
fog= fogNode->getAttribute("value")->getBoolValue();
|
||||
if(fog){
|
||||
fogDensity= fogNode->getAttribute("density")->getFloatValue();
|
||||
}
|
||||
//fog
|
||||
const XmlNode *
|
||||
fogNode = menuNode->getChild ("fog");
|
||||
fog = fogNode->getAttribute ("value")->getBoolValue ();
|
||||
if (fog)
|
||||
{
|
||||
fogDensity = fogNode->getAttribute ("density")->getFloatValue ();
|
||||
}
|
||||
|
||||
//rain
|
||||
bool withRainEffect = Config::getInstance().getBool("RainEffectMenu","true");
|
||||
if(withRainEffect == true) {
|
||||
rain= menuNode->getChild("rain")->getAttribute("value")->getBoolValue();
|
||||
if(rain) {
|
||||
createRainParticleSystem();
|
||||
}
|
||||
}
|
||||
else {
|
||||
rain = false;
|
||||
}
|
||||
//rain
|
||||
bool
|
||||
withRainEffect =
|
||||
Config::getInstance ().getBool ("RainEffectMenu", "true");
|
||||
if (withRainEffect == true)
|
||||
{
|
||||
rain =
|
||||
menuNode->getChild ("rain")->getAttribute ("value")->
|
||||
getBoolValue ();
|
||||
if (rain)
|
||||
{
|
||||
createRainParticleSystem ();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rain = false;
|
||||
}
|
||||
|
||||
//camera
|
||||
const XmlNode *cameraNode= menuNode->getChild("camera");
|
||||
//camera
|
||||
const XmlNode *
|
||||
cameraNode = menuNode->getChild ("camera");
|
||||
|
||||
//position
|
||||
const XmlNode *positionNode= cameraNode->getChild("start-position");
|
||||
Vec3f startPosition;
|
||||
startPosition.x= positionNode->getAttribute("x")->getFloatValue();
|
||||
startPosition.y= positionNode->getAttribute("y")->getFloatValue();
|
||||
startPosition.z= positionNode->getAttribute("z")->getFloatValue();
|
||||
camera.setPosition(startPosition);
|
||||
//position
|
||||
const XmlNode *
|
||||
positionNode = cameraNode->getChild ("start-position");
|
||||
Vec3f
|
||||
startPosition;
|
||||
startPosition.x = positionNode->getAttribute ("x")->getFloatValue ();
|
||||
startPosition.y = positionNode->getAttribute ("y")->getFloatValue ();
|
||||
startPosition.z = positionNode->getAttribute ("z")->getFloatValue ();
|
||||
camera.setPosition (startPosition);
|
||||
|
||||
//rotation
|
||||
const XmlNode *rotationNode= cameraNode->getChild("start-rotation");
|
||||
Vec3f startRotation;
|
||||
startRotation.x= rotationNode->getAttribute("x")->getFloatValue();
|
||||
startRotation.y= rotationNode->getAttribute("y")->getFloatValue();
|
||||
startRotation.z= rotationNode->getAttribute("z")->getFloatValue();
|
||||
camera.setOrientation(Quaternion(EulerAngles(
|
||||
degToRad(startRotation.x),
|
||||
degToRad(startRotation.y),
|
||||
degToRad(startRotation.z))));
|
||||
//rotation
|
||||
const XmlNode *
|
||||
rotationNode = cameraNode->getChild ("start-rotation");
|
||||
Vec3f
|
||||
startRotation;
|
||||
startRotation.x = rotationNode->getAttribute ("x")->getFloatValue ();
|
||||
startRotation.y = rotationNode->getAttribute ("y")->getFloatValue ();
|
||||
startRotation.z = rotationNode->getAttribute ("z")->getFloatValue ();
|
||||
camera.
|
||||
setOrientation (Quaternion
|
||||
(EulerAngles
|
||||
(degToRad (startRotation.x),
|
||||
degToRad (startRotation.y),
|
||||
degToRad (startRotation.z))));
|
||||
|
||||
//load main model
|
||||
string mainModelFile = "data/core/menu/main_model/menu_main.g3d";
|
||||
if(menuNode->hasChild("menu-background-model") == true) {
|
||||
//load main model
|
||||
string
|
||||
mainModelFile = "data/core/menu/main_model/menu_main.g3d";
|
||||
if (menuNode->hasChild ("menu-background-model") == true)
|
||||
{
|
||||
//mainModel->load(data_path + "data/core/menu/main_model/menu_main.g3d");
|
||||
const XmlNode *mainMenuModelNode= menuNode->getChild("menu-background-model");
|
||||
mainModelFile = mainMenuModelNode->getAttribute("value")->getRestrictedValue();
|
||||
const XmlNode *
|
||||
mainMenuModelNode = menuNode->getChild ("menu-background-model");
|
||||
mainModelFile =
|
||||
mainMenuModelNode->getAttribute ("value")->getRestrictedValue ();
|
||||
}
|
||||
mainModel =
|
||||
renderer.newModel (rsMenu,
|
||||
getGameCustomCoreDataPath (data_path,
|
||||
mainModelFile));
|
||||
|
||||
//models
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
characterModels[i] =
|
||||
renderer.newModel (rsMenu,
|
||||
getGameCustomCoreDataPath (data_path,
|
||||
"data/core/menu/about_models/character"
|
||||
+ intToStr (i) +
|
||||
".g3d"));
|
||||
}
|
||||
|
||||
//about position
|
||||
positionNode = cameraNode->getChild ("about-position");
|
||||
aboutPosition.x = positionNode->getAttribute ("x")->getFloatValue ();
|
||||
aboutPosition.y = positionNode->getAttribute ("y")->getFloatValue ();
|
||||
aboutPosition.z = positionNode->getAttribute ("z")->getFloatValue ();
|
||||
//rotationNode= cameraNode->getChild("about-rotation");
|
||||
|
||||
targetCamera = NULL;
|
||||
t = 0.f;
|
||||
fade = 0.f;
|
||||
anim = 0.f;
|
||||
}
|
||||
mainModel = renderer.newModel(rsMenu, getGameCustomCoreDataPath(data_path, mainModelFile));
|
||||
|
||||
//models
|
||||
for(int i=0; i<5; ++i) {
|
||||
characterModels[i] = renderer.newModel(rsMenu, getGameCustomCoreDataPath(data_path, "data/core/menu/about_models/character"+intToStr(i)+".g3d"));
|
||||
}
|
||||
MenuBackground::~MenuBackground ()
|
||||
{
|
||||
//printf("In ~MenuBackground() rps = %p\n",rps);
|
||||
|
||||
//about position
|
||||
positionNode= cameraNode->getChild("about-position");
|
||||
aboutPosition.x= positionNode->getAttribute("x")->getFloatValue();
|
||||
aboutPosition.y= positionNode->getAttribute("y")->getFloatValue();
|
||||
aboutPosition.z= positionNode->getAttribute("z")->getFloatValue();
|
||||
//rotationNode= cameraNode->getChild("about-rotation");
|
||||
cleanup ();
|
||||
}
|
||||
|
||||
targetCamera= NULL;
|
||||
t= 0.f;
|
||||
fade= 0.f;
|
||||
anim= 0.f;
|
||||
}
|
||||
void
|
||||
MenuBackground::cleanup ()
|
||||
{
|
||||
//printf("In MenuBackground::cleanup() rps = %p\n",rps);
|
||||
|
||||
MenuBackground::~MenuBackground() {
|
||||
//printf("In ~MenuBackground() rps = %p\n",rps);
|
||||
if (rps != NULL)
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
if (renderer.validateParticleSystemStillExists (rps, rsMenu) == true)
|
||||
{
|
||||
rps->fade ();
|
||||
vector < ParticleSystem * >particleSystems;
|
||||
particleSystems.push_back (rps);
|
||||
renderer.cleanupParticleSystems (particleSystems, rsMenu);
|
||||
}
|
||||
|
||||
cleanup();
|
||||
}
|
||||
rps = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuBackground::cleanup() {
|
||||
//printf("In MenuBackground::cleanup() rps = %p\n",rps);
|
||||
void
|
||||
MenuBackground::createRainParticleSystem ()
|
||||
{
|
||||
//printf("In MenuBackground::createRainParticleSystem() rps = %p\n",rps);
|
||||
|
||||
if(rps != NULL) {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
if(renderer.validateParticleSystemStillExists(rps,rsMenu) == true) {
|
||||
rps->fade();
|
||||
vector<ParticleSystem *> particleSystems;
|
||||
particleSystems.push_back(rps);
|
||||
renderer.cleanupParticleSystems(particleSystems, rsMenu);
|
||||
}
|
||||
if (rps == NULL)
|
||||
{
|
||||
rps = new RainParticleSystem ();
|
||||
rps->setSpeed (12.f / GameConstants::updateFps);
|
||||
rps->setEmissionRate (25);
|
||||
rps->setWind (-90.f, 4.f / GameConstants::updateFps);
|
||||
rps->setPos (Vec3f (0.f, 25.f, 0.f));
|
||||
rps->setColor (Vec4f (1.f, 1.f, 1.f, 0.2f));
|
||||
rps->setRadius (30.f);
|
||||
|
||||
rps = NULL;
|
||||
}
|
||||
}
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
renderer.manageParticleSystem (rps, rsMenu);
|
||||
|
||||
void MenuBackground::createRainParticleSystem() {
|
||||
//printf("In MenuBackground::createRainParticleSystem() rps = %p\n",rps);
|
||||
for (int i = 0; i < raindropCount; ++i)
|
||||
{
|
||||
raindropStates[i] = random.randRange (0.f, 1.f);
|
||||
raindropPos[i] = computeRaindropPos ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(rps == NULL) {
|
||||
rps= new RainParticleSystem();
|
||||
rps->setSpeed(12.f/GameConstants::updateFps);
|
||||
rps->setEmissionRate(25);
|
||||
rps->setWind(-90.f, 4.f/GameConstants::updateFps);
|
||||
rps->setPos(Vec3f(0.f, 25.f, 0.f));
|
||||
rps->setColor(Vec4f(1.f, 1.f, 1.f, 0.2f));
|
||||
rps->setRadius(30.f);
|
||||
void
|
||||
MenuBackground::setTargetCamera (const Camera * targetCamera)
|
||||
{
|
||||
this->targetCamera = targetCamera;
|
||||
this->lastCamera = camera;
|
||||
t = 0.f;
|
||||
}
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
renderer.manageParticleSystem(rps, rsMenu);
|
||||
void
|
||||
MenuBackground::update ()
|
||||
{
|
||||
//rain drops
|
||||
bool
|
||||
withRainEffect =
|
||||
Config::getInstance ().getBool ("RainEffectMenu", "true");
|
||||
if (withRainEffect == true)
|
||||
{
|
||||
if (rain == false)
|
||||
{
|
||||
rain = true;
|
||||
createRainParticleSystem ();
|
||||
}
|
||||
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]= random.randRange(0.f, 1.f);
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < raindropCount; ++i)
|
||||
{
|
||||
raindropStates[i] += 1.f / GameConstants::updateFps;
|
||||
if (raindropStates[i] >= 1.f)
|
||||
{
|
||||
raindropStates[i] = 0.f;
|
||||
raindropPos[i] = computeRaindropPos ();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rain == true)
|
||||
{
|
||||
rain = false;
|
||||
|
||||
void MenuBackground::setTargetCamera(const Camera *targetCamera){
|
||||
this->targetCamera= targetCamera;
|
||||
this->lastCamera= camera;
|
||||
t= 0.f;
|
||||
}
|
||||
cleanup ();
|
||||
}
|
||||
|
||||
void MenuBackground::update() {
|
||||
//rain drops
|
||||
bool withRainEffect = Config::getInstance().getBool("RainEffectMenu","true");
|
||||
if(withRainEffect == true) {
|
||||
if(rain == false) {
|
||||
rain = true;
|
||||
createRainParticleSystem();
|
||||
}
|
||||
if (targetCamera != NULL)
|
||||
{
|
||||
t +=
|
||||
((0.01f +
|
||||
(1.f - t) / 10.f) / 20.f) * (60.f / GameConstants::updateFps);
|
||||
|
||||
for(int i=0; i<raindropCount; ++i){
|
||||
raindropStates[i]+= 1.f / GameConstants::updateFps;
|
||||
if(raindropStates[i]>=1.f){
|
||||
raindropStates[i]= 0.f;
|
||||
raindropPos[i]= computeRaindropPos();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(rain == true) {
|
||||
rain = false;
|
||||
//interpolate position
|
||||
camera.setPosition (lastCamera.getPosition ().
|
||||
lerp (t, targetCamera->getPosition ()));
|
||||
|
||||
cleanup();
|
||||
}
|
||||
//interpolate orientation
|
||||
Quaternion
|
||||
q =
|
||||
lastCamera.getOrientation ().lerp (t,
|
||||
targetCamera->getOrientation ());
|
||||
camera.setOrientation (q);
|
||||
|
||||
if(targetCamera!=NULL){
|
||||
t+= ((0.01f+(1.f-t)/10.f)/20.f)*(60.f/GameConstants::updateFps);
|
||||
if (t >= 1.f)
|
||||
{
|
||||
targetCamera = NULL;
|
||||
t = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
//interpolate position
|
||||
camera.setPosition(lastCamera.getPosition().lerp(t, targetCamera->getPosition()));
|
||||
//fade
|
||||
if (fade <= 1.f)
|
||||
{
|
||||
fade += 0.6f / GameConstants::updateFps;
|
||||
if (fade > 1.f)
|
||||
{
|
||||
fade = 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
//interpolate orientation
|
||||
Quaternion q= lastCamera.getOrientation().lerp(t, targetCamera->getOrientation());
|
||||
camera.setOrientation(q);
|
||||
//animation
|
||||
anim +=
|
||||
(0.6f / GameConstants::updateFps) / 5 + random.randRange (0.f,
|
||||
(0.6f /
|
||||
GameConstants::
|
||||
updateFps)
|
||||
/ 5.f);
|
||||
if (anim > 1.f)
|
||||
{
|
||||
anim = 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
if(t>=1.f){
|
||||
targetCamera= NULL;
|
||||
t= 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
//fade
|
||||
if(fade<=1.f){
|
||||
fade+= 0.6f/GameConstants::updateFps;
|
||||
if(fade>1.f){
|
||||
fade= 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
//animation
|
||||
anim+=(0.6f/GameConstants::updateFps)/5+random.randRange(0.f, (0.6f/GameConstants::updateFps)/5.f);
|
||||
if(anim>1.f){
|
||||
anim= 0.f;
|
||||
}
|
||||
}
|
||||
|
||||
Vec2f MenuBackground::computeRaindropPos() {
|
||||
float f= static_cast<float>(meshSize);
|
||||
return Vec2f(random.randRange(-f, f), random.randRange(-f, f));
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
Vec2f
|
||||
MenuBackground::computeRaindropPos ()
|
||||
{
|
||||
float
|
||||
f = static_cast < float >(meshSize);
|
||||
return Vec2f (random.randRange (-f, f), random.randRange (-f, f));
|
||||
}
|
||||
|
||||
}
|
||||
} //end namespace
|
||||
|
@ -1,117 +1,240 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUBACKGROUND_H_
|
||||
#define _GLEST_GAME_MENUBACKGROUND_H_
|
||||
# define _GLEST_GAME_MENUBACKGROUND_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "particle.h"
|
||||
#include "camera.h"
|
||||
#include "vec.h"
|
||||
#include "texture.h"
|
||||
#include "model.h"
|
||||
#include "randomgen.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "particle.h"
|
||||
# include "camera.h"
|
||||
# include "vec.h"
|
||||
# include "texture.h"
|
||||
# include "model.h"
|
||||
# include "randomgen.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
using Shared::Graphics::RainParticleSystem;
|
||||
using Shared::Graphics::FireParticleSystem;
|
||||
using Shared::Graphics::Camera;
|
||||
using Shared::Graphics::Vec3f;
|
||||
using Shared::Graphics::Vec2f;
|
||||
using Shared::Graphics::Texture2D;
|
||||
using Shared::Graphics::Model;
|
||||
using Shared::Util::RandomGen;
|
||||
using
|
||||
Shared::Graphics::RainParticleSystem;
|
||||
using
|
||||
Shared::Graphics::FireParticleSystem;
|
||||
using
|
||||
Shared::Graphics::Camera;
|
||||
using
|
||||
Shared::Graphics::Vec3f;
|
||||
using
|
||||
Shared::Graphics::Vec2f;
|
||||
using
|
||||
Shared::Graphics::Texture2D;
|
||||
using
|
||||
Shared::Graphics::Model;
|
||||
using
|
||||
Shared::Util::RandomGen;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace
|
||||
Glest
|
||||
{
|
||||
namespace
|
||||
Game
|
||||
{
|
||||
|
||||
// ===========================================================
|
||||
// class MenuBackground
|
||||
// class MenuBackground
|
||||
//
|
||||
/// Holds the data to display the 3D environment
|
||||
/// Holds the data to display the 3D environment
|
||||
/// in the MenuState
|
||||
// ===========================================================
|
||||
|
||||
class MenuBackground{
|
||||
public:
|
||||
static const int meshSize= 32;
|
||||
static const int raindropCount= 1000;
|
||||
static const int characterCount= 5;
|
||||
class
|
||||
MenuBackground
|
||||
{
|
||||
public:
|
||||
static const int
|
||||
meshSize = 32;
|
||||
static const int
|
||||
raindropCount = 1000;
|
||||
static const int
|
||||
characterCount = 5;
|
||||
|
||||
private:
|
||||
Model *mainModel;
|
||||
|
||||
//water
|
||||
bool water;
|
||||
float waterHeight;
|
||||
Texture2D *waterTexture;
|
||||
|
||||
//fog
|
||||
bool fog;
|
||||
float fogDensity;
|
||||
|
||||
//rain
|
||||
bool rain;
|
||||
Vec2f raindropPos[raindropCount];
|
||||
float raindropStates[raindropCount];
|
||||
private:
|
||||
Model *
|
||||
mainModel;
|
||||
|
||||
//camera
|
||||
Camera camera;
|
||||
Camera lastCamera;
|
||||
const Camera *targetCamera;
|
||||
float t;
|
||||
//water
|
||||
bool
|
||||
water;
|
||||
float
|
||||
waterHeight;
|
||||
Texture2D *
|
||||
waterTexture;
|
||||
|
||||
//misc
|
||||
RandomGen random;
|
||||
Model *characterModels[characterCount];
|
||||
float anim;
|
||||
float fade;
|
||||
Vec3f aboutPosition;
|
||||
//fog
|
||||
bool
|
||||
fog;
|
||||
float
|
||||
fogDensity;
|
||||
|
||||
RainParticleSystem *rps;
|
||||
//rain
|
||||
bool
|
||||
rain;
|
||||
Vec2f
|
||||
raindropPos[raindropCount];
|
||||
float
|
||||
raindropStates[raindropCount];
|
||||
|
||||
public:
|
||||
MenuBackground();
|
||||
~MenuBackground();
|
||||
//camera
|
||||
Camera
|
||||
camera;
|
||||
Camera
|
||||
lastCamera;
|
||||
const Camera *
|
||||
targetCamera;
|
||||
float
|
||||
t;
|
||||
|
||||
bool getWater() const {return water;}
|
||||
float getWaterHeight() const {return waterHeight;}
|
||||
bool getFog() const {return fog;}
|
||||
float getFogDensity() const {return fogDensity;}
|
||||
bool getRain() const {return rain;}
|
||||
Texture2D *getWaterTexture() const {return waterTexture;}
|
||||
const Camera *getCamera() const {return &camera;}
|
||||
const Model *getCharacterModel(int i) const {return characterModels[i];}
|
||||
Model *getCharacterModelPtr(int i) const {return characterModels[i];}
|
||||
const Model *getMainModel() const {return mainModel;}
|
||||
Model *getMainModelPtr() const {return mainModel;}
|
||||
float getFade() const {return fade;}
|
||||
Vec2f getRaindropPos(int i) const {return raindropPos[i];}
|
||||
float getRaindropState(int i) const {return raindropStates[i];}
|
||||
float getAnim() const {return anim;}
|
||||
const Vec3f &getAboutPosition() const {return aboutPosition;}
|
||||
|
||||
void setTargetCamera(const Camera *targetCamera);
|
||||
void update();
|
||||
//misc
|
||||
RandomGen
|
||||
random;
|
||||
Model *
|
||||
characterModels[characterCount];
|
||||
float
|
||||
anim;
|
||||
float
|
||||
fade;
|
||||
Vec3f
|
||||
aboutPosition;
|
||||
|
||||
private:
|
||||
Vec2f computeRaindropPos();
|
||||
void createRainParticleSystem();
|
||||
void cleanup();
|
||||
};
|
||||
RainParticleSystem *
|
||||
rps;
|
||||
|
||||
}} //end namespace
|
||||
public:
|
||||
MenuBackground ();
|
||||
~
|
||||
MenuBackground ();
|
||||
|
||||
bool
|
||||
getWater () const
|
||||
{
|
||||
return
|
||||
water;
|
||||
}
|
||||
float
|
||||
getWaterHeight () const
|
||||
{
|
||||
return
|
||||
waterHeight;
|
||||
}
|
||||
bool
|
||||
getFog () const
|
||||
{
|
||||
return
|
||||
fog;
|
||||
}
|
||||
float
|
||||
getFogDensity () const
|
||||
{
|
||||
return
|
||||
fogDensity;
|
||||
}
|
||||
bool
|
||||
getRain () const
|
||||
{
|
||||
return
|
||||
rain;
|
||||
}
|
||||
Texture2D *
|
||||
getWaterTexture () const
|
||||
{
|
||||
return
|
||||
waterTexture;
|
||||
}
|
||||
const Camera *
|
||||
getCamera () const
|
||||
{
|
||||
return &
|
||||
camera;
|
||||
}
|
||||
const Model *
|
||||
getCharacterModel (int i) const
|
||||
{
|
||||
return
|
||||
characterModels[i];
|
||||
}
|
||||
Model *
|
||||
getCharacterModelPtr (int i) const
|
||||
{
|
||||
return
|
||||
characterModels[i];
|
||||
}
|
||||
const Model *
|
||||
getMainModel () const
|
||||
{
|
||||
return
|
||||
mainModel;
|
||||
}
|
||||
Model *
|
||||
getMainModelPtr () const
|
||||
{
|
||||
return
|
||||
mainModel;
|
||||
}
|
||||
float
|
||||
getFade () const
|
||||
{
|
||||
return
|
||||
fade;
|
||||
}
|
||||
Vec2f
|
||||
getRaindropPos (int i) const
|
||||
{
|
||||
return
|
||||
raindropPos[i];
|
||||
}
|
||||
float
|
||||
getRaindropState (int i) const
|
||||
{
|
||||
return
|
||||
raindropStates[i];
|
||||
}
|
||||
float
|
||||
getAnim () const
|
||||
{
|
||||
return
|
||||
anim;
|
||||
}
|
||||
const
|
||||
Vec3f &
|
||||
getAboutPosition () const
|
||||
{
|
||||
return
|
||||
aboutPosition;
|
||||
}
|
||||
|
||||
void
|
||||
setTargetCamera (const Camera * targetCamera);
|
||||
void
|
||||
update ();
|
||||
|
||||
private:
|
||||
Vec2f
|
||||
computeRaindropPos ();
|
||||
void
|
||||
createRainParticleSystem ();
|
||||
void
|
||||
cleanup ();
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 MartiC1o Figueroa
|
||||
// Copyright (C) 2001-2005 MartiC1o Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_state_about.h"
|
||||
@ -25,287 +25,398 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace Glest {
|
||||
namespace Game {
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// =====================================================
|
||||
// class MenuStateAbout
|
||||
// class MenuStateAbout
|
||||
// =====================================================
|
||||
|
||||
MenuStateAbout::MenuStateAbout(Program *program, MainMenu *mainMenu) :
|
||||
MenuState(program, mainMenu, "about") {
|
||||
MenuStateAbout::MenuStateAbout (Program * program,
|
||||
MainMenu * mainMenu):MenuState (program,
|
||||
mainMenu,
|
||||
"about")
|
||||
{
|
||||
|
||||
containerName= "About";
|
||||
Lang &lang= Lang::getInstance();
|
||||
containerName = "About";
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
adjustModelText = true;
|
||||
adjustModelText = true;
|
||||
|
||||
customModTextureX = 0;
|
||||
customModTextureY = 0;
|
||||
customModTextureW = 0;
|
||||
customModTextureH = 0;
|
||||
customModTextureAlpha = 0.f;
|
||||
customModTextureX = 0;
|
||||
customModTextureY = 0;
|
||||
customModTextureW = 0;
|
||||
customModTextureH = 0;
|
||||
customModTextureAlpha = 0.f;
|
||||
|
||||
string additionalCredits= loadAdditionalCredits();
|
||||
string additionalCredits = loadAdditionalCredits ();
|
||||
|
||||
//init
|
||||
buttonReturn.registerGraphicComponent(containerName, "buttonReturn");
|
||||
buttonReturn.init(438, 100, 125);
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
//init
|
||||
buttonReturn.registerGraphicComponent (containerName, "buttonReturn");
|
||||
buttonReturn.init (438, 100, 125);
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
labelAdditionalCredits.registerGraphicComponent(containerName, "labelAdditionalCredits");
|
||||
labelAdditionalCredits.init(500, 700);
|
||||
labelAdditionalCredits.setText(additionalCredits);
|
||||
labelAdditionalCredits.registerGraphicComponent (containerName,
|
||||
"labelAdditionalCredits");
|
||||
labelAdditionalCredits.init (500, 700);
|
||||
labelAdditionalCredits.setText (additionalCredits);
|
||||
|
||||
if(additionalCredits == "") {
|
||||
for(int i= 0; i < aboutStringCount1; ++i) {
|
||||
labelAbout1[i].registerGraphicComponent(containerName, "labelAbout1" + intToStr(i));
|
||||
labelAbout1[i].init(100, 700 - i * 20);
|
||||
labelAbout1[i].setText(getAboutString1(i));
|
||||
}
|
||||
if (additionalCredits == "")
|
||||
{
|
||||
for (int i = 0; i < aboutStringCount1; ++i)
|
||||
{
|
||||
labelAbout1[i].registerGraphicComponent (containerName,
|
||||
"labelAbout1" +
|
||||
intToStr (i));
|
||||
labelAbout1[i].init (100, 700 - i * 20);
|
||||
labelAbout1[i].setText (getAboutString1 (i));
|
||||
}
|
||||
|
||||
for(int i= 0; i < aboutStringCount2; ++i) {
|
||||
labelAbout2[i].registerGraphicComponent(containerName, "labelAbout2" + intToStr(i));
|
||||
labelAbout2[i].init(450, 620 - i * 20);
|
||||
labelAbout2[i].setText(getAboutString2(i));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for(int i= 0; i < aboutStringCount1; ++i) {
|
||||
labelAbout1[i].registerGraphicComponent(containerName, "labelAbout1" + intToStr(i));
|
||||
labelAbout1[i].init(100, 700 - i * 20);
|
||||
labelAbout1[i].setText(getAboutString1(i));
|
||||
}
|
||||
for (int i = 0; i < aboutStringCount2; ++i)
|
||||
{
|
||||
labelAbout2[i].registerGraphicComponent (containerName,
|
||||
"labelAbout2" +
|
||||
intToStr (i));
|
||||
labelAbout2[i].init (450, 620 - i * 20);
|
||||
labelAbout2[i].setText (getAboutString2 (i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < aboutStringCount1; ++i)
|
||||
{
|
||||
labelAbout1[i].registerGraphicComponent (containerName,
|
||||
"labelAbout1" +
|
||||
intToStr (i));
|
||||
labelAbout1[i].init (100, 700 - i * 20);
|
||||
labelAbout1[i].setText (getAboutString1 (i));
|
||||
}
|
||||
|
||||
for(int i= 0; i < aboutStringCount2; ++i) {
|
||||
labelAbout2[i].registerGraphicComponent(containerName, "labelAbout2" + intToStr(i));
|
||||
labelAbout2[i].init(100, 620 - i * 20);
|
||||
labelAbout2[i].setText(getAboutString2(i));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < aboutStringCount2; ++i)
|
||||
{
|
||||
labelAbout2[i].registerGraphicComponent (containerName,
|
||||
"labelAbout2" +
|
||||
intToStr (i));
|
||||
labelAbout2[i].init (100, 620 - i * 20);
|
||||
labelAbout2[i].setText (getAboutString2 (i));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i= 0; i < teammateCount; ++i) {
|
||||
int xPos = (182 + i * 138);
|
||||
labelTeammateName[i].registerGraphicComponent(containerName, "labelTeammateName" + intToStr(i));
|
||||
labelTeammateName[i].init(xPos, 500);
|
||||
labelTeammateRole[i].registerGraphicComponent(containerName, "labelTeammateRole" + intToStr(i));
|
||||
labelTeammateRole[i].init(xPos, 520);
|
||||
for (int i = 0; i < teammateCount; ++i)
|
||||
{
|
||||
int xPos = (182 + i * 138);
|
||||
labelTeammateName[i].registerGraphicComponent (containerName,
|
||||
"labelTeammateName" +
|
||||
intToStr (i));
|
||||
labelTeammateName[i].init (xPos, 500);
|
||||
labelTeammateRole[i].registerGraphicComponent (containerName,
|
||||
"labelTeammateRole" +
|
||||
intToStr (i));
|
||||
labelTeammateRole[i].init (xPos, 520);
|
||||
|
||||
labelTeammateName[i].setText(getTeammateName(i));
|
||||
labelTeammateRole[i].setText(getTeammateRole(i));
|
||||
}
|
||||
labelTeammateName[i].setText (getTeammateName (i));
|
||||
labelTeammateRole[i].setText (getTeammateRole (i));
|
||||
}
|
||||
|
||||
for(int i = teammateTopLineCount; i < teammateCount; ++i) {
|
||||
labelTeammateName[i].init(202 + (i-5) * 138, 160);
|
||||
labelTeammateRole[i].init(202 + (i-5) * 138, 180);
|
||||
}
|
||||
labelTeammateName[8].init(labelTeammateName[4].getX(), 160);
|
||||
labelTeammateRole[8].init(labelTeammateRole[4].getX(), 180);
|
||||
for (int i = teammateTopLineCount; i < teammateCount; ++i)
|
||||
{
|
||||
labelTeammateName[i].init (202 + (i - 5) * 138, 160);
|
||||
labelTeammateRole[i].init (202 + (i - 5) * 138, 180);
|
||||
}
|
||||
labelTeammateName[8].init (labelTeammateName[4].getX (), 160);
|
||||
labelTeammateRole[8].init (labelTeammateRole[4].getX (), 180);
|
||||
|
||||
customModTexture = NULL;
|
||||
labelCustomModCredits.registerGraphicComponent(containerName, "labelCustomModCredits");
|
||||
labelCustomModCredits.init(-1, -1);
|
||||
labelCustomModCredits.setText("");
|
||||
labelCustomModCredits.setVisible(false);
|
||||
customModTexture = NULL;
|
||||
labelCustomModCredits.registerGraphicComponent (containerName,
|
||||
"labelCustomModCredits");
|
||||
labelCustomModCredits.init (-1, -1);
|
||||
labelCustomModCredits.setText ("");
|
||||
labelCustomModCredits.setVisible (false);
|
||||
|
||||
enableCustomModCredits = Config::getInstance().getBool("EnabledCustomModCredits","false");
|
||||
if(enableCustomModCredits == true) {
|
||||
string customModCreditsText = Config::getInstance().getString("CustomModCreditsText","");
|
||||
if(customModCreditsText != "") {
|
||||
replaceAll(customModCreditsText, "\\n", "\n");
|
||||
int x = Config::getInstance().getInt("CustomModCreditsTextX","1");
|
||||
int y = Config::getInstance().getInt("CustomModCreditsTextY","1");
|
||||
int w = Config::getInstance().getInt("CustomModCreditsTextW",intToStr(GraphicLabel::defW).c_str());
|
||||
int h = Config::getInstance().getInt("CustomModCreditsTextH",intToStr(GraphicLabel::defH).c_str());
|
||||
enableCustomModCredits =
|
||||
Config::getInstance ().getBool ("EnabledCustomModCredits", "false");
|
||||
if (enableCustomModCredits == true)
|
||||
{
|
||||
string customModCreditsText =
|
||||
Config::getInstance ().getString ("CustomModCreditsText", "");
|
||||
if (customModCreditsText != "")
|
||||
{
|
||||
replaceAll (customModCreditsText, "\\n", "\n");
|
||||
int x =
|
||||
Config::getInstance ().getInt ("CustomModCreditsTextX", "1");
|
||||
int y =
|
||||
Config::getInstance ().getInt ("CustomModCreditsTextY", "1");
|
||||
int w =
|
||||
Config::getInstance ().getInt ("CustomModCreditsTextW",
|
||||
intToStr (GraphicLabel::defW).
|
||||
c_str ());
|
||||
int h =
|
||||
Config::getInstance ().getInt ("CustomModCreditsTextH",
|
||||
intToStr (GraphicLabel::defH).
|
||||
c_str ());
|
||||
|
||||
labelCustomModCredits.init(x, y, w, h);
|
||||
labelCustomModCredits.setText(customModCreditsText);
|
||||
labelCustomModCredits.setVisible(true);
|
||||
}
|
||||
labelCustomModCredits.init (x, y, w, h);
|
||||
labelCustomModCredits.setText (customModCreditsText);
|
||||
labelCustomModCredits.setVisible (true);
|
||||
}
|
||||
|
||||
int buttonReturnX = Config::getInstance().getInt("CustomModCreditsReturnX",intToStr(buttonReturn.getX()).c_str());
|
||||
int buttonReturnY = Config::getInstance().getInt("CustomModCreditsReturnY",intToStr(buttonReturn.getY()).c_str());
|
||||
int buttonReturnW = Config::getInstance().getInt("CustomModCreditsReturnW",intToStr(buttonReturn.getW()).c_str());
|
||||
int buttonReturnX =
|
||||
Config::getInstance ().getInt ("CustomModCreditsReturnX",
|
||||
intToStr (buttonReturn.getX ()).
|
||||
c_str ());
|
||||
int buttonReturnY =
|
||||
Config::getInstance ().getInt ("CustomModCreditsReturnY",
|
||||
intToStr (buttonReturn.getY ()).
|
||||
c_str ());
|
||||
int buttonReturnW =
|
||||
Config::getInstance ().getInt ("CustomModCreditsReturnW",
|
||||
intToStr (buttonReturn.getW ()).
|
||||
c_str ());
|
||||
|
||||
buttonReturn.init(buttonReturnX, buttonReturnY, buttonReturnW);
|
||||
}
|
||||
buttonReturn.init (buttonReturnX, buttonReturnY, buttonReturnW);
|
||||
}
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
}
|
||||
GraphicComponent::applyAllCustomProperties (containerName);
|
||||
}
|
||||
|
||||
MenuStateAbout::~MenuStateAbout() {
|
||||
if(customModTexture != NULL) {
|
||||
Renderer::getInstance().endTexture(rsGlobal, customModTexture, false);
|
||||
customModTexture = NULL;
|
||||
}
|
||||
}
|
||||
MenuStateAbout::~MenuStateAbout ()
|
||||
{
|
||||
if (customModTexture != NULL)
|
||||
{
|
||||
Renderer::getInstance ().endTexture (rsGlobal, customModTexture,
|
||||
false);
|
||||
customModTexture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateAbout::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
void MenuStateAbout::reloadUI ()
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
adjustModelText = true;
|
||||
string additionalCredits= loadAdditionalCredits();
|
||||
adjustModelText = true;
|
||||
string additionalCredits = loadAdditionalCredits ();
|
||||
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
labelAdditionalCredits.setText(additionalCredits);
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
labelAdditionalCredits.setText (additionalCredits);
|
||||
|
||||
//if(additionalCredits == "") {
|
||||
for(int i= 0; i < aboutStringCount1; ++i){
|
||||
labelAbout1[i].setText(getAboutString1(i));
|
||||
}
|
||||
//if(additionalCredits == "") {
|
||||
for (int i = 0; i < aboutStringCount1; ++i)
|
||||
{
|
||||
labelAbout1[i].setText (getAboutString1 (i));
|
||||
}
|
||||
|
||||
for(int i= 0; i < aboutStringCount2; ++i){
|
||||
labelAbout2[i].setText(getAboutString2(i));
|
||||
}
|
||||
//}
|
||||
//else {
|
||||
// for(int i= 0; i < aboutStringCount1; ++i){
|
||||
// labelAbout1[i].setText(getAboutString1(i));
|
||||
// }
|
||||
for (int i = 0; i < aboutStringCount2; ++i)
|
||||
{
|
||||
labelAbout2[i].setText (getAboutString2 (i));
|
||||
}
|
||||
//}
|
||||
//else {
|
||||
// for(int i= 0; i < aboutStringCount1; ++i){
|
||||
// labelAbout1[i].setText(getAboutString1(i));
|
||||
// }
|
||||
|
||||
// for(int i= 0; i < aboutStringCount2; ++i){
|
||||
// labelAbout2[i].setText(getAboutString2(i));
|
||||
// }
|
||||
//}
|
||||
// for(int i= 0; i < aboutStringCount2; ++i){
|
||||
// labelAbout2[i].setText(getAboutString2(i));
|
||||
// }
|
||||
//}
|
||||
|
||||
for(int i= 0; i < teammateCount; ++i) {
|
||||
labelTeammateName[i].setText(getTeammateName(i));
|
||||
labelTeammateRole[i].setText(getTeammateRole(i));
|
||||
}
|
||||
for (int i = 0; i < teammateCount; ++i)
|
||||
{
|
||||
labelTeammateName[i].setText (getTeammateName (i));
|
||||
labelTeammateRole[i].setText (getTeammateRole (i));
|
||||
}
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
GraphicComponent::
|
||||
reloadFontsForRegisterGraphicComponents (containerName);
|
||||
}
|
||||
|
||||
string MenuStateAbout::loadAdditionalCredits(){
|
||||
string data_path= getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||
if(data_path != ""){
|
||||
endPathWithSlash(data_path);
|
||||
}
|
||||
string result= "";
|
||||
const string dir= getGameCustomCoreDataPath(data_path,"data/core/menu/credits.txt");
|
||||
//printf("dir [%s]\n",dir.c_str());
|
||||
string MenuStateAbout::loadAdditionalCredits ()
|
||||
{
|
||||
string data_path =
|
||||
getGameReadWritePath (GameConstants::path_data_CacheLookupKey);
|
||||
if (data_path != "")
|
||||
{
|
||||
endPathWithSlash (data_path);
|
||||
}
|
||||
string result = "";
|
||||
const string dir =
|
||||
getGameCustomCoreDataPath (data_path, "data/core/menu/credits.txt");
|
||||
//printf("dir [%s]\n",dir.c_str());
|
||||
|
||||
if(fileExists(dir) == true) {
|
||||
if (fileExists (dir) == true)
|
||||
{
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
FILE *fp = _wfopen(utf8_decode(dir).c_str(), L"r");
|
||||
ifstream file(fp);
|
||||
FILE *fp = _wfopen (utf8_decode (dir).c_str (), L"r");
|
||||
ifstream file (fp);
|
||||
#else
|
||||
ifstream file(dir.c_str());
|
||||
ifstream file (dir.c_str ());
|
||||
#endif
|
||||
std::string buffer;
|
||||
while(!file.eof()){
|
||||
getline(file, buffer);
|
||||
result+= buffer + "\n";
|
||||
}
|
||||
std::cout << buffer << std::endl;
|
||||
file.close();
|
||||
std::string buffer;
|
||||
while (!file.eof ())
|
||||
{
|
||||
getline (file, buffer);
|
||||
result += buffer + "\n";
|
||||
}
|
||||
std::cout << buffer << std::endl;
|
||||
file.close ();
|
||||
#if defined(WIN32) && !defined(__MINGW32__)
|
||||
if(fp) fclose(fp);
|
||||
if (fp)
|
||||
fclose (fp);
|
||||
#endif
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void MenuStateAbout::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
void MenuStateAbout::mouseClick (int x, int y, MouseButton mouseButton)
|
||||
{
|
||||
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
CoreData & coreData = CoreData::getInstance ();
|
||||
SoundRenderer & soundRenderer = SoundRenderer::getInstance ();
|
||||
|
||||
if(buttonReturn.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
||||
}
|
||||
if (buttonReturn.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
mainMenu->setState (new MenuStateRoot (program, mainMenu));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateAbout::mouseMove(int x, int y, const MouseState *ms){
|
||||
buttonReturn.mouseMove(x, y);
|
||||
}
|
||||
void MenuStateAbout::mouseMove (int x, int y, const MouseState * ms)
|
||||
{
|
||||
buttonReturn.mouseMove (x, y);
|
||||
}
|
||||
|
||||
void MenuStateAbout::render() {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
void MenuStateAbout::render ()
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
if(enableCustomModCredits == true) {
|
||||
if(customModTexture == NULL) {
|
||||
string customModCreditsTextureFile = Config::getInstance().getString("CustomModCreditsTextureFile","");
|
||||
if(customModCreditsTextureFile != "") {
|
||||
string data_path= getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||
if(data_path != ""){
|
||||
endPathWithSlash(data_path);
|
||||
}
|
||||
customModTexture = Renderer::findTexture(data_path + customModCreditsTextureFile);
|
||||
}
|
||||
}
|
||||
if (enableCustomModCredits == true)
|
||||
{
|
||||
if (customModTexture == NULL)
|
||||
{
|
||||
string customModCreditsTextureFile =
|
||||
Config::getInstance ().getString ("CustomModCreditsTextureFile",
|
||||
"");
|
||||
if (customModCreditsTextureFile != "")
|
||||
{
|
||||
string data_path =
|
||||
getGameReadWritePath (GameConstants::path_data_CacheLookupKey);
|
||||
if (data_path != "")
|
||||
{
|
||||
endPathWithSlash (data_path);
|
||||
}
|
||||
customModTexture =
|
||||
Renderer::findTexture (data_path + customModCreditsTextureFile);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderBackground(customModTexture);
|
||||
renderer.renderLabel(&labelCustomModCredits);
|
||||
}
|
||||
else {
|
||||
renderer.renderLabel(&labelAdditionalCredits);
|
||||
renderer.renderBackground (customModTexture);
|
||||
renderer.renderLabel (&labelCustomModCredits);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.renderLabel (&labelAdditionalCredits);
|
||||
|
||||
for(int i= 0; i < aboutStringCount1; ++i) {
|
||||
renderer.renderLabel(&labelAbout1[i]);
|
||||
}
|
||||
for(int i= 0; i < aboutStringCount2; ++i) {
|
||||
renderer.renderLabel(&labelAbout2[i]);
|
||||
}
|
||||
for (int i = 0; i < aboutStringCount1; ++i)
|
||||
{
|
||||
renderer.renderLabel (&labelAbout1[i]);
|
||||
}
|
||||
for (int i = 0; i < aboutStringCount2; ++i)
|
||||
{
|
||||
renderer.renderLabel (&labelAbout2[i]);
|
||||
}
|
||||
|
||||
if(adjustModelText == true) {
|
||||
std::vector<Vec3f> &characterMenuScreenPositionListCache =
|
||||
CacheManager::getCachedItem< std::vector<Vec3f> >(GameConstants::characterMenuScreenPositionListCacheLookupKey);
|
||||
if (adjustModelText == true)
|
||||
{
|
||||
std::vector < Vec3f > &characterMenuScreenPositionListCache =
|
||||
CacheManager::getCachedItem < std::vector < Vec3f >
|
||||
>(GameConstants::characterMenuScreenPositionListCacheLookupKey);
|
||||
|
||||
for(int i= 0; i < teammateCount; ++i) {
|
||||
int characterPos = (i % teammateTopLineCount);
|
||||
if(characterPos < (int)characterMenuScreenPositionListCache.size()) {
|
||||
adjustModelText = false;
|
||||
for (int i = 0; i < teammateCount; ++i)
|
||||
{
|
||||
int characterPos = (i % teammateTopLineCount);
|
||||
if (characterPos <
|
||||
(int) characterMenuScreenPositionListCache.size ())
|
||||
{
|
||||
adjustModelText = false;
|
||||
|
||||
int xPos = characterMenuScreenPositionListCache[characterPos].x;
|
||||
if(i == 7 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) {
|
||||
xPos += ((characterMenuScreenPositionListCache[characterPos+1].x - characterMenuScreenPositionListCache[characterPos].x) / 2);
|
||||
}
|
||||
else if(i == 8 && characterPos+1 < (int)characterMenuScreenPositionListCache.size()) {
|
||||
xPos = characterMenuScreenPositionListCache[characterPos+1].x;
|
||||
}
|
||||
int xPos = characterMenuScreenPositionListCache[characterPos].x;
|
||||
if (i == 7
|
||||
&& characterPos + 1 <
|
||||
(int) characterMenuScreenPositionListCache.size ())
|
||||
{
|
||||
xPos +=
|
||||
((characterMenuScreenPositionListCache[characterPos + 1].x -
|
||||
characterMenuScreenPositionListCache[characterPos].x) /
|
||||
2);
|
||||
}
|
||||
else if (i == 8
|
||||
&& characterPos + 1 <
|
||||
(int) characterMenuScreenPositionListCache.size ())
|
||||
{
|
||||
xPos =
|
||||
characterMenuScreenPositionListCache[characterPos + 1].x;
|
||||
}
|
||||
|
||||
FontMetrics *fontMetrics= NULL;
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
fontMetrics= labelTeammateName[i].getFont()->getMetrics();
|
||||
}
|
||||
else {
|
||||
fontMetrics= labelTeammateName[i].getFont3D()->getMetrics();
|
||||
}
|
||||
int newxPos = xPos - (fontMetrics->getTextWidth(labelTeammateName[i].getText()) / 2);
|
||||
if(newxPos != labelTeammateName[i].getX()) {
|
||||
labelTeammateName[i].init(newxPos, labelTeammateName[i].getY());
|
||||
}
|
||||
FontMetrics *fontMetrics = NULL;
|
||||
if (Renderer::renderText3DEnabled == false)
|
||||
{
|
||||
fontMetrics = labelTeammateName[i].getFont ()->getMetrics ();
|
||||
}
|
||||
else
|
||||
{
|
||||
fontMetrics =
|
||||
labelTeammateName[i].getFont3D ()->getMetrics ();
|
||||
}
|
||||
int newxPos =
|
||||
xPos -
|
||||
(fontMetrics->getTextWidth (labelTeammateName[i].getText ()) /
|
||||
2);
|
||||
if (newxPos != labelTeammateName[i].getX ())
|
||||
{
|
||||
labelTeammateName[i].init (newxPos,
|
||||
labelTeammateName[i].getY ());
|
||||
}
|
||||
|
||||
newxPos = xPos - (fontMetrics->getTextWidth(labelTeammateRole[i].getText()) / 2);
|
||||
if(newxPos != labelTeammateRole[i].getX()) {
|
||||
labelTeammateRole[i].init(newxPos, labelTeammateRole[i].getY());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
newxPos =
|
||||
xPos -
|
||||
(fontMetrics->getTextWidth (labelTeammateRole[i].getText ()) /
|
||||
2);
|
||||
if (newxPos != labelTeammateRole[i].getX ())
|
||||
{
|
||||
labelTeammateRole[i].init (newxPos,
|
||||
labelTeammateRole[i].getY ());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i= 0; i < teammateCount; ++i) {
|
||||
renderer.renderLabel(&labelTeammateName[i]);
|
||||
renderer.renderLabel(&labelTeammateRole[i]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < teammateCount; ++i)
|
||||
{
|
||||
renderer.renderLabel (&labelTeammateName[i]);
|
||||
renderer.renderLabel (&labelTeammateRole[i]);
|
||||
}
|
||||
}
|
||||
|
||||
renderer.renderButton(&buttonReturn);
|
||||
renderer.renderButton (&buttonReturn);
|
||||
|
||||
if(program != NULL)
|
||||
program->renderProgramMsgBox();
|
||||
if (program != NULL)
|
||||
program->renderProgramMsgBox ();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateAbout::keyDown(SDL_KeyboardEvent key){
|
||||
Config &configKeys= Config::getInstance(std::pair<ConfigType, ConfigType>(cfgMainKeys, cfgUserKeys));
|
||||
if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),key) == true) {
|
||||
GraphicComponent::saveAllCustomProperties(containerName);
|
||||
}
|
||||
}
|
||||
void MenuStateAbout::keyDown (SDL_KeyboardEvent key)
|
||||
{
|
||||
Config & configKeys =
|
||||
Config::getInstance (std::pair < ConfigType,
|
||||
ConfigType > (cfgMainKeys, cfgUserKeys));
|
||||
if (isKeyPressed (configKeys.getSDLKey ("SaveGUILayout"), key) == true)
|
||||
{
|
||||
GraphicComponent::saveAllCustomProperties (containerName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}//end namespace
|
||||
}
|
||||
} //end namespace
|
||||
|
@ -1,71 +1,75 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEABOUT_H_
|
||||
#define _GLEST_GAME_MENUSTATEABOUT_H_
|
||||
# define _GLEST_GAME_MENUSTATEABOUT_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateAbout
|
||||
// class MenuStateAbout
|
||||
// ===============================
|
||||
|
||||
class MenuStateAbout: public MenuState{
|
||||
public:
|
||||
static const int aboutStringCount1= 4;
|
||||
static const int aboutStringCount2= 3;
|
||||
static const int teammateCount= 9;
|
||||
static const int teammateTopLineCount= 5;
|
||||
class MenuStateAbout:public MenuState
|
||||
{
|
||||
public:
|
||||
static const int aboutStringCount1 = 4;
|
||||
static const int aboutStringCount2 = 3;
|
||||
static const int teammateCount = 9;
|
||||
static const int teammateTopLineCount = 5;
|
||||
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicLabel labelAdditionalCredits;
|
||||
GraphicLabel labelAbout1[aboutStringCount1];
|
||||
GraphicLabel labelAbout2[aboutStringCount2];
|
||||
GraphicLabel labelTeammateName[teammateCount];
|
||||
GraphicLabel labelTeammateRole[teammateCount];
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicLabel labelAdditionalCredits;
|
||||
GraphicLabel labelAbout1[aboutStringCount1];
|
||||
GraphicLabel labelAbout2[aboutStringCount2];
|
||||
GraphicLabel labelTeammateName[teammateCount];
|
||||
GraphicLabel labelTeammateRole[teammateCount];
|
||||
|
||||
bool adjustModelText;
|
||||
string loadAdditionalCredits();
|
||||
bool adjustModelText;
|
||||
string loadAdditionalCredits ();
|
||||
|
||||
bool enableCustomModCredits;
|
||||
Texture2D *customModTexture;
|
||||
int customModTextureX;
|
||||
int customModTextureY;
|
||||
int customModTextureW;
|
||||
int customModTextureH;
|
||||
float customModTextureAlpha;
|
||||
bool enableCustomModCredits;
|
||||
Texture2D *customModTexture;
|
||||
int customModTextureX;
|
||||
int customModTextureY;
|
||||
int customModTextureW;
|
||||
int customModTextureH;
|
||||
float customModTextureAlpha;
|
||||
|
||||
GraphicLabel labelCustomModCredits;
|
||||
GraphicLabel labelCustomModCredits;
|
||||
|
||||
public:
|
||||
MenuStateAbout(Program *program, MainMenu *mainMenu);
|
||||
virtual ~MenuStateAbout();
|
||||
public:
|
||||
MenuStateAbout (Program * program, MainMenu * mainMenu);
|
||||
virtual ~ MenuStateAbout ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
virtual void reloadUI();
|
||||
};
|
||||
virtual void reloadUI ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,329 +1,349 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATECONNECTEDGAME_H_
|
||||
#define _GLEST_GAME_MENUSTATECONNECTEDGAME_H_
|
||||
# define _GLEST_GAME_MENUSTATECONNECTEDGAME_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "chat_manager.h"
|
||||
#include "map_preview.h"
|
||||
#include "miniftpclient.h"
|
||||
#include "common_scoped_ptr.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "chat_manager.h"
|
||||
# include "map_preview.h"
|
||||
# include "miniftpclient.h"
|
||||
# include "common_scoped_ptr.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Shared { namespace Graphics {
|
||||
class VideoPlayer;
|
||||
namespace Shared
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
class VideoPlayer;
|
||||
}}
|
||||
|
||||
namespace Glest { namespace Game {
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
class TechTree;
|
||||
class TechTree;
|
||||
|
||||
enum JoinMenu {
|
||||
jmSimple,
|
||||
jmMasterserver,
|
||||
enum JoinMenu
|
||||
{
|
||||
jmSimple,
|
||||
jmMasterserver,
|
||||
|
||||
jmCount
|
||||
};
|
||||
jmCount
|
||||
};
|
||||
|
||||
enum FTPMessageType {
|
||||
ftpmsg_MissingNone,
|
||||
ftpmsg_MissingMap,
|
||||
ftpmsg_MissingTileset,
|
||||
ftpmsg_MissingTechtree
|
||||
};
|
||||
enum FTPMessageType
|
||||
{
|
||||
ftpmsg_MissingNone,
|
||||
ftpmsg_MissingMap,
|
||||
ftpmsg_MissingTileset,
|
||||
ftpmsg_MissingTechtree
|
||||
};
|
||||
|
||||
// ===============================
|
||||
// class MenuStateConnectedGame
|
||||
// class MenuStateConnectedGame
|
||||
// ===============================
|
||||
|
||||
class MenuStateConnectedGame: public MenuState, public FTPClientCallbackInterface, public SimpleTaskCallbackInterface {
|
||||
private:
|
||||
GraphicButton buttonDisconnect;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
GraphicLabel labelFogOfWar;
|
||||
GraphicLabel labelTechTree;
|
||||
GraphicLabel labelTileset;
|
||||
GraphicLabel labelMapInfo;
|
||||
GraphicLabel labelStatus;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicLabel labelWaitingForPlayers;
|
||||
GraphicButton buttonRestoreLastSettings;
|
||||
|
||||
//GraphicLabel labelPathFinderType;
|
||||
//GraphicListBox listBoxPathFinderType;
|
||||
|
||||
GraphicLabel labelMapPlayerCount;
|
||||
GraphicListBox listBoxMapPlayerCount;
|
||||
|
||||
GraphicLabel labelAdvanced;
|
||||
GraphicListBox listBoxAdvanced;
|
||||
|
||||
GraphicListBox listBoxMap;
|
||||
GraphicListBox listBoxFogOfWar;
|
||||
GraphicListBox listBoxTechTree;
|
||||
GraphicListBox listBoxTileset;
|
||||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
GraphicButton grabSlotButton[GameConstants::maxPlayers];
|
||||
|
||||
GraphicListBox listBoxPlayerStatus;
|
||||
GraphicLabel labelPlayerStatus[GameConstants::maxPlayers];
|
||||
|
||||
GraphicLabel labelMapFilter;
|
||||
GraphicListBox listBoxMapFilter;
|
||||
|
||||
GraphicLabel labelAllowObservers;
|
||||
GraphicCheckBox checkBoxAllowObservers;
|
||||
|
||||
GraphicLabel labelAllowNativeLanguageTechtree;
|
||||
GraphicCheckBox checkBoxAllowNativeLanguageTechtree;
|
||||
|
||||
GraphicLabel *activeInputLabel;
|
||||
|
||||
time_t timerLabelFlash;
|
||||
GraphicLabel labelDataSynchInfo;
|
||||
|
||||
MapInfo mapInfo;
|
||||
Texture2D *mapPreviewTexture;
|
||||
bool zoomedMap;
|
||||
int render_mapPreviewTexture_X;
|
||||
int render_mapPreviewTexture_Y;
|
||||
int render_mapPreviewTexture_W;
|
||||
int render_mapPreviewTexture_H;
|
||||
|
||||
bool needToSetChangedGameSettings;
|
||||
time_t lastSetChangedGameSettings;
|
||||
bool updateDataSynchDetailText;
|
||||
|
||||
int soundConnectionCount;
|
||||
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
|
||||
string currentFactionName;
|
||||
string currentMap;
|
||||
JoinMenu returnMenuInfo;
|
||||
bool settingsReceivedFromServer;
|
||||
time_t lastNetworkSendPing;
|
||||
int pingCount;
|
||||
bool initialSettingsReceivedFromServer;
|
||||
|
||||
string lastMapDataSynchError;
|
||||
string lastTileDataSynchError;
|
||||
string lastTechtreeDataSynchError;
|
||||
|
||||
int8 switchSetupRequestFlagType;
|
||||
string defaultPlayerName;
|
||||
|
||||
bool enableFactionTexturePreview;
|
||||
bool enableMapPreview;
|
||||
|
||||
string currentTechName_factionPreview;
|
||||
string currentFactionName_factionPreview;
|
||||
string currentFactionLogo;
|
||||
Texture2D *factionTexture;
|
||||
::Shared::Graphics::VideoPlayer *factionVideo;
|
||||
bool factionVideoSwitchedOffVolume;
|
||||
|
||||
MapPreview mapPreview;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
|
||||
std::string lastMissingMap;
|
||||
std::string lastMissingTechtree;
|
||||
std::string lastMissingTileSet;
|
||||
|
||||
vector<string> mapFiles;
|
||||
vector<string> techTreeFiles;
|
||||
vector<string> tilesetFiles;
|
||||
vector<string> factionFiles;
|
||||
class MenuStateConnectedGame:public MenuState,
|
||||
public FTPClientCallbackInterface, public SimpleTaskCallbackInterface
|
||||
{
|
||||
private:
|
||||
GraphicButton buttonDisconnect;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
GraphicLabel labelFogOfWar;
|
||||
GraphicLabel labelTechTree;
|
||||
GraphicLabel labelTileset;
|
||||
GraphicLabel labelMapInfo;
|
||||
GraphicLabel labelStatus;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicLabel labelWaitingForPlayers;
|
||||
GraphicButton buttonRestoreLastSettings;
|
||||
|
||||
//GraphicLabel labelPathFinderType;
|
||||
//GraphicListBox listBoxPathFinderType;
|
||||
|
||||
GraphicLabel labelMapPlayerCount;
|
||||
GraphicListBox listBoxMapPlayerCount;
|
||||
|
||||
GraphicLabel labelAdvanced;
|
||||
GraphicListBox listBoxAdvanced;
|
||||
|
||||
GraphicListBox listBoxMap;
|
||||
GraphicListBox listBoxFogOfWar;
|
||||
GraphicListBox listBoxTechTree;
|
||||
GraphicListBox listBoxTileset;
|
||||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
GraphicButton grabSlotButton[GameConstants::maxPlayers];
|
||||
|
||||
GraphicListBox listBoxPlayerStatus;
|
||||
GraphicLabel labelPlayerStatus[GameConstants::maxPlayers];
|
||||
|
||||
GraphicLabel labelMapFilter;
|
||||
GraphicListBox listBoxMapFilter;
|
||||
|
||||
GraphicLabel labelAllowObservers;
|
||||
GraphicCheckBox checkBoxAllowObservers;
|
||||
|
||||
GraphicLabel labelAllowNativeLanguageTechtree;
|
||||
GraphicCheckBox checkBoxAllowNativeLanguageTechtree;
|
||||
|
||||
GraphicLabel *activeInputLabel;
|
||||
|
||||
time_t timerLabelFlash;
|
||||
GraphicLabel labelDataSynchInfo;
|
||||
|
||||
MapInfo mapInfo;
|
||||
Texture2D *mapPreviewTexture;
|
||||
bool zoomedMap;
|
||||
int render_mapPreviewTexture_X;
|
||||
int render_mapPreviewTexture_Y;
|
||||
int render_mapPreviewTexture_W;
|
||||
int render_mapPreviewTexture_H;
|
||||
|
||||
bool needToSetChangedGameSettings;
|
||||
time_t lastSetChangedGameSettings;
|
||||
bool updateDataSynchDetailText;
|
||||
|
||||
int soundConnectionCount;
|
||||
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
|
||||
string currentFactionName;
|
||||
string currentMap;
|
||||
JoinMenu returnMenuInfo;
|
||||
bool settingsReceivedFromServer;
|
||||
time_t lastNetworkSendPing;
|
||||
int pingCount;
|
||||
bool initialSettingsReceivedFromServer;
|
||||
|
||||
string lastMapDataSynchError;
|
||||
string lastTileDataSynchError;
|
||||
string lastTechtreeDataSynchError;
|
||||
|
||||
int8 switchSetupRequestFlagType;
|
||||
string defaultPlayerName;
|
||||
|
||||
bool enableFactionTexturePreview;
|
||||
bool enableMapPreview;
|
||||
|
||||
string currentTechName_factionPreview;
|
||||
string currentFactionName_factionPreview;
|
||||
string currentFactionLogo;
|
||||
Texture2D *factionTexture;
|
||||
::Shared::Graphics::VideoPlayer * factionVideo;
|
||||
bool factionVideoSwitchedOffVolume;
|
||||
|
||||
MapPreview mapPreview;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
|
||||
std::string lastMissingMap;
|
||||
std::string lastMissingTechtree;
|
||||
std::string lastMissingTileSet;
|
||||
|
||||
vector < string > mapFiles;
|
||||
vector < string > techTreeFiles;
|
||||
vector < string > tilesetFiles;
|
||||
vector < string > factionFiles;
|
||||
|
||||
vector<string> playerSortedMaps[GameConstants::maxPlayers+1];
|
||||
vector<string> formattedPlayerSortedMaps[GameConstants::maxPlayers+1];
|
||||
vector<string> formattedMapFiles;
|
||||
vector < string > playerSortedMaps[GameConstants::maxPlayers + 1];
|
||||
vector < string >
|
||||
formattedPlayerSortedMaps[GameConstants::maxPlayers + 1];
|
||||
vector < string > formattedMapFiles;
|
||||
|
||||
GraphicMessageBox ftpMessageBox;
|
||||
FTPClientThread *ftpClientThread;
|
||||
FTPMessageType ftpMissingDataType;
|
||||
GraphicMessageBox ftpMessageBox;
|
||||
FTPClientThread *ftpClientThread;
|
||||
FTPMessageType ftpMissingDataType;
|
||||
|
||||
SimpleTaskThread *modHttpServerThread;
|
||||
std::vector < std::string > tilesetListRemote;
|
||||
std::map < string, ModInfo > tilesetCacheList;
|
||||
std::vector < std::string > techListRemote;
|
||||
std::map < string, ModInfo > techCacheList;
|
||||
std::vector < std::string > mapListRemote;
|
||||
std::map < string, ModInfo > mapCacheList;
|
||||
|
||||
SimpleTaskThread *modHttpServerThread;
|
||||
std::vector<std::string> tilesetListRemote;
|
||||
std::map<string, ModInfo> tilesetCacheList;
|
||||
std::vector<std::string> techListRemote;
|
||||
std::map<string, ModInfo> techCacheList;
|
||||
std::vector<std::string> mapListRemote;
|
||||
std::map<string, ModInfo> mapCacheList;
|
||||
std::map < string, uint32 > mapCRCUpdateList;
|
||||
|
||||
std::map<string,uint32> mapCRCUpdateList;
|
||||
|
||||
|
||||
string getMissingMapFromFTPServer;
|
||||
bool getMissingMapFromFTPServerInProgress;
|
||||
time_t getMissingMapFromFTPServerLastPrompted;
|
||||
|
||||
string getMissingMapFromFTPServer;
|
||||
bool getMissingMapFromFTPServerInProgress;
|
||||
time_t getMissingMapFromFTPServerLastPrompted;
|
||||
string getMissingTilesetFromFTPServer;
|
||||
bool getMissingTilesetFromFTPServerInProgress;
|
||||
time_t getMissingTilesetFromFTPServerLastPrompted;
|
||||
|
||||
string getMissingTilesetFromFTPServer;
|
||||
bool getMissingTilesetFromFTPServerInProgress;
|
||||
time_t getMissingTilesetFromFTPServerLastPrompted;
|
||||
string getMissingTechtreeFromFTPServer;
|
||||
bool getMissingTechtreeFromFTPServerInProgress;
|
||||
time_t getMissingTechtreeFromFTPServerLastPrompted;
|
||||
|
||||
string getMissingTechtreeFromFTPServer;
|
||||
bool getMissingTechtreeFromFTPServerInProgress;
|
||||
time_t getMissingTechtreeFromFTPServerLastPrompted;
|
||||
string getInProgressSavedGameFromFTPServer;
|
||||
bool getInProgressSavedGameFromFTPServerInProgress;
|
||||
bool readyToJoinInProgressGame;
|
||||
|
||||
string getInProgressSavedGameFromFTPServer;
|
||||
bool getInProgressSavedGameFromFTPServerInProgress;
|
||||
bool readyToJoinInProgressGame;
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
uint32 lastCheckedCRCTilesetValue;
|
||||
uint32 lastCheckedCRCTechtreeValue;
|
||||
uint32 lastCheckedCRCMapValue;
|
||||
vector < pair < string, uint32 > >factionCRCList;
|
||||
|
||||
std::map < string, pair < int, string > >fileFTPProgressList;
|
||||
GraphicButton buttonCancelDownloads;
|
||||
|
||||
GraphicLabel labelEnableSwitchTeamMode;
|
||||
GraphicCheckBox checkBoxEnableSwitchTeamMode;
|
||||
|
||||
GraphicLabel labelAllowTeamUnitSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamUnitSharing;
|
||||
|
||||
GraphicLabel labelAllowTeamResourceSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamResourceSharing;
|
||||
|
||||
GraphicLabel labelAISwitchTeamAcceptPercent;
|
||||
GraphicListBox listBoxAISwitchTeamAcceptPercent;
|
||||
GraphicLabel labelFallbackCpuMultiplier;
|
||||
GraphicListBox listBoxFallbackCpuMultiplier;
|
||||
|
||||
|
||||
GraphicButton buttonPlayNow;
|
||||
|
||||
GraphicCheckBox checkBoxScenario;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
vector < string > scenarioFiles;
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector < string > dirList;
|
||||
string autoloadScenarioName;
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *scenarioLogoTexture;
|
||||
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
uint32 lastCheckedCRCTilesetValue;
|
||||
uint32 lastCheckedCRCTechtreeValue;
|
||||
uint32 lastCheckedCRCMapValue;
|
||||
vector<pair<string,uint32> > factionCRCList;
|
||||
bool needToBroadcastServerSettings;
|
||||
time_t broadcastServerSettingsDelayTimer;
|
||||
int lastGameSettingsReceivedCount;
|
||||
|
||||
time_t noReceiveTimer;
|
||||
|
||||
std::map<string,pair<int,string> > fileFTPProgressList;
|
||||
GraphicButton buttonCancelDownloads;
|
||||
bool launchingNewGame;
|
||||
bool isfirstSwitchingMapMessage;
|
||||
auto_ptr < TechTree > techTree;
|
||||
|
||||
GraphicLabel labelEnableSwitchTeamMode;
|
||||
GraphicCheckBox checkBoxEnableSwitchTeamMode;
|
||||
GameSettings originalGamesettings;
|
||||
bool validOriginalGameSettings;
|
||||
GameSettings displayedGamesettings;
|
||||
bool validDisplayedGamesettings;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
GraphicLabel labelAllowTeamUnitSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamUnitSharing;
|
||||
MenuStateConnectedGame (Program * program, MainMenu * mainMenu,
|
||||
JoinMenu joinMenuInfo =
|
||||
jmSimple, bool openNetworkSlots = false);
|
||||
virtual ~ MenuStateConnectedGame ();
|
||||
|
||||
GraphicLabel labelAllowTeamResourceSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamResourceSharing;
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
void update ();
|
||||
|
||||
GraphicLabel labelAISwitchTeamAcceptPercent;
|
||||
GraphicListBox listBoxAISwitchTeamAcceptPercent;
|
||||
GraphicLabel labelFallbackCpuMultiplier;
|
||||
GraphicListBox listBoxFallbackCpuMultiplier;
|
||||
virtual bool textInput (std::string text);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
virtual void keyUp (SDL_KeyboardEvent key);
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent ();
|
||||
|
||||
virtual void reloadUI ();
|
||||
|
||||
GraphicButton buttonPlayNow;
|
||||
virtual bool isVideoPlaying ();
|
||||
|
||||
GraphicCheckBox checkBoxScenario;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
vector<string> scenarioFiles;
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector<string> dirList;
|
||||
string autoloadScenarioName;
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *scenarioLogoTexture;
|
||||
private:
|
||||
|
||||
bool needToBroadcastServerSettings;
|
||||
time_t broadcastServerSettingsDelayTimer;
|
||||
int lastGameSettingsReceivedCount;
|
||||
|
||||
time_t noReceiveTimer;
|
||||
|
||||
bool launchingNewGame;
|
||||
bool isfirstSwitchingMapMessage;
|
||||
auto_ptr<TechTree> techTree;
|
||||
|
||||
GameSettings originalGamesettings;
|
||||
bool validOriginalGameSettings;
|
||||
GameSettings displayedGamesettings;
|
||||
bool validDisplayedGamesettings;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
MenuStateConnectedGame(Program *program, MainMenu *mainMenu, JoinMenu joinMenuInfo=jmSimple, bool openNetworkSlots= false);
|
||||
virtual ~MenuStateConnectedGame();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual void keyUp(SDL_KeyboardEvent key);
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent();
|
||||
|
||||
virtual void reloadUI();
|
||||
|
||||
virtual bool isVideoPlaying();
|
||||
|
||||
private:
|
||||
|
||||
bool hasNetworkGameSettings();
|
||||
bool loadFactions(const GameSettings *gameSettings,bool errorOnNoFactions);
|
||||
void returnToJoinMenu();
|
||||
string getHumanPlayerName();
|
||||
void setActiveInputLabel(GraphicLabel *newLable);
|
||||
|
||||
void loadFactionTexture(string filepath);
|
||||
bool loadMapInfo(string file, MapInfo *mapInfo, bool loadMapPreview);
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
|
||||
void showFTPMessageBox(const string &text, const string &header, bool toggle);
|
||||
virtual void FTPClient_CallbackEvent(string itemName,
|
||||
FTP_Client_CallbackType type, pair<FTP_Client_ResultType,string> result,void *userdata);
|
||||
|
||||
int32 getNetworkPlayerStatus();
|
||||
void cleanupMapPreviewTexture();
|
||||
|
||||
void mouseClickAdmin(int x, int y, MouseButton mouseButton,string advanceToItemStartingWith);
|
||||
void switchToNextMapGroup(const int direction);
|
||||
void switchToMapGroup(int filterIndex);
|
||||
string getCurrentMapFile();
|
||||
void loadGameSettings(GameSettings *gameSettings);
|
||||
void reloadFactions(bool keepExistingSelectedItem,string scenario);
|
||||
void PlayNow(bool saveGame);
|
||||
bool isHeadlessAdmin();
|
||||
void broadCastGameSettingsToHeadlessServer(bool forceNow);
|
||||
void updateResourceMultiplier(const int index);
|
||||
|
||||
void RestoreLastGameSettings();
|
||||
void setupUIFromGameSettings(GameSettings *gameSettings, bool errorOnMissingData);
|
||||
|
||||
int setupMapList(string scenario);
|
||||
int setupTechList(string scenario, bool forceLoad=false);
|
||||
void setupTilesetList(string scenario);
|
||||
|
||||
void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo);
|
||||
void initFactionPreview(const GameSettings *gameSettings);
|
||||
|
||||
virtual void simpleTask(BaseThread *callingThread,void *userdata);
|
||||
string refreshTilesetModInfo(string tilesetInfo);
|
||||
string refreshTechModInfo(string techInfo);
|
||||
string refreshMapModInfo(string mapInfo);
|
||||
string getMapCRC(string mapName);
|
||||
|
||||
void disconnectFromServer();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
bool hasNetworkGameSettings ();
|
||||
bool loadFactions (const GameSettings * gameSettings,
|
||||
bool errorOnNoFactions);
|
||||
void returnToJoinMenu ();
|
||||
string getHumanPlayerName ();
|
||||
void setActiveInputLabel (GraphicLabel * newLable);
|
||||
|
||||
void loadFactionTexture (string filepath);
|
||||
bool loadMapInfo (string file, MapInfo * mapInfo, bool loadMapPreview);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
|
||||
void showFTPMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
virtual void FTPClient_CallbackEvent (string itemName,
|
||||
FTP_Client_CallbackType type,
|
||||
pair < FTP_Client_ResultType,
|
||||
string > result, void *userdata);
|
||||
|
||||
int32 getNetworkPlayerStatus ();
|
||||
void cleanupMapPreviewTexture ();
|
||||
|
||||
void mouseClickAdmin (int x, int y, MouseButton mouseButton,
|
||||
string advanceToItemStartingWith);
|
||||
void switchToNextMapGroup (const int direction);
|
||||
void switchToMapGroup (int filterIndex);
|
||||
string getCurrentMapFile ();
|
||||
void loadGameSettings (GameSettings * gameSettings);
|
||||
void reloadFactions (bool keepExistingSelectedItem, string scenario);
|
||||
void PlayNow (bool saveGame);
|
||||
bool isHeadlessAdmin ();
|
||||
void broadCastGameSettingsToHeadlessServer (bool forceNow);
|
||||
void updateResourceMultiplier (const int index);
|
||||
|
||||
void RestoreLastGameSettings ();
|
||||
void setupUIFromGameSettings (GameSettings * gameSettings,
|
||||
bool errorOnMissingData);
|
||||
|
||||
int setupMapList (string scenario);
|
||||
int setupTechList (string scenario, bool forceLoad = false);
|
||||
void setupTilesetList (string scenario);
|
||||
|
||||
void loadScenarioInfo (string file, ScenarioInfo * scenarioInfo);
|
||||
void initFactionPreview (const GameSettings * gameSettings);
|
||||
|
||||
virtual void simpleTask (BaseThread * callingThread, void *userdata);
|
||||
string refreshTilesetModInfo (string tilesetInfo);
|
||||
string refreshTechModInfo (string techInfo);
|
||||
string refreshMapModInfo (string mapInfo);
|
||||
string getMapCRC (string mapName);
|
||||
|
||||
void disconnectFromServer ();
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,319 +1,404 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATECUSTOMGAME_H_
|
||||
#define _GLEST_GAME_MENUSTATECUSTOMGAME_H_
|
||||
# define _GLEST_GAME_MENUSTATECUSTOMGAME_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "chat_manager.h"
|
||||
#include "simple_threads.h"
|
||||
#include "map_preview.h"
|
||||
#include "common_scoped_ptr.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "chat_manager.h"
|
||||
# include "simple_threads.h"
|
||||
# include "map_preview.h"
|
||||
# include "common_scoped_ptr.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Map;
|
||||
using namespace
|
||||
Shared::Map;
|
||||
|
||||
namespace Shared { namespace Graphics {
|
||||
class VideoPlayer;
|
||||
}}
|
||||
namespace Shared
|
||||
{
|
||||
namespace Graphics
|
||||
{
|
||||
class VideoPlayer;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Glest { namespace Game {
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
class SwitchSetupRequest;
|
||||
class ServerInterface;
|
||||
class TechTree;
|
||||
class SwitchSetupRequest;
|
||||
class ServerInterface;
|
||||
class TechTree;
|
||||
|
||||
enum ParentMenuState {
|
||||
pNewGame,
|
||||
pMasterServer,
|
||||
pLanGame
|
||||
};
|
||||
enum ParentMenuState
|
||||
{
|
||||
pNewGame,
|
||||
pMasterServer,
|
||||
pLanGame
|
||||
};
|
||||
|
||||
// ===============================
|
||||
// class MenuStateCustomGame
|
||||
// class MenuStateCustomGame
|
||||
// ===============================
|
||||
|
||||
class MenuStateCustomGame : public MenuState, public SimpleTaskCallbackInterface {
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonPlayNow;
|
||||
GraphicButton buttonRestoreLastSettings;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
GraphicLabel labelFogOfWar;
|
||||
GraphicLabel labelTechTree;
|
||||
GraphicLabel labelTileset;
|
||||
GraphicLabel labelMapInfo;
|
||||
GraphicLabel labelLocalGameVersion;
|
||||
GraphicLabel labelLocalIP;
|
||||
GraphicLabel labelGameName;
|
||||
class MenuStateCustomGame:
|
||||
public MenuState, public SimpleTaskCallbackInterface
|
||||
{
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonPlayNow;
|
||||
GraphicButton buttonRestoreLastSettings;
|
||||
GraphicLabel labelControl;
|
||||
GraphicLabel labelRMultiplier;
|
||||
GraphicLabel labelFaction;
|
||||
GraphicLabel labelTeam;
|
||||
GraphicLabel labelMap;
|
||||
GraphicLabel labelFogOfWar;
|
||||
GraphicLabel labelTechTree;
|
||||
GraphicLabel labelTileset;
|
||||
GraphicLabel labelMapInfo;
|
||||
GraphicLabel labelLocalGameVersion;
|
||||
GraphicLabel labelLocalIP;
|
||||
GraphicLabel labelGameName;
|
||||
|
||||
GraphicListBox listBoxMap;
|
||||
GraphicListBox listBoxFogOfWar;
|
||||
GraphicListBox listBoxTechTree;
|
||||
GraphicListBox listBoxTileset;
|
||||
GraphicListBox listBoxMap;
|
||||
GraphicListBox listBoxFogOfWar;
|
||||
GraphicListBox listBoxTechTree;
|
||||
GraphicListBox listBoxTileset;
|
||||
|
||||
vector<string> mapFiles;
|
||||
vector<string> playerSortedMaps[GameConstants::maxPlayers+1];
|
||||
vector<string> formattedPlayerSortedMaps[GameConstants::maxPlayers+1];
|
||||
vector<string> techTreeFiles;
|
||||
vector<string> tilesetFiles;
|
||||
vector<string> factionFiles;
|
||||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicButton buttonBlockPlayers[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
MapInfo mapInfo;
|
||||
vector < string > mapFiles;
|
||||
vector < string > playerSortedMaps[GameConstants::maxPlayers + 1];
|
||||
vector <
|
||||
string > formattedPlayerSortedMaps[GameConstants::maxPlayers + 1];
|
||||
vector < string > techTreeFiles;
|
||||
vector < string > tilesetFiles;
|
||||
vector < string > factionFiles;
|
||||
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
||||
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
||||
GraphicButton buttonBlockPlayers[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
||||
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
||||
MapInfo mapInfo;
|
||||
|
||||
GraphicButton buttonClearBlockedPlayers;
|
||||
GraphicButton buttonClearBlockedPlayers;
|
||||
|
||||
GraphicLabel labelPublishServer;
|
||||
GraphicCheckBox checkBoxPublishServer;
|
||||
GraphicLabel labelPublishServer;
|
||||
GraphicCheckBox checkBoxPublishServer;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int
|
||||
mainMessageBoxState;
|
||||
|
||||
GraphicLabel labelNetworkPauseGameForLaggedClients;
|
||||
GraphicCheckBox checkBoxNetworkPauseGameForLaggedClients;
|
||||
GraphicLabel labelNetworkPauseGameForLaggedClients;
|
||||
GraphicCheckBox checkBoxNetworkPauseGameForLaggedClients;
|
||||
|
||||
GraphicLabel labelMapFilter;
|
||||
GraphicListBox listBoxMapFilter;
|
||||
GraphicLabel labelMapFilter;
|
||||
GraphicListBox listBoxMapFilter;
|
||||
|
||||
GraphicLabel labelAdvanced;
|
||||
GraphicCheckBox checkBoxAdvanced;
|
||||
GraphicLabel labelAdvanced;
|
||||
GraphicCheckBox checkBoxAdvanced;
|
||||
|
||||
GraphicLabel labelAllowObservers;
|
||||
GraphicCheckBox checkBoxAllowObservers;
|
||||
GraphicLabel labelAllowObservers;
|
||||
GraphicCheckBox checkBoxAllowObservers;
|
||||
|
||||
GraphicLabel *activeInputLabel;
|
||||
GraphicLabel *
|
||||
activeInputLabel;
|
||||
|
||||
GraphicLabel labelPlayerStatus[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxPlayerStatus;
|
||||
GraphicLabel labelPlayerStatus[GameConstants::maxPlayers];
|
||||
GraphicListBox listBoxPlayerStatus;
|
||||
|
||||
GraphicLabel labelEnableSwitchTeamMode;
|
||||
GraphicCheckBox checkBoxEnableSwitchTeamMode;
|
||||
GraphicLabel labelEnableSwitchTeamMode;
|
||||
GraphicCheckBox checkBoxEnableSwitchTeamMode;
|
||||
|
||||
GraphicLabel labelAISwitchTeamAcceptPercent;
|
||||
GraphicListBox listBoxAISwitchTeamAcceptPercent;
|
||||
GraphicLabel labelFallbackCpuMultiplier;
|
||||
GraphicListBox listBoxFallbackCpuMultiplier;
|
||||
GraphicLabel labelAISwitchTeamAcceptPercent;
|
||||
GraphicListBox listBoxAISwitchTeamAcceptPercent;
|
||||
GraphicLabel labelFallbackCpuMultiplier;
|
||||
GraphicListBox listBoxFallbackCpuMultiplier;
|
||||
|
||||
GraphicLabel labelAllowInGameJoinPlayer;
|
||||
GraphicCheckBox checkBoxAllowInGameJoinPlayer;
|
||||
GraphicLabel labelAllowInGameJoinPlayer;
|
||||
GraphicCheckBox checkBoxAllowInGameJoinPlayer;
|
||||
|
||||
GraphicLabel labelAllowTeamUnitSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamUnitSharing;
|
||||
GraphicLabel labelAllowTeamUnitSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamUnitSharing;
|
||||
|
||||
GraphicLabel labelAllowTeamResourceSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamResourceSharing;
|
||||
GraphicLabel labelAllowTeamResourceSharing;
|
||||
GraphicCheckBox checkBoxAllowTeamResourceSharing;
|
||||
|
||||
|
||||
GraphicLabel labelAllowNativeLanguageTechtree;
|
||||
GraphicCheckBox checkBoxAllowNativeLanguageTechtree;
|
||||
GraphicLabel labelAllowNativeLanguageTechtree;
|
||||
GraphicCheckBox checkBoxAllowNativeLanguageTechtree;
|
||||
|
||||
GraphicCheckBox checkBoxScenario;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
GraphicCheckBox checkBoxScenario;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
|
||||
vector<string> scenarioFiles;
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector<string> dirList;
|
||||
string autoloadScenarioName;
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *scenarioLogoTexture;
|
||||
vector < string > scenarioFiles;
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector < string > dirList;
|
||||
string autoloadScenarioName;
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *
|
||||
scenarioLogoTexture;
|
||||
|
||||
bool needToSetChangedGameSettings;
|
||||
time_t lastSetChangedGameSettings;
|
||||
time_t lastMasterserverPublishing;
|
||||
time_t lastNetworkPing;
|
||||
time_t mapPublishingDelayTimer;
|
||||
bool needToPublishDelayed;
|
||||
bool needToSetChangedGameSettings;
|
||||
time_t lastSetChangedGameSettings;
|
||||
time_t lastMasterserverPublishing;
|
||||
time_t lastNetworkPing;
|
||||
time_t mapPublishingDelayTimer;
|
||||
bool needToPublishDelayed;
|
||||
|
||||
bool headlessHasConnectedPlayer;
|
||||
bool headlessHasConnectedPlayer;
|
||||
|
||||
bool needToRepublishToMasterserver;
|
||||
bool needToBroadcastServerSettings;
|
||||
std::map<string,string> publishToServerInfo;
|
||||
SimpleTaskThread *publishToMasterserverThread;
|
||||
SimpleTaskThread *publishToClientsThread;
|
||||
bool needToRepublishToMasterserver;
|
||||
bool needToBroadcastServerSettings;
|
||||
std::map < string, string > publishToServerInfo;
|
||||
SimpleTaskThread *
|
||||
publishToMasterserverThread;
|
||||
SimpleTaskThread *
|
||||
publishToClientsThread;
|
||||
|
||||
ParentMenuState parentMenuState;
|
||||
int soundConnectionCount;
|
||||
ParentMenuState parentMenuState;
|
||||
int
|
||||
soundConnectionCount;
|
||||
|
||||
time_t tMasterserverErrorElapsed;
|
||||
bool showMasterserverError;
|
||||
string masterServererErrorToShow;
|
||||
time_t tMasterserverErrorElapsed;
|
||||
bool showMasterserverError;
|
||||
string masterServererErrorToShow;
|
||||
|
||||
bool showGeneralError;
|
||||
string generalErrorToShow;
|
||||
bool serverInitError;
|
||||
bool showGeneralError;
|
||||
string generalErrorToShow;
|
||||
bool serverInitError;
|
||||
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
bool showFullConsole;
|
||||
|
||||
string lastMapDataSynchError;
|
||||
string lastTileDataSynchError;
|
||||
string lastTechtreeDataSynchError;
|
||||
string lastMapDataSynchError;
|
||||
string lastTileDataSynchError;
|
||||
string lastTechtreeDataSynchError;
|
||||
|
||||
string defaultPlayerName;
|
||||
int8 switchSetupRequestFlagType;
|
||||
string defaultPlayerName;
|
||||
int8 switchSetupRequestFlagType;
|
||||
|
||||
bool enableFactionTexturePreview;
|
||||
bool enableMapPreview;
|
||||
bool enableFactionTexturePreview;
|
||||
bool enableMapPreview;
|
||||
|
||||
string currentTechName_factionPreview;
|
||||
string currentFactionName_factionPreview;
|
||||
string currentFactionLogo;
|
||||
Texture2D *factionTexture;
|
||||
::Shared::Graphics::VideoPlayer *factionVideo;
|
||||
bool factionVideoSwitchedOffVolume;
|
||||
string currentTechName_factionPreview;
|
||||
string currentFactionName_factionPreview;
|
||||
string currentFactionLogo;
|
||||
Texture2D *
|
||||
factionTexture;
|
||||
::Shared::Graphics::VideoPlayer * factionVideo;
|
||||
bool factionVideoSwitchedOffVolume;
|
||||
|
||||
MapPreview mapPreview;
|
||||
Texture2D *mapPreviewTexture;
|
||||
bool zoomedMap;
|
||||
int render_mapPreviewTexture_X;
|
||||
int render_mapPreviewTexture_Y;
|
||||
int render_mapPreviewTexture_W;
|
||||
int render_mapPreviewTexture_H;
|
||||
MapPreview mapPreview;
|
||||
Texture2D *
|
||||
mapPreviewTexture;
|
||||
bool zoomedMap;
|
||||
int
|
||||
render_mapPreviewTexture_X;
|
||||
int
|
||||
render_mapPreviewTexture_Y;
|
||||
int
|
||||
render_mapPreviewTexture_W;
|
||||
int
|
||||
render_mapPreviewTexture_H;
|
||||
|
||||
bool autostart;
|
||||
GameSettings *autoStartSettings;
|
||||
bool autostart;
|
||||
GameSettings *
|
||||
autoStartSettings;
|
||||
|
||||
std::map<int,int> lastSelectedTeamIndex;
|
||||
float rMultiplierOffset;
|
||||
bool hasCheckedForUPNP;
|
||||
std::map < int, int >
|
||||
lastSelectedTeamIndex;
|
||||
float
|
||||
rMultiplierOffset;
|
||||
bool hasCheckedForUPNP;
|
||||
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
string lastCheckedCRCTilesetName;
|
||||
string lastCheckedCRCTechtreeName;
|
||||
string lastCheckedCRCMapName;
|
||||
|
||||
string last_Forced_CheckedCRCTilesetName;
|
||||
string last_Forced_CheckedCRCTechtreeName;
|
||||
string last_Forced_CheckedCRCMapName;
|
||||
string last_Forced_CheckedCRCTilesetName;
|
||||
string last_Forced_CheckedCRCTechtreeName;
|
||||
string last_Forced_CheckedCRCMapName;
|
||||
|
||||
uint32 lastCheckedCRCTilesetValue;
|
||||
uint32 lastCheckedCRCTechtreeValue;
|
||||
uint32 lastCheckedCRCMapValue;
|
||||
vector<pair<string,uint32> > factionCRCList;
|
||||
uint32 lastCheckedCRCTilesetValue;
|
||||
uint32 lastCheckedCRCTechtreeValue;
|
||||
uint32 lastCheckedCRCMapValue;
|
||||
vector < pair < string, uint32 > >factionCRCList;
|
||||
|
||||
bool forceWaitForShutdown;
|
||||
bool headlessServerMode;
|
||||
bool masterserverModeMinimalResources;
|
||||
int lastMasterServerSettingsUpdateCount;
|
||||
bool forceWaitForShutdown;
|
||||
bool headlessServerMode;
|
||||
bool masterserverModeMinimalResources;
|
||||
int
|
||||
lastMasterServerSettingsUpdateCount;
|
||||
|
||||
auto_ptr<TechTree> techTree;
|
||||
auto_ptr < TechTree > techTree;
|
||||
|
||||
string gameUUID;
|
||||
string gameUUID;
|
||||
|
||||
int lastGameSettingsreceivedCount;
|
||||
int
|
||||
lastGameSettingsreceivedCount;
|
||||
|
||||
public:
|
||||
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,
|
||||
bool openNetworkSlots= false, ParentMenuState parentMenuState=pNewGame,
|
||||
bool autostart=false,GameSettings *settings=NULL,bool masterserverMode=false,
|
||||
string autoloadScenarioName="");
|
||||
virtual ~MenuStateCustomGame();
|
||||
public:
|
||||
MenuStateCustomGame (Program * program, MainMenu * mainMenu,
|
||||
bool openNetworkSlots =
|
||||
false, ParentMenuState parentMenuState =
|
||||
pNewGame, bool autostart =
|
||||
false, GameSettings * settings =
|
||||
NULL, bool masterserverMode =
|
||||
false, string autoloadScenarioName = "");
|
||||
virtual ~ MenuStateCustomGame ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
void
|
||||
mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void
|
||||
mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void
|
||||
render ();
|
||||
void
|
||||
update ();
|
||||
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual void keyUp(SDL_KeyboardEvent key);
|
||||
virtual bool textInput (std::string text);
|
||||
virtual void
|
||||
keyDown (SDL_KeyboardEvent key);
|
||||
virtual void
|
||||
keyPress (SDL_KeyboardEvent c);
|
||||
virtual void
|
||||
keyUp (SDL_KeyboardEvent key);
|
||||
|
||||
|
||||
virtual void simpleTask(BaseThread *callingThread,void *userdata);
|
||||
virtual void setupTask(BaseThread *callingThread,void *userdata);
|
||||
virtual void shutdownTask(BaseThread *callingThread,void *userdata);
|
||||
static void setupTaskStatic(BaseThread *callingThread);
|
||||
static void shutdownTaskStatic(BaseThread *callingThread);
|
||||
virtual void
|
||||
simpleTask (BaseThread * callingThread, void *userdata);
|
||||
virtual void
|
||||
setupTask (BaseThread * callingThread, void *userdata);
|
||||
virtual void
|
||||
shutdownTask (BaseThread * callingThread, void *userdata);
|
||||
static void
|
||||
setupTaskStatic (BaseThread * callingThread);
|
||||
static void
|
||||
shutdownTaskStatic (BaseThread * callingThread);
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent();
|
||||
virtual bool isMasterserverMode() const;
|
||||
virtual bool isInSpecialKeyCaptureEvent ();
|
||||
virtual bool isMasterserverMode ()const;
|
||||
|
||||
virtual bool isVideoPlaying();
|
||||
private:
|
||||
virtual bool isVideoPlaying ();
|
||||
private:
|
||||
|
||||
void lastPlayerDisconnected();
|
||||
bool hasNetworkGameSettings();
|
||||
void loadGameSettings(GameSettings *gameSettings, bool forceCloseUnusedSlots=false);
|
||||
void loadMapInfo(string file, MapInfo *mapInfo,bool loadMapPreview);
|
||||
void cleanupMapPreviewTexture();
|
||||
void
|
||||
lastPlayerDisconnected ();
|
||||
bool hasNetworkGameSettings ();
|
||||
void
|
||||
loadGameSettings (GameSettings * gameSettings,
|
||||
bool forceCloseUnusedSlots = false);
|
||||
void
|
||||
loadMapInfo (string file, MapInfo * mapInfo, bool loadMapPreview);
|
||||
void
|
||||
cleanupMapPreviewTexture ();
|
||||
|
||||
void updateControlers();
|
||||
void closeUnusedSlots();
|
||||
void updateNetworkSlots();
|
||||
void publishToMasterserver();
|
||||
void returnToParentMenu();
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void
|
||||
updateControlers ();
|
||||
void
|
||||
closeUnusedSlots ();
|
||||
void
|
||||
updateNetworkSlots ();
|
||||
void
|
||||
publishToMasterserver ();
|
||||
void
|
||||
returnToParentMenu ();
|
||||
void
|
||||
showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
|
||||
void saveGameSettingsToFile(std::string fileName);
|
||||
void switchToNextMapGroup(const int direction);
|
||||
void updateAllResourceMultiplier();
|
||||
void updateResourceMultiplier(const int index);
|
||||
string getCurrentMapFile();
|
||||
void setActiveInputLabel(GraphicLabel *newLable);
|
||||
string getHumanPlayerName(int index=-1);
|
||||
void
|
||||
saveGameSettingsToFile (std::string fileName);
|
||||
void
|
||||
switchToNextMapGroup (const int direction);
|
||||
void
|
||||
updateAllResourceMultiplier ();
|
||||
void
|
||||
updateResourceMultiplier (const int index);
|
||||
string getCurrentMapFile ();
|
||||
void
|
||||
setActiveInputLabel (GraphicLabel * newLable);
|
||||
string getHumanPlayerName (int index = -1);
|
||||
|
||||
void loadFactionTexture(string filepath);
|
||||
void
|
||||
loadFactionTexture (string filepath);
|
||||
|
||||
GameSettings loadGameSettingsFromFile(std::string fileName);
|
||||
void loadGameSettings(const std::string &fileName);
|
||||
void RestoreLastGameSettings();
|
||||
void PlayNow(bool saveGame);
|
||||
GameSettings loadGameSettingsFromFile (std::string fileName);
|
||||
void
|
||||
loadGameSettings (const std::string & fileName);
|
||||
void
|
||||
RestoreLastGameSettings ();
|
||||
void
|
||||
PlayNow (bool saveGame);
|
||||
|
||||
void SetActivePlayerNameEditor();
|
||||
void cleanup();
|
||||
void
|
||||
SetActivePlayerNameEditor ();
|
||||
void
|
||||
cleanup ();
|
||||
|
||||
int32 getNetworkPlayerStatus();
|
||||
void setupUIFromGameSettings(const GameSettings &gameSettings);
|
||||
int32 getNetworkPlayerStatus ();
|
||||
void
|
||||
setupUIFromGameSettings (const GameSettings & gameSettings);
|
||||
|
||||
void switchSetupForSlots(SwitchSetupRequest **switchSetupRequests,
|
||||
ServerInterface *& serverInterface, int startIndex, int endIndex,
|
||||
bool onlyNetworkUnassigned);
|
||||
void
|
||||
switchSetupForSlots (SwitchSetupRequest ** switchSetupRequests,
|
||||
ServerInterface * &serverInterface, int startIndex,
|
||||
int endIndex, bool onlyNetworkUnassigned);
|
||||
|
||||
string createGameName(string controllingPlayer="");
|
||||
void reloadUI();
|
||||
void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo);
|
||||
void processScenario();
|
||||
void SetupUIForScenarios();
|
||||
int setupMapList(string scenario);
|
||||
int setupTechList(string scenario, bool forceLoad=false);
|
||||
void reloadFactions(bool keepExistingSelectedItem, string scenario);
|
||||
void setupTilesetList(string scenario);
|
||||
void setSlotHuman(int i);
|
||||
string createGameName (string controllingPlayer = "");
|
||||
void
|
||||
reloadUI ();
|
||||
void
|
||||
loadScenarioInfo (string file, ScenarioInfo * scenarioInfo);
|
||||
void
|
||||
processScenario ();
|
||||
void
|
||||
SetupUIForScenarios ();
|
||||
int
|
||||
setupMapList (string scenario);
|
||||
int
|
||||
setupTechList (string scenario, bool forceLoad = false);
|
||||
void
|
||||
reloadFactions (bool keepExistingSelectedItem, string scenario);
|
||||
void
|
||||
setupTilesetList (string scenario);
|
||||
void
|
||||
setSlotHuman (int i);
|
||||
|
||||
void initFactionPreview(const GameSettings *gameSettings);
|
||||
void
|
||||
initFactionPreview (const GameSettings * gameSettings);
|
||||
|
||||
bool checkNetworkPlayerDataSynch(bool checkMapCRC,bool checkTileSetCRC, bool checkTechTreeCRC);
|
||||
bool
|
||||
checkNetworkPlayerDataSynch (bool checkMapCRC, bool checkTileSetCRC,
|
||||
bool checkTechTreeCRC);
|
||||
|
||||
void cleanupThread(SimpleTaskThread **thread);
|
||||
void simpleTaskForMasterServer(BaseThread *callingThread);
|
||||
void simpleTaskForClients(BaseThread *callingThread);
|
||||
void KeepCurrentHumanPlayerSlots(GameSettings &gameSettings);
|
||||
};
|
||||
void
|
||||
cleanupThread (SimpleTaskThread ** thread);
|
||||
void
|
||||
simpleTaskForMasterServer (BaseThread * callingThread);
|
||||
void
|
||||
simpleTaskForClients (BaseThread * callingThread);
|
||||
void
|
||||
KeepCurrentHumanPlayerSlots (GameSettings & gameSettings);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_state_graphic_info.h"
|
||||
@ -19,139 +19,192 @@
|
||||
#include "opengl.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
// =====================================================
|
||||
// class MenuStateGraphicInfo
|
||||
// =====================================================
|
||||
|
||||
MenuStateGraphicInfo::MenuStateGraphicInfo(Program *program, MainMenu *mainMenu):
|
||||
MenuState(program, mainMenu, "info")
|
||||
namespace Glest
|
||||
{
|
||||
Lang &lang= Lang::getInstance();
|
||||
namespace Game
|
||||
{
|
||||
|
||||
containerName = "GraphicInfo";
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||
buttonReturn.init(650, 575, 125);
|
||||
// =====================================================
|
||||
// class MenuStateGraphicInfo
|
||||
// =====================================================
|
||||
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
MenuStateGraphicInfo::MenuStateGraphicInfo (Program * program,
|
||||
MainMenu *
|
||||
mainMenu):MenuState (program,
|
||||
mainMenu,
|
||||
"info")
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
labelInfo.registerGraphicComponent(containerName,"labelInfo");
|
||||
labelInfo.init(0, 730);
|
||||
containerName = "GraphicInfo";
|
||||
buttonReturn.registerGraphicComponent (containerName, "buttonReturn");
|
||||
buttonReturn.init (650, 575, 125);
|
||||
|
||||
labelMoreInfo.registerGraphicComponent(containerName,"labelMoreInfo");
|
||||
labelMoreInfo.init(0, 555);
|
||||
labelMoreInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
labelMoreInfo.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
labelInternalInfo.registerGraphicComponent(containerName,"labelInternalInfo");
|
||||
labelInternalInfo.init(300, 730);
|
||||
labelInternalInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
labelInternalInfo.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
labelInfo.registerGraphicComponent (containerName, "labelInfo");
|
||||
labelInfo.init (0, 730);
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
labelMoreInfo.registerGraphicComponent (containerName, "labelMoreInfo");
|
||||
labelMoreInfo.init (0, 555);
|
||||
labelMoreInfo.setFont (CoreData::getInstance ().getDisplayFontSmall ());
|
||||
labelMoreInfo.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
labelInternalInfo.registerGraphicComponent (containerName,
|
||||
"labelInternalInfo");
|
||||
labelInternalInfo.init (300, 730);
|
||||
labelInternalInfo.setFont (CoreData::getInstance ().
|
||||
getDisplayFontSmall ());
|
||||
labelInternalInfo.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
string glInfo= renderer.getGlInfo();
|
||||
string glMoreInfo= renderer.getGlMoreInfo();
|
||||
labelInfo.setText(glInfo);
|
||||
labelMoreInfo.setText(glMoreInfo);
|
||||
GraphicComponent::applyAllCustomProperties (containerName);
|
||||
|
||||
string strInternalInfo = "";
|
||||
strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported());
|
||||
if(getenv("MEGAGLEST_FONT") != NULL) {
|
||||
char *tryFont = getenv("MEGAGLEST_FONT");
|
||||
strInternalInfo += "\nMEGAGLEST_FONT: " + string(tryFont);
|
||||
}
|
||||
strInternalInfo += "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts);
|
||||
strInternalInfo += "\nrenderText3DEnabled: " + boolToStr(Renderer::renderText3DEnabled);
|
||||
strInternalInfo += "\nuseTextureCompression: " + boolToStr(Texture::useTextureCompression);
|
||||
strInternalInfo += "\nfontIsRightToLeft: " + boolToStr(Font::fontIsRightToLeft);
|
||||
strInternalInfo += "\nscaleFontValue: " + floatToStr(Font::scaleFontValue);
|
||||
strInternalInfo += "\nscaleFontValueCenterHFactor: " + floatToStr(Font::scaleFontValueCenterHFactor);
|
||||
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
|
||||
strInternalInfo += "\nAllowAltEnterFullscreenToggle: " + boolToStr(Window::getAllowAltEnterFullscreenToggle());
|
||||
strInternalInfo += "\nTryVSynch: " + boolToStr(Window::getTryVSynch());
|
||||
strInternalInfo += "\nVERBOSE_MODE_ENABLED: " + boolToStr(SystemFlags::VERBOSE_MODE_ENABLED);
|
||||
labelInternalInfo.setText(strInternalInfo);
|
||||
}
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
void MenuStateGraphicInfo::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
string glInfo = renderer.getGlInfo ();
|
||||
string glMoreInfo = renderer.getGlMoreInfo ();
|
||||
labelInfo.setText (glInfo);
|
||||
labelMoreInfo.setText (glMoreInfo);
|
||||
|
||||
console.resetFonts();
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
labelMoreInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
labelMoreInfo.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
|
||||
labelInternalInfo.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
labelInternalInfo.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
|
||||
string glInfo= renderer.getGlInfo();
|
||||
string glMoreInfo= renderer.getGlMoreInfo();
|
||||
labelInfo.setText(glInfo);
|
||||
labelMoreInfo.setText(glMoreInfo);
|
||||
|
||||
string strInternalInfo = "";
|
||||
strInternalInfo += "VBOSupported: " + boolToStr(getVBOSupported());
|
||||
if(getenv("MEGAGLEST_FONT") != NULL) {
|
||||
char *tryFont = getenv("MEGAGLEST_FONT");
|
||||
strInternalInfo += "\nMEGAGLEST_FONT: " + string(tryFont);
|
||||
}
|
||||
strInternalInfo += "\nforceLegacyFonts: " + boolToStr(Font::forceLegacyFonts);
|
||||
strInternalInfo += "\nrenderText3DEnabled: " + boolToStr(Renderer::renderText3DEnabled);
|
||||
strInternalInfo += "\nuseTextureCompression: " + boolToStr(Texture::useTextureCompression);
|
||||
strInternalInfo += "\nfontIsRightToLeft: " + boolToStr(Font::fontIsRightToLeft);
|
||||
strInternalInfo += "\nscaleFontValue: " + floatToStr(Font::scaleFontValue);
|
||||
strInternalInfo += "\nscaleFontValueCenterHFactor: " + floatToStr(Font::scaleFontValueCenterHFactor);
|
||||
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
|
||||
strInternalInfo += "\nAllowAltEnterFullscreenToggle: " + boolToStr(Window::getAllowAltEnterFullscreenToggle());
|
||||
strInternalInfo += "\nTryVSynch: " + boolToStr(Window::getTryVSynch());
|
||||
strInternalInfo += "\nVERBOSE_MODE_ENABLED: " + boolToStr(SystemFlags::VERBOSE_MODE_ENABLED);
|
||||
labelInternalInfo.setText(strInternalInfo);
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
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 MenuStateOptionsGraphics(program, mainMenu));
|
||||
string strInternalInfo = "";
|
||||
strInternalInfo += "VBOSupported: " + boolToStr (getVBOSupported ());
|
||||
if (getenv ("MEGAGLEST_FONT") != NULL)
|
||||
{
|
||||
char *tryFont = getenv ("MEGAGLEST_FONT");
|
||||
strInternalInfo += "\nMEGAGLEST_FONT: " + string (tryFont);
|
||||
}
|
||||
strInternalInfo +=
|
||||
"\nforceLegacyFonts: " + boolToStr (Font::forceLegacyFonts);
|
||||
strInternalInfo +=
|
||||
"\nrenderText3DEnabled: " + boolToStr (Renderer::renderText3DEnabled);
|
||||
strInternalInfo +=
|
||||
"\nuseTextureCompression: " +
|
||||
boolToStr (Texture::useTextureCompression);
|
||||
strInternalInfo +=
|
||||
"\nfontIsRightToLeft: " + boolToStr (Font::fontIsRightToLeft);
|
||||
strInternalInfo +=
|
||||
"\nscaleFontValue: " + floatToStr (Font::scaleFontValue);
|
||||
strInternalInfo +=
|
||||
"\nscaleFontValueCenterHFactor: " +
|
||||
floatToStr (Font::scaleFontValueCenterHFactor);
|
||||
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
|
||||
strInternalInfo +=
|
||||
"\nAllowAltEnterFullscreenToggle: " +
|
||||
boolToStr (Window::getAllowAltEnterFullscreenToggle ());
|
||||
strInternalInfo +=
|
||||
"\nTryVSynch: " + boolToStr (Window::getTryVSynch ());
|
||||
strInternalInfo +=
|
||||
"\nVERBOSE_MODE_ENABLED: " +
|
||||
boolToStr (SystemFlags::VERBOSE_MODE_ENABLED);
|
||||
labelInternalInfo.setText (strInternalInfo);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::mouseMove(int x, int y, const MouseState *ms){
|
||||
buttonReturn.mouseMove(x, y);
|
||||
}
|
||||
void MenuStateGraphicInfo::reloadUI ()
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
void MenuStateGraphicInfo::render(){
|
||||
console.resetFonts ();
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
//Lang &lang= Lang::getInstance();
|
||||
labelMoreInfo.setFont (CoreData::getInstance ().getDisplayFontSmall ());
|
||||
labelMoreInfo.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
renderer.renderButton(&buttonReturn);
|
||||
renderer.renderLabel(&labelInfo);
|
||||
renderer.renderLabel(&labelInternalInfo);
|
||||
renderer.renderLabel(&labelMoreInfo);
|
||||
labelInternalInfo.setFont (CoreData::getInstance ().
|
||||
getDisplayFontSmall ());
|
||||
labelInternalInfo.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
renderer.renderConsole(&console);
|
||||
}
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
void MenuStateGraphicInfo::keyDown(SDL_KeyboardEvent key) {
|
||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
//if(key == configKeys.getCharKey("SaveGUILayout")) {
|
||||
if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),key) == true) {
|
||||
GraphicComponent::saveAllCustomProperties(containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
}
|
||||
string glInfo = renderer.getGlInfo ();
|
||||
string glMoreInfo = renderer.getGlMoreInfo ();
|
||||
labelInfo.setText (glInfo);
|
||||
labelMoreInfo.setText (glMoreInfo);
|
||||
|
||||
}}//end namespace
|
||||
string strInternalInfo = "";
|
||||
strInternalInfo += "VBOSupported: " + boolToStr (getVBOSupported ());
|
||||
if (getenv ("MEGAGLEST_FONT") != NULL)
|
||||
{
|
||||
char *tryFont = getenv ("MEGAGLEST_FONT");
|
||||
strInternalInfo += "\nMEGAGLEST_FONT: " + string (tryFont);
|
||||
}
|
||||
strInternalInfo +=
|
||||
"\nforceLegacyFonts: " + boolToStr (Font::forceLegacyFonts);
|
||||
strInternalInfo +=
|
||||
"\nrenderText3DEnabled: " + boolToStr (Renderer::renderText3DEnabled);
|
||||
strInternalInfo +=
|
||||
"\nuseTextureCompression: " +
|
||||
boolToStr (Texture::useTextureCompression);
|
||||
strInternalInfo +=
|
||||
"\nfontIsRightToLeft: " + boolToStr (Font::fontIsRightToLeft);
|
||||
strInternalInfo +=
|
||||
"\nscaleFontValue: " + floatToStr (Font::scaleFontValue);
|
||||
strInternalInfo +=
|
||||
"\nscaleFontValueCenterHFactor: " +
|
||||
floatToStr (Font::scaleFontValueCenterHFactor);
|
||||
strInternalInfo += "\nlangHeightText: " + Font::langHeightText;
|
||||
strInternalInfo +=
|
||||
"\nAllowAltEnterFullscreenToggle: " +
|
||||
boolToStr (Window::getAllowAltEnterFullscreenToggle ());
|
||||
strInternalInfo +=
|
||||
"\nTryVSynch: " + boolToStr (Window::getTryVSynch ());
|
||||
strInternalInfo +=
|
||||
"\nVERBOSE_MODE_ENABLED: " +
|
||||
boolToStr (SystemFlags::VERBOSE_MODE_ENABLED);
|
||||
labelInternalInfo.setText (strInternalInfo);
|
||||
|
||||
GraphicComponent::
|
||||
reloadFontsForRegisterGraphicComponents (containerName);
|
||||
}
|
||||
|
||||
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 MenuStateOptionsGraphics (program, mainMenu));
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::mouseMove (int x, int y, const MouseState * ms)
|
||||
{
|
||||
buttonReturn.mouseMove (x, y);
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::render ()
|
||||
{
|
||||
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
//Lang &lang= Lang::getInstance();
|
||||
|
||||
renderer.renderButton (&buttonReturn);
|
||||
renderer.renderLabel (&labelInfo);
|
||||
renderer.renderLabel (&labelInternalInfo);
|
||||
renderer.renderLabel (&labelMoreInfo);
|
||||
|
||||
renderer.renderConsole (&console);
|
||||
}
|
||||
|
||||
void MenuStateGraphicInfo::keyDown (SDL_KeyboardEvent key)
|
||||
{
|
||||
Config & configKeys =
|
||||
Config::getInstance (std::pair < ConfigType,
|
||||
ConfigType > (cfgMainKeys, cfgUserKeys));
|
||||
//if(key == configKeys.getCharKey("SaveGUILayout")) {
|
||||
if (isKeyPressed (configKeys.getSDLKey ("SaveGUILayout"), key) == true)
|
||||
{
|
||||
GraphicComponent::saveAllCustomProperties (containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} //end namespace
|
||||
|
@ -1,50 +1,69 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEGRAPHICINFO_H_
|
||||
#define _GLEST_GAME_MENUSTATEGRAPHICINFO_H_
|
||||
# define _GLEST_GAME_MENUSTATEGRAPHICINFO_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Graphics::Gl;
|
||||
using namespace
|
||||
Shared::Graphics::Gl;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace
|
||||
Glest
|
||||
{
|
||||
namespace
|
||||
Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateGraphicInfo
|
||||
// class MenuStateGraphicInfo
|
||||
// ===============================
|
||||
|
||||
class MenuStateGraphicInfo: public MenuState {
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicLabel labelMoreInfo;
|
||||
class
|
||||
MenuStateGraphicInfo:
|
||||
public
|
||||
MenuState
|
||||
{
|
||||
private:
|
||||
GraphicButton
|
||||
buttonReturn;
|
||||
GraphicLabel
|
||||
labelInfo;
|
||||
GraphicLabel
|
||||
labelMoreInfo;
|
||||
|
||||
GraphicLabel labelInternalInfo;
|
||||
GraphicLabel
|
||||
labelInternalInfo;
|
||||
|
||||
//string glInfo;
|
||||
//string glMoreInfo;
|
||||
//string glInfo;
|
||||
//string glMoreInfo;
|
||||
|
||||
public:
|
||||
MenuStateGraphicInfo(Program *program, MainMenu *mainMenu);
|
||||
public:
|
||||
MenuStateGraphicInfo (Program * program, MainMenu * mainMenu);
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
void
|
||||
mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void
|
||||
mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void
|
||||
render ();
|
||||
virtual void
|
||||
keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
virtual void reloadUI();
|
||||
};
|
||||
virtual void
|
||||
reloadUI ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,99 +1,129 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEJOINGAME_H_
|
||||
#define _GLEST_GAME_MENUSTATEJOINGAME_H_
|
||||
# define _GLEST_GAME_MENUSTATEJOINGAME_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "properties.h"
|
||||
#include "main_menu.h"
|
||||
#include "chat_manager.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include "leak_dumper.h"
|
||||
# include "properties.h"
|
||||
# include "main_menu.h"
|
||||
# include "chat_manager.h"
|
||||
# include <vector>
|
||||
# include <string>
|
||||
# include "leak_dumper.h"
|
||||
|
||||
using Shared::Util::Properties;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
class NetworkMessageIntro;
|
||||
class NetworkMessageIntro;
|
||||
|
||||
// ===============================
|
||||
// class MenuStateJoinGame
|
||||
// class MenuStateJoinGame
|
||||
// ===============================
|
||||
|
||||
class MenuStateJoinGame: public MenuState, public DiscoveredServersInterface {
|
||||
private:
|
||||
static const int newServerIndex;
|
||||
static const int newPrevServerIndex;
|
||||
static const int foundServersIndex;
|
||||
static const string serverFileName;
|
||||
class MenuStateJoinGame:
|
||||
public MenuState, public DiscoveredServersInterface
|
||||
{
|
||||
private:
|
||||
static const int
|
||||
newServerIndex;
|
||||
static const int
|
||||
newPrevServerIndex;
|
||||
static const int
|
||||
foundServersIndex;
|
||||
static const
|
||||
string
|
||||
serverFileName;
|
||||
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonConnect;
|
||||
GraphicButton buttonAutoFindServers;
|
||||
GraphicButton buttonCreateGame;
|
||||
private:
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonConnect;
|
||||
GraphicButton buttonAutoFindServers;
|
||||
GraphicButton buttonCreateGame;
|
||||
|
||||
GraphicLabel labelServer;
|
||||
GraphicLabel labelServerType;
|
||||
GraphicLabel labelServerIp;
|
||||
GraphicLabel labelStatus;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicListBox listBoxServerType;
|
||||
GraphicListBox listBoxServers;
|
||||
GraphicListBox listBoxFoundServers;
|
||||
GraphicLabel labelServerPort;
|
||||
GraphicLabel labelServerPortLabel;
|
||||
GraphicLabel labelServer;
|
||||
GraphicLabel labelServerType;
|
||||
GraphicLabel labelServerIp;
|
||||
GraphicLabel labelStatus;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicListBox listBoxServerType;
|
||||
GraphicListBox listBoxServers;
|
||||
GraphicListBox listBoxFoundServers;
|
||||
GraphicLabel labelServerPort;
|
||||
GraphicLabel labelServerPortLabel;
|
||||
|
||||
|
||||
bool connected;
|
||||
int playerIndex;
|
||||
Properties servers;
|
||||
bool connected;
|
||||
int
|
||||
playerIndex;
|
||||
Properties servers;
|
||||
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
//Console console;
|
||||
ChatManager chatManager;
|
||||
|
||||
string serversSavedFile;
|
||||
bool abortAutoFind;
|
||||
bool autoConnectToServer;
|
||||
string serversSavedFile;
|
||||
bool abortAutoFind;
|
||||
bool autoConnectToServer;
|
||||
|
||||
public:
|
||||
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool connect= false, Ip serverIp= Ip(),int portNumberOverride=-1);
|
||||
MenuStateJoinGame(Program *program, MainMenu *mainMenu, bool *autoFindHost);
|
||||
virtual ~MenuStateJoinGame();
|
||||
public:
|
||||
MenuStateJoinGame (Program * program, MainMenu * mainMenu,
|
||||
bool connect = false, Ip serverIp =
|
||||
Ip (), int portNumberOverride = -1);
|
||||
MenuStateJoinGame (Program * program, MainMenu * mainMenu,
|
||||
bool * autoFindHost);
|
||||
virtual ~ MenuStateJoinGame ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
void
|
||||
mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void
|
||||
mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void
|
||||
render ();
|
||||
void
|
||||
update ();
|
||||
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual
|
||||
bool
|
||||
textInput (std::string text);
|
||||
virtual void
|
||||
keyDown (SDL_KeyboardEvent key);
|
||||
virtual void
|
||||
keyPress (SDL_KeyboardEvent c);
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
||||
virtual
|
||||
bool
|
||||
isInSpecialKeyCaptureEvent ()
|
||||
{
|
||||
return chatManager.getEditEnabled ();
|
||||
}
|
||||
|
||||
void reloadUI();
|
||||
void
|
||||
reloadUI ();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void CommonInit(bool connect, Ip serverIp,int portNumberOverride);
|
||||
bool connectToServer();
|
||||
virtual void DiscoveredServers(std::vector<string> serverList);
|
||||
};
|
||||
}}//end namespace
|
||||
void
|
||||
CommonInit (bool connect, Ip serverIp, int portNumberOverride);
|
||||
bool connectToServer ();
|
||||
virtual void
|
||||
DiscoveredServers (std::vector < string > serverList);
|
||||
};
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,97 +1,106 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2011- by Titus Tscharntke
|
||||
// Copyright (C) 2011- by Titus Tscharntke
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEKEYSETUP_H_
|
||||
#define _GLEST_GAME_MENUSTATEKEYSETUP_H_
|
||||
# define _GLEST_GAME_MENUSTATEKEYSETUP_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "server_line.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "server_line.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class
|
||||
// class
|
||||
// ===============================
|
||||
typedef vector<GraphicButton*> UserButtons;
|
||||
typedef vector<GraphicLabel*> GraphicLabels;
|
||||
typedef vector < GraphicButton * >UserButtons;
|
||||
typedef vector < GraphicLabel * >GraphicLabels;
|
||||
|
||||
class MenuStateKeysetup: public MenuState {
|
||||
class MenuStateKeysetup:public MenuState
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonDefaults;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonDefaults;
|
||||
GraphicButton buttonReturn;
|
||||
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
|
||||
GraphicLabel labelTitle;
|
||||
GraphicLabel labelTitle;
|
||||
|
||||
GraphicScrollBar keyScrollBar;
|
||||
UserButtons keyButtons;
|
||||
GraphicLabels labels;
|
||||
int keyButtonsToRender;
|
||||
int keyButtonsYBase;
|
||||
int keyButtonsXBase;
|
||||
int keyButtonsLineHeight;
|
||||
int keyButtonsHeight;
|
||||
int keyButtonsWidth;
|
||||
GraphicScrollBar keyScrollBar;
|
||||
UserButtons keyButtons;
|
||||
GraphicLabels labels;
|
||||
int keyButtonsToRender;
|
||||
int keyButtonsYBase;
|
||||
int keyButtonsXBase;
|
||||
int keyButtonsLineHeight;
|
||||
int keyButtonsHeight;
|
||||
int keyButtonsWidth;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
vector<pair<string,string> > mergedProperties;
|
||||
vector<pair<string,string> > masterProperties;
|
||||
vector<pair<string,string> > userProperties;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
vector < pair < string, string > >mergedProperties;
|
||||
vector < pair < string, string > >masterProperties;
|
||||
vector < pair < string, string > >userProperties;
|
||||
|
||||
int hotkeyIndex;
|
||||
//char hotkeyChar;
|
||||
SDL_Keycode hotkeyChar;
|
||||
int hotkeyIndex;
|
||||
//char hotkeyChar;
|
||||
SDL_Keycode hotkeyChar;
|
||||
|
||||
GraphicLabel labelTestTitle;
|
||||
GraphicLabel labelTestValue;
|
||||
GraphicLabel labelTestTitle;
|
||||
GraphicLabel labelTestValue;
|
||||
|
||||
ProgramState **parentUI;
|
||||
ProgramState **parentUI;
|
||||
|
||||
public:
|
||||
MenuStateKeysetup(Program *program, MainMenu *mainMenu, ProgramState **parentUI=NULL);
|
||||
virtual ~MenuStateKeysetup();
|
||||
public:
|
||||
MenuStateKeysetup (Program * program, MainMenu * mainMenu,
|
||||
ProgramState ** parentUI = NULL);
|
||||
virtual ~ MenuStateKeysetup ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseUp(int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void update();
|
||||
void render();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseUp (int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void update ();
|
||||
void render ();
|
||||
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual void keyUp(SDL_KeyboardEvent key);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
virtual void keyUp (SDL_KeyboardEvent key);
|
||||
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return true; }
|
||||
virtual bool isInSpecialKeyCaptureEvent ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//static void setDisplayMessageFunction(DisplayMessageFunction pDisplayMessage) { pCB_DisplayMessage = pDisplayMessage; }
|
||||
//static void setDisplayMessageFunction(DisplayMessageFunction pDisplayMessage) { pCB_DisplayMessage = pDisplayMessage; }
|
||||
|
||||
void reloadUI();
|
||||
void reloadUI ();
|
||||
|
||||
private:
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void clearUserButtons();
|
||||
void cleanup();
|
||||
};
|
||||
private:
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void clearUserButtons ();
|
||||
void cleanup ();
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,80 +1,85 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATELOADGAME_H_
|
||||
#define _GLEST_GAME_MENUSTATELOADGAME_H_
|
||||
# define _GLEST_GAME_MENUSTATELOADGAME_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateLoadGame
|
||||
// class MenuStateLoadGame
|
||||
// ===============================
|
||||
//typedef vector<GraphicButton*> SaveSlotButtons;
|
||||
class MenuStateLoadGame: public MenuState{
|
||||
private:
|
||||
GraphicButton loadButton;
|
||||
GraphicButton deleteButton;
|
||||
GraphicButton abortButton;
|
||||
vector<GraphicButton*> slots;
|
||||
vector<GraphicComponent*> slotsGB;
|
||||
vector<string> filenames;
|
||||
GraphicScrollBar slotsScrollBar;
|
||||
GraphicButton* selectedButton;
|
||||
class MenuStateLoadGame:public MenuState
|
||||
{
|
||||
private:
|
||||
GraphicButton loadButton;
|
||||
GraphicButton deleteButton;
|
||||
GraphicButton abortButton;
|
||||
vector < GraphicButton * >slots;
|
||||
vector < GraphicComponent * >slotsGB;
|
||||
vector < string > filenames;
|
||||
GraphicScrollBar slotsScrollBar;
|
||||
GraphicButton *selectedButton;
|
||||
|
||||
GraphicButton* buttonToDelete;
|
||||
GraphicButton *buttonToDelete;
|
||||
|
||||
Texture2D *previewTexture;
|
||||
Texture2D *previewTexture;
|
||||
|
||||
GraphicLabel headerLabel;
|
||||
GraphicLabel noSavedGamesLabel;
|
||||
GraphicLabel savedGamesLabel;
|
||||
GraphicLabel infoHeaderLabel;
|
||||
GraphicLabel infoTextLabel;
|
||||
GraphicLabel versionWarningLabel;
|
||||
GraphicLabel headerLabel;
|
||||
GraphicLabel noSavedGamesLabel;
|
||||
GraphicLabel savedGamesLabel;
|
||||
GraphicLabel infoHeaderLabel;
|
||||
GraphicLabel infoTextLabel;
|
||||
GraphicLabel versionWarningLabel;
|
||||
|
||||
GraphicLine lines[2];
|
||||
GraphicLine lines[2];
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
|
||||
string saveGameDir;
|
||||
int slotLinesYBase;
|
||||
int slotsLineHeight;
|
||||
string saveGameDir;
|
||||
int slotLinesYBase;
|
||||
int slotsLineHeight;
|
||||
|
||||
public:
|
||||
MenuStateLoadGame(Program *program, MainMenu *mainMenu);
|
||||
~MenuStateLoadGame();
|
||||
public:
|
||||
MenuStateLoadGame (Program * program, MainMenu * mainMenu);
|
||||
~MenuStateLoadGame ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseUp(int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void update();
|
||||
void render();
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseUp (int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void update ();
|
||||
void render ();
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
void reloadUI();
|
||||
void reloadUI ();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void clearSlots();
|
||||
void listFiles();
|
||||
void clearSlots ();
|
||||
void listFiles ();
|
||||
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
|
||||
void cleanupTexture(Texture2D **texture);
|
||||
};
|
||||
void cleanupTexture (Texture2D ** texture);
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,151 +1,166 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEMASTERSERVER_H_
|
||||
#define _GLEST_GAME_MENUSTATEMASTERSERVER_H_
|
||||
# define _GLEST_GAME_MENUSTATEMASTERSERVER_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "server_line.h"
|
||||
#include "masterserver_info.h"
|
||||
#include "simple_threads.h"
|
||||
#include "network_interface.h"
|
||||
#include "ircclient.h"
|
||||
#include "chat_manager.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "server_line.h"
|
||||
# include "masterserver_info.h"
|
||||
# include "simple_threads.h"
|
||||
# include "network_interface.h"
|
||||
# include "ircclient.h"
|
||||
# include "chat_manager.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateMasterserver
|
||||
// class MenuStateMasterserver
|
||||
// ===============================
|
||||
typedef vector<ServerLine*> ServerLines;
|
||||
typedef vector<GraphicButton*> UserButtons;
|
||||
typedef vector<MasterServerInfo*> MasterServerInfos;
|
||||
typedef vector < ServerLine * >ServerLines;
|
||||
typedef vector < GraphicButton * >UserButtons;
|
||||
typedef vector < MasterServerInfo * >MasterServerInfos;
|
||||
|
||||
class MenuStateMasterserver : public MenuState, public SimpleTaskCallbackInterface, public IRCCallbackInterface {
|
||||
class MenuStateMasterserver:public MenuState,
|
||||
public SimpleTaskCallbackInterface, public IRCCallbackInterface
|
||||
{
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
GraphicButton buttonRefresh;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonCreateGame;
|
||||
GraphicLabel labelAutoRefresh;
|
||||
GraphicListBox listBoxAutoRefresh;
|
||||
GraphicLabel labelTitle;
|
||||
GraphicButton buttonRefresh;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonCreateGame;
|
||||
GraphicLabel labelAutoRefresh;
|
||||
GraphicListBox listBoxAutoRefresh;
|
||||
GraphicLabel labelTitle;
|
||||
|
||||
GraphicLabel announcementLabel;
|
||||
GraphicLabel versionInfoLabel;
|
||||
GraphicLabel announcementLabel;
|
||||
GraphicLabel versionInfoLabel;
|
||||
|
||||
GraphicLine lines[3];
|
||||
GraphicLine lines[3];
|
||||
|
||||
GraphicLabel glestVersionLabel;
|
||||
GraphicLabel platformLabel;
|
||||
//GraphicLabel binaryCompileDateLabel;
|
||||
GraphicLabel glestVersionLabel;
|
||||
GraphicLabel platformLabel;
|
||||
//GraphicLabel binaryCompileDateLabel;
|
||||
|
||||
//game info:
|
||||
GraphicLabel serverTitleLabel;
|
||||
GraphicLabel countryLabel;
|
||||
GraphicLabel statusLabel;
|
||||
//game info:
|
||||
GraphicLabel serverTitleLabel;
|
||||
GraphicLabel countryLabel;
|
||||
GraphicLabel statusLabel;
|
||||
|
||||
GraphicLabel ipAddressLabel;
|
||||
GraphicLabel ipAddressLabel;
|
||||
|
||||
//game setup info:
|
||||
GraphicLabel techLabel;
|
||||
GraphicLabel mapLabel;
|
||||
GraphicLabel tilesetLabel;
|
||||
GraphicLabel activeSlotsLabel;
|
||||
//game setup info:
|
||||
GraphicLabel techLabel;
|
||||
GraphicLabel mapLabel;
|
||||
GraphicLabel tilesetLabel;
|
||||
GraphicLabel activeSlotsLabel;
|
||||
|
||||
GraphicLabel externalConnectPort;
|
||||
GraphicLabel externalConnectPort;
|
||||
|
||||
GraphicLabel selectButton;
|
||||
GraphicLabel selectButton;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
GraphicLabel ircOnlinePeopleLabel;
|
||||
GraphicLabel ircOnlinePeopleStatusLabel;
|
||||
GraphicLabel ircOnlinePeopleLabel;
|
||||
GraphicLabel ircOnlinePeopleStatusLabel;
|
||||
|
||||
bool announcementLoaded;
|
||||
bool needUpdateFromServer;
|
||||
int autoRefreshTime;
|
||||
time_t lastRefreshTimer;
|
||||
SimpleTaskThread *updateFromMasterserverThread;
|
||||
bool playServerFoundSound;
|
||||
ServerLines serverLines;
|
||||
string serverInfoString;
|
||||
int serverLinesToRender;
|
||||
int serverLinesYBase;
|
||||
int serverLinesLineHeight;
|
||||
GraphicScrollBar userScrollBar;
|
||||
GraphicScrollBar serverScrollBar;
|
||||
UserButtons userButtons;
|
||||
UserButtons userButtonsToRemove;
|
||||
int userButtonsToRender;
|
||||
int userButtonsYBase;
|
||||
int userButtonsXBase;
|
||||
int userButtonsLineHeight;
|
||||
int userButtonsHeight;
|
||||
int userButtonsWidth;
|
||||
string currentIrcNick;
|
||||
bool announcementLoaded;
|
||||
bool needUpdateFromServer;
|
||||
int autoRefreshTime;
|
||||
time_t lastRefreshTimer;
|
||||
SimpleTaskThread *updateFromMasterserverThread;
|
||||
bool playServerFoundSound;
|
||||
ServerLines serverLines;
|
||||
string serverInfoString;
|
||||
int serverLinesToRender;
|
||||
int serverLinesYBase;
|
||||
int serverLinesLineHeight;
|
||||
GraphicScrollBar userScrollBar;
|
||||
GraphicScrollBar serverScrollBar;
|
||||
UserButtons userButtons;
|
||||
UserButtons userButtonsToRemove;
|
||||
int userButtonsToRender;
|
||||
int userButtonsYBase;
|
||||
int userButtonsXBase;
|
||||
int userButtonsLineHeight;
|
||||
int userButtonsHeight;
|
||||
int userButtonsWidth;
|
||||
string currentIrcNick;
|
||||
|
||||
|
||||
//Console console;
|
||||
//Console console;
|
||||
|
||||
static DisplayMessageFunction pCB_DisplayMessage;
|
||||
std::string threadedErrorMsg;
|
||||
static DisplayMessageFunction pCB_DisplayMessage;
|
||||
std::string threadedErrorMsg;
|
||||
|
||||
std::vector<string> ircArgs;
|
||||
Mutex *mutexIRCClient;
|
||||
IRCThread *ircClient;
|
||||
std::vector<string> oldNickList;
|
||||
std::vector < string > ircArgs;
|
||||
Mutex *mutexIRCClient;
|
||||
IRCThread *ircClient;
|
||||
std::vector < string > oldNickList;
|
||||
|
||||
Console consoleIRC;
|
||||
ChatManager chatManager;
|
||||
Console consoleIRC;
|
||||
ChatManager chatManager;
|
||||
|
||||
bool masterserverParseErrorShown;
|
||||
bool masterserverParseErrorShown;
|
||||
|
||||
public:
|
||||
MenuStateMasterserver(Program *program, MainMenu *mainMenu);
|
||||
~MenuStateMasterserver();
|
||||
public:
|
||||
MenuStateMasterserver (Program * program, MainMenu * mainMenu);
|
||||
~MenuStateMasterserver ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseUp(int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void update();
|
||||
void render();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseUp (int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void update ();
|
||||
void render ();
|
||||
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual bool textInput (std::string text);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
virtual void simpleTask(BaseThread *callingThread,void *userdata);
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
||||
virtual void simpleTask (BaseThread * callingThread, void *userdata);
|
||||
virtual bool isInSpecialKeyCaptureEvent ()
|
||||
{
|
||||
return chatManager.getEditEnabled ();
|
||||
}
|
||||
|
||||
static void setDisplayMessageFunction(DisplayMessageFunction pDisplayMessage) { pCB_DisplayMessage = pDisplayMessage; }
|
||||
static void setDisplayMessageFunction (DisplayMessageFunction
|
||||
pDisplayMessage)
|
||||
{
|
||||
pCB_DisplayMessage = pDisplayMessage;
|
||||
}
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
private:
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
bool connectToServer(string ipString, int port);
|
||||
//void setConsolePos(int yPos);
|
||||
void setButtonLinePosition(int pos);
|
||||
void clearServerLines();
|
||||
void clearUserButtons();
|
||||
void rebuildServerLines(const string &serverInfo);
|
||||
void cleanup();
|
||||
virtual void IRC_CallbackEvent(IRCEventType evt, const char* origin, const char **params, unsigned int count);
|
||||
private:
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
bool connectToServer (string ipString, int port);
|
||||
//void setConsolePos(int yPos);
|
||||
void setButtonLinePosition (int pos);
|
||||
void clearServerLines ();
|
||||
void clearUserButtons ();
|
||||
void rebuildServerLines (const string & serverInfo);
|
||||
void cleanup ();
|
||||
virtual void IRC_CallbackEvent (IRCEventType evt, const char *origin,
|
||||
const char **params,
|
||||
unsigned int count);
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,220 +1,230 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2011 Mark Vejvoda
|
||||
// Copyright (C) 2011 Mark Vejvoda
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef MENU_STATE_MODS_H_
|
||||
#define MENU_STATE_MODS_H_
|
||||
# define MENU_STATE_MODS_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "map_preview.h"
|
||||
#include "miniftpclient.h"
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "map_preview.h"
|
||||
# include "miniftpclient.h"
|
||||
# include <map>
|
||||
# include <vector>
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest { namespace Game {
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
enum FTPMessageType {
|
||||
ftpmsg_None,
|
||||
ftpmsg_GetMap,
|
||||
ftpmsg_GetTileset,
|
||||
ftpmsg_GetTechtree,
|
||||
ftpmsg_GetScenario,
|
||||
enum FTPMessageType
|
||||
{
|
||||
ftpmsg_None,
|
||||
ftpmsg_GetMap,
|
||||
ftpmsg_GetTileset,
|
||||
ftpmsg_GetTechtree,
|
||||
ftpmsg_GetScenario,
|
||||
|
||||
ftpmsg_ReplaceMap,
|
||||
ftpmsg_ReplaceTileset,
|
||||
ftpmsg_ReplaceTechtree,
|
||||
ftpmsg_ReplaceScenario,
|
||||
ftpmsg_ReplaceMap,
|
||||
ftpmsg_ReplaceTileset,
|
||||
ftpmsg_ReplaceTechtree,
|
||||
ftpmsg_ReplaceScenario,
|
||||
|
||||
ftpmsg_Quit
|
||||
};
|
||||
ftpmsg_Quit
|
||||
};
|
||||
|
||||
enum ModMenuState {
|
||||
mmst_None,
|
||||
mmst_Loading,
|
||||
mmst_CalculatingCRC
|
||||
};
|
||||
enum ModMenuState
|
||||
{
|
||||
mmst_None,
|
||||
mmst_Loading,
|
||||
mmst_CalculatingCRC
|
||||
};
|
||||
|
||||
typedef vector<GraphicButton*> UserButtons;
|
||||
typedef vector<GraphicLabel*> GraphicLabels;
|
||||
typedef vector < GraphicButton * >UserButtons;
|
||||
typedef vector < GraphicLabel * >GraphicLabels;
|
||||
|
||||
// ===============================
|
||||
// class MenuStateMods
|
||||
// class MenuStateMods
|
||||
// ===============================
|
||||
class MenuStateMods: public MenuState, public FTPClientCallbackInterface, public SimpleTaskCallbackInterface {
|
||||
private:
|
||||
class MenuStateMods:public MenuState, public FTPClientCallbackInterface,
|
||||
public SimpleTaskCallbackInterface
|
||||
{
|
||||
private:
|
||||
|
||||
GraphicButton buttonReturn;
|
||||
GraphicLine lineHorizontal;
|
||||
GraphicLine lineVertical;
|
||||
GraphicLine lineReturn;
|
||||
GraphicLine lineVerticalReturn;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicLine lineHorizontal;
|
||||
GraphicLine lineVertical;
|
||||
GraphicLine lineReturn;
|
||||
GraphicLine lineVerticalReturn;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
FTPMessageType mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
FTPMessageType mainMessageBoxState;
|
||||
|
||||
int techInfoXPos;
|
||||
int mapInfoXPos;
|
||||
int tilesetInfoXPos;
|
||||
int scenarioInfoXPos;
|
||||
int labelWidth;
|
||||
int scrollListsYPos;
|
||||
int listBoxLength;
|
||||
int techInfoXPos;
|
||||
int mapInfoXPos;
|
||||
int tilesetInfoXPos;
|
||||
int scenarioInfoXPos;
|
||||
int labelWidth;
|
||||
int scrollListsYPos;
|
||||
int listBoxLength;
|
||||
|
||||
GraphicButton buttonInstallTech;
|
||||
GraphicButton buttonRemoveTech;
|
||||
GraphicLabel keyTechScrollBarTitle1;
|
||||
GraphicLabel keyTechScrollBarTitle2;
|
||||
GraphicScrollBar keyTechScrollBar;
|
||||
UserButtons keyTechButtons;
|
||||
GraphicLabels labelsTech;
|
||||
GraphicButton buttonInstallTech;
|
||||
GraphicButton buttonRemoveTech;
|
||||
GraphicLabel keyTechScrollBarTitle1;
|
||||
GraphicLabel keyTechScrollBarTitle2;
|
||||
GraphicScrollBar keyTechScrollBar;
|
||||
UserButtons keyTechButtons;
|
||||
GraphicLabels labelsTech;
|
||||
|
||||
GraphicButton buttonInstallTileset;
|
||||
GraphicButton buttonRemoveTileset;
|
||||
GraphicLabel keyTilesetScrollBarTitle1;
|
||||
GraphicScrollBar keyTilesetScrollBar;
|
||||
UserButtons keyTilesetButtons;
|
||||
GraphicButton buttonInstallTileset;
|
||||
GraphicButton buttonRemoveTileset;
|
||||
GraphicLabel keyTilesetScrollBarTitle1;
|
||||
GraphicScrollBar keyTilesetScrollBar;
|
||||
UserButtons keyTilesetButtons;
|
||||
|
||||
GraphicButton buttonInstallMap;
|
||||
GraphicButton buttonRemoveMap;
|
||||
GraphicLabel keyMapScrollBarTitle1;
|
||||
GraphicLabel keyMapScrollBarTitle2;
|
||||
GraphicScrollBar keyMapScrollBar;
|
||||
UserButtons keyMapButtons;
|
||||
GraphicLabels labelsMap;
|
||||
GraphicButton buttonInstallMap;
|
||||
GraphicButton buttonRemoveMap;
|
||||
GraphicLabel keyMapScrollBarTitle1;
|
||||
GraphicLabel keyMapScrollBarTitle2;
|
||||
GraphicScrollBar keyMapScrollBar;
|
||||
UserButtons keyMapButtons;
|
||||
GraphicLabels labelsMap;
|
||||
|
||||
GraphicButton buttonInstallScenario;
|
||||
GraphicButton buttonRemoveScenario;
|
||||
GraphicLabel keyScenarioScrollBarTitle1;
|
||||
GraphicLabel keyScenarioScrollBarTitle2;
|
||||
GraphicScrollBar keyScenarioScrollBar;
|
||||
UserButtons keyScenarioButtons;
|
||||
GraphicButton buttonInstallScenario;
|
||||
GraphicButton buttonRemoveScenario;
|
||||
GraphicLabel keyScenarioScrollBarTitle1;
|
||||
GraphicLabel keyScenarioScrollBarTitle2;
|
||||
GraphicScrollBar keyScenarioScrollBar;
|
||||
UserButtons keyScenarioButtons;
|
||||
|
||||
GraphicLabel modDescrLabel;
|
||||
Texture2D *modPreviewImage;
|
||||
ModInfo *modInfoSelected;
|
||||
map<string,bool> displayModPreviewImage;
|
||||
GraphicLabel modDescrLabel;
|
||||
Texture2D *modPreviewImage;
|
||||
ModInfo *modInfoSelected;
|
||||
map < string, bool > displayModPreviewImage;
|
||||
|
||||
GraphicButton buttonInstalled;
|
||||
GraphicButton buttonAvailable;
|
||||
GraphicButton buttonConflict;
|
||||
GraphicButton buttonOnlyLocal;
|
||||
GraphicButton buttonInstalled;
|
||||
GraphicButton buttonAvailable;
|
||||
GraphicButton buttonConflict;
|
||||
GraphicButton buttonOnlyLocal;
|
||||
|
||||
GraphicLabel pleaseWaitLabel;
|
||||
ModMenuState modMenuState;
|
||||
ModMenuState oldMenuState;
|
||||
GraphicLabel pleaseWaitLabel;
|
||||
ModMenuState modMenuState;
|
||||
ModMenuState oldMenuState;
|
||||
|
||||
bool enableMapPreview;
|
||||
bool validMapPreview;
|
||||
MapInfo mapInfo;
|
||||
MapPreview mapPreview;
|
||||
Texture2D *mapPreviewTexture;
|
||||
bool enableMapPreview;
|
||||
bool validMapPreview;
|
||||
MapInfo mapInfo;
|
||||
MapPreview mapPreview;
|
||||
Texture2D *mapPreviewTexture;
|
||||
|
||||
int keyButtonsToRender;
|
||||
int keyButtonsYBase;
|
||||
int keyButtonsXBase;
|
||||
int keyButtonsLineHeight;
|
||||
int keyButtonsHeight;
|
||||
int keyButtonsWidth;
|
||||
int keyButtonsWidthTech;
|
||||
int keyButtonsWidthMap;
|
||||
int keyButtonsWidthTil;
|
||||
int keyButtonsWidthScen;
|
||||
int keyButtonsToRender;
|
||||
int keyButtonsYBase;
|
||||
int keyButtonsXBase;
|
||||
int keyButtonsLineHeight;
|
||||
int keyButtonsHeight;
|
||||
int keyButtonsWidth;
|
||||
int keyButtonsWidthTech;
|
||||
int keyButtonsWidthMap;
|
||||
int keyButtonsWidthTil;
|
||||
int keyButtonsWidthScen;
|
||||
|
||||
//Console console;
|
||||
bool showFullConsole;
|
||||
//Console console;
|
||||
bool showFullConsole;
|
||||
|
||||
string selectedTechName;
|
||||
std::vector<std::string> techListRemote;
|
||||
std::map<string, ModInfo> techCacheList;
|
||||
vector<string> techTreeFiles;
|
||||
vector<string> techTreeFilesUserData;
|
||||
string selectedTechName;
|
||||
std::vector < std::string > techListRemote;
|
||||
std::map < string, ModInfo > techCacheList;
|
||||
vector < string > techTreeFiles;
|
||||
vector < string > techTreeFilesUserData;
|
||||
|
||||
string selectedTilesetName;
|
||||
std::vector<std::string> tilesetListRemote;
|
||||
std::map<string, ModInfo> tilesetCacheList;
|
||||
vector<string> tilesetFiles;
|
||||
vector<string> tilesetFilesUserData;
|
||||
string selectedTilesetName;
|
||||
std::vector < std::string > tilesetListRemote;
|
||||
std::map < string, ModInfo > tilesetCacheList;
|
||||
vector < string > tilesetFiles;
|
||||
vector < string > tilesetFilesUserData;
|
||||
|
||||
string selectedMapName;
|
||||
std::vector<std::string> mapListRemote;
|
||||
std::map<string, ModInfo> mapCacheList;
|
||||
vector<string> mapFiles;
|
||||
vector<string> mapFilesUserData;
|
||||
string selectedMapName;
|
||||
std::vector < std::string > mapListRemote;
|
||||
std::map < string, ModInfo > mapCacheList;
|
||||
vector < string > mapFiles;
|
||||
vector < string > mapFilesUserData;
|
||||
|
||||
string selectedScenarioName;
|
||||
std::vector<std::string> scenarioListRemote;
|
||||
std::map<string, ModInfo> scenarioCacheList;
|
||||
vector<string> scenarioFiles;
|
||||
vector<string> scenarioFilesUserData;
|
||||
string selectedScenarioName;
|
||||
std::vector < std::string > scenarioListRemote;
|
||||
std::map < string, ModInfo > scenarioCacheList;
|
||||
vector < string > scenarioFiles;
|
||||
vector < string > scenarioFilesUserData;
|
||||
|
||||
FTPClientThread *ftpClientThread;
|
||||
std::map<string,pair<int,string> > fileFTPProgressList;
|
||||
FTPClientThread *ftpClientThread;
|
||||
std::map < string, pair < int, string > >fileFTPProgressList;
|
||||
|
||||
SimpleTaskThread *modHttpServerThread;
|
||||
SimpleTaskThread *modHttpServerThread;
|
||||
|
||||
void getTechsLocalList();
|
||||
string refreshTechModInfo(string techInfo);
|
||||
void refreshTechs();
|
||||
void getTechsLocalList ();
|
||||
string refreshTechModInfo (string techInfo);
|
||||
void refreshTechs ();
|
||||
|
||||
void getTilesetsLocalList();
|
||||
string refreshTilesetModInfo(string tilesetInfo);
|
||||
void refreshTilesets();
|
||||
void getTilesetsLocalList ();
|
||||
string refreshTilesetModInfo (string tilesetInfo);
|
||||
void refreshTilesets ();
|
||||
|
||||
void getMapsLocalList();
|
||||
string refreshMapModInfo(string mapInfo);
|
||||
void refreshMaps();
|
||||
string getMapCRC(string mapName);
|
||||
void getMapsLocalList ();
|
||||
string refreshMapModInfo (string mapInfo);
|
||||
void refreshMaps ();
|
||||
string getMapCRC (string mapName);
|
||||
|
||||
void getScenariosLocalList();
|
||||
string refreshScenarioModInfo(string scenarioInfo);
|
||||
void refreshScenarios();
|
||||
void getScenariosLocalList ();
|
||||
string refreshScenarioModInfo (string scenarioInfo);
|
||||
void refreshScenarios ();
|
||||
|
||||
void showLocalDescription(string name);
|
||||
void loadMapPreview(string name);
|
||||
void showRemoteDesription(ModInfo *modInfo);
|
||||
void showLocalDescription (string name);
|
||||
void loadMapPreview (string name);
|
||||
void showRemoteDesription (ModInfo * modInfo);
|
||||
|
||||
std::map<string,bool> mapCRCUpdateList;
|
||||
public:
|
||||
std::map < string, bool > mapCRCUpdateList;
|
||||
public:
|
||||
|
||||
MenuStateMods(Program *program, MainMenu *mainMenu);
|
||||
virtual ~MenuStateMods();
|
||||
MenuStateMods (Program * program, MainMenu * mainMenu);
|
||||
virtual ~ MenuStateMods ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseUp(int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseUp (int x, int y, const MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
void update ();
|
||||
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual void keyUp(SDL_KeyboardEvent key);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
virtual void keyUp (SDL_KeyboardEvent key);
|
||||
|
||||
virtual void simpleTask(BaseThread *callingThread,void *userdata);
|
||||
virtual void simpleTask (BaseThread * callingThread, void *userdata);
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void cleanUp();
|
||||
MapInfo loadMapInfo(string file);
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void clearUserButtons();
|
||||
virtual void FTPClient_CallbackEvent(string itemName,
|
||||
FTP_Client_CallbackType type, pair<FTP_Client_ResultType,string> result,void *userdata);
|
||||
void cleanUp ();
|
||||
MapInfo loadMapInfo (string file);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void clearUserButtons ();
|
||||
virtual void FTPClient_CallbackEvent (string itemName,
|
||||
FTP_Client_CallbackType type,
|
||||
pair < FTP_Client_ResultType,
|
||||
string > result, void *userdata);
|
||||
|
||||
string getPreviewImageFileForMod(const ModInfo *modInfo);
|
||||
void cleanupPreviewTexture();
|
||||
void cleanupMapPreviewTexture();
|
||||
};
|
||||
string getPreviewImageFileForMod (const ModInfo * modInfo);
|
||||
void cleanupPreviewTexture ();
|
||||
void cleanupMapPreviewTexture ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif /* MENU_STATE_MODS_H_ */
|
||||
#endif /* MENU_STATE_MODS_H_ */
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_state_new_game.h"
|
||||
@ -28,136 +28,169 @@
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
// =====================================================
|
||||
// class MenuStateNewGame
|
||||
// =====================================================
|
||||
|
||||
MenuStateNewGame::MenuStateNewGame(Program *program, MainMenu *mainMenu):
|
||||
MenuState(program, mainMenu, "root")
|
||||
namespace Glest
|
||||
{
|
||||
containerName = "NewGame";
|
||||
Lang &lang= Lang::getInstance();
|
||||
namespace Game
|
||||
{
|
||||
|
||||
int buttonWidth = 200;
|
||||
int buttonXPosition = (1000 - buttonWidth) / 2;
|
||||
int yPos=465;
|
||||
buttonTutorial.registerGraphicComponent(containerName,"buttonTutorial");
|
||||
buttonTutorial.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonScenario.registerGraphicComponent(containerName,"buttonScenario");
|
||||
buttonScenario.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonCustomGame.registerGraphicComponent(containerName,"buttonCustomGame");
|
||||
buttonCustomGame.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonMasterserverGame.registerGraphicComponent(containerName,"buttonMasterserverGame");
|
||||
buttonMasterserverGame.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonJoinGame.registerGraphicComponent(containerName,"buttonJoinGame");
|
||||
buttonJoinGame.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||
buttonReturn.init(buttonXPosition, yPos, buttonWidth);
|
||||
// =====================================================
|
||||
// class MenuStateNewGame
|
||||
// =====================================================
|
||||
|
||||
buttonCustomGame.setText(lang.getString("CustomGame"));
|
||||
buttonScenario.setText(lang.getString("Scenario"));
|
||||
buttonJoinGame.setText(lang.getString("JoinGame"));
|
||||
buttonMasterserverGame.setText(lang.getString("JoinInternetGame"));
|
||||
buttonTutorial.setText(lang.getString("Tutorial"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
MenuStateNewGame::MenuStateNewGame (Program * program,
|
||||
MainMenu *
|
||||
mainMenu):MenuState (program,
|
||||
mainMenu, "root")
|
||||
{
|
||||
containerName = "NewGame";
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
int buttonWidth = 200;
|
||||
int buttonXPosition = (1000 - buttonWidth) / 2;
|
||||
int yPos = 465;
|
||||
buttonTutorial.registerGraphicComponent (containerName,
|
||||
"buttonTutorial");
|
||||
buttonTutorial.init (buttonXPosition, yPos, buttonWidth);
|
||||
yPos -= 40;
|
||||
buttonScenario.registerGraphicComponent (containerName,
|
||||
"buttonScenario");
|
||||
buttonScenario.init (buttonXPosition, yPos, buttonWidth);
|
||||
yPos -= 40;
|
||||
buttonCustomGame.registerGraphicComponent (containerName,
|
||||
"buttonCustomGame");
|
||||
buttonCustomGame.init (buttonXPosition, yPos, buttonWidth);
|
||||
yPos -= 40;
|
||||
buttonMasterserverGame.registerGraphicComponent (containerName,
|
||||
"buttonMasterserverGame");
|
||||
buttonMasterserverGame.init (buttonXPosition, yPos, buttonWidth);
|
||||
yPos -= 40;
|
||||
buttonJoinGame.registerGraphicComponent (containerName,
|
||||
"buttonJoinGame");
|
||||
buttonJoinGame.init (buttonXPosition, yPos, buttonWidth);
|
||||
yPos -= 40;
|
||||
buttonReturn.registerGraphicComponent (containerName, "buttonReturn");
|
||||
buttonReturn.init (buttonXPosition, yPos, buttonWidth);
|
||||
|
||||
NetworkManager::getInstance().end();
|
||||
}
|
||||
buttonCustomGame.setText (lang.getString ("CustomGame"));
|
||||
buttonScenario.setText (lang.getString ("Scenario"));
|
||||
buttonJoinGame.setText (lang.getString ("JoinGame"));
|
||||
buttonMasterserverGame.setText (lang.getString ("JoinInternetGame"));
|
||||
buttonTutorial.setText (lang.getString ("Tutorial"));
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
void MenuStateNewGame::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
GraphicComponent::applyAllCustomProperties (containerName);
|
||||
|
||||
buttonCustomGame.setText(lang.getString("CustomGame"));
|
||||
buttonScenario.setText(lang.getString("Scenario"));
|
||||
buttonJoinGame.setText(lang.getString("JoinGame"));
|
||||
buttonMasterserverGame.setText(lang.getString("JoinInternetGame"));
|
||||
buttonTutorial.setText(lang.getString("Tutorial"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
void MenuStateNewGame::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
|
||||
if(buttonCustomGame.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateCustomGame(program, mainMenu));
|
||||
NetworkManager::getInstance ().end ();
|
||||
}
|
||||
else if(buttonScenario.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateScenario(program, mainMenu, false,
|
||||
Config::getInstance().getPathListForType(ptScenarios)));
|
||||
|
||||
void MenuStateNewGame::reloadUI ()
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
buttonCustomGame.setText (lang.getString ("CustomGame"));
|
||||
buttonScenario.setText (lang.getString ("Scenario"));
|
||||
buttonJoinGame.setText (lang.getString ("JoinGame"));
|
||||
buttonMasterserverGame.setText (lang.getString ("JoinInternetGame"));
|
||||
buttonTutorial.setText (lang.getString ("Tutorial"));
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
GraphicComponent::
|
||||
reloadFontsForRegisterGraphicComponents (containerName);
|
||||
}
|
||||
else if(buttonJoinGame.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateJoinGame(program, mainMenu));
|
||||
|
||||
void MenuStateNewGame::mouseClick (int x, int y, MouseButton mouseButton)
|
||||
{
|
||||
|
||||
CoreData & coreData = CoreData::getInstance ();
|
||||
SoundRenderer & soundRenderer = SoundRenderer::getInstance ();
|
||||
|
||||
if (buttonCustomGame.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateCustomGame (program, mainMenu));
|
||||
}
|
||||
else if (buttonScenario.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateScenario (program, mainMenu, false,
|
||||
Config::getInstance ().
|
||||
getPathListForType
|
||||
(ptScenarios)));
|
||||
}
|
||||
else if (buttonJoinGame.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateJoinGame (program, mainMenu));
|
||||
}
|
||||
else if (buttonMasterserverGame.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateMasterserver (program, mainMenu));
|
||||
}
|
||||
else if (buttonTutorial.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateScenario (program, mainMenu, true,
|
||||
Config::getInstance ().
|
||||
getPathListForType
|
||||
(ptTutorials)));
|
||||
}
|
||||
else if (buttonReturn.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundB ());
|
||||
mainMenu->setState (new MenuStateRoot (program, mainMenu));
|
||||
}
|
||||
}
|
||||
else if(buttonMasterserverGame.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateMasterserver(program, mainMenu));
|
||||
|
||||
void MenuStateNewGame::mouseMove (int x, int y, const MouseState * ms)
|
||||
{
|
||||
buttonCustomGame.mouseMove (x, y);
|
||||
buttonScenario.mouseMove (x, y);
|
||||
buttonJoinGame.mouseMove (x, y);
|
||||
buttonMasterserverGame.mouseMove (x, y);
|
||||
buttonTutorial.mouseMove (x, y);
|
||||
buttonReturn.mouseMove (x, y);
|
||||
}
|
||||
else if(buttonTutorial.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateScenario(program, mainMenu, true,
|
||||
Config::getInstance().getPathListForType(ptTutorials)));
|
||||
|
||||
void MenuStateNewGame::render ()
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
renderer.renderButton (&buttonCustomGame);
|
||||
renderer.renderButton (&buttonScenario);
|
||||
renderer.renderButton (&buttonJoinGame);
|
||||
renderer.renderButton (&buttonMasterserverGame);
|
||||
renderer.renderButton (&buttonTutorial);
|
||||
renderer.renderButton (&buttonReturn);
|
||||
|
||||
renderer.renderConsole (&console);
|
||||
if (program != NULL)
|
||||
program->renderProgramMsgBox ();
|
||||
}
|
||||
else if(buttonReturn.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundB());
|
||||
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
||||
|
||||
void MenuStateNewGame::update ()
|
||||
{
|
||||
if (Config::getInstance ().getBool ("AutoTest"))
|
||||
{
|
||||
AutoTest::getInstance ().updateNewGame (program, mainMenu);
|
||||
return;
|
||||
}
|
||||
console.update ();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateNewGame::mouseMove(int x, int y, const MouseState *ms){
|
||||
buttonCustomGame.mouseMove(x, y);
|
||||
buttonScenario.mouseMove(x, y);
|
||||
buttonJoinGame.mouseMove(x, y);
|
||||
buttonMasterserverGame.mouseMove(x, y);
|
||||
buttonTutorial.mouseMove(x, y);
|
||||
buttonReturn.mouseMove(x, y);
|
||||
}
|
||||
void MenuStateNewGame::keyDown (SDL_KeyboardEvent key)
|
||||
{
|
||||
Config & configKeys =
|
||||
Config::getInstance (std::pair < ConfigType,
|
||||
ConfigType > (cfgMainKeys, cfgUserKeys));
|
||||
//if(key == configKeys.getCharKey("SaveGUILayout")) {
|
||||
if (isKeyPressed (configKeys.getSDLKey ("SaveGUILayout"), key) == true)
|
||||
{
|
||||
GraphicComponent::saveAllCustomProperties (containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateNewGame::render(){
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
|
||||
renderer.renderButton(&buttonCustomGame);
|
||||
renderer.renderButton(&buttonScenario);
|
||||
renderer.renderButton(&buttonJoinGame);
|
||||
renderer.renderButton(&buttonMasterserverGame);
|
||||
renderer.renderButton(&buttonTutorial);
|
||||
renderer.renderButton(&buttonReturn);
|
||||
|
||||
renderer.renderConsole(&console);
|
||||
if(program != NULL) program->renderProgramMsgBox();
|
||||
}
|
||||
|
||||
void MenuStateNewGame::update(){
|
||||
if(Config::getInstance().getBool("AutoTest")){
|
||||
AutoTest::getInstance().updateNewGame(program, mainMenu);
|
||||
return;
|
||||
}
|
||||
console.update();
|
||||
}
|
||||
|
||||
void MenuStateNewGame::keyDown(SDL_KeyboardEvent key) {
|
||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
//if(key == configKeys.getCharKey("SaveGUILayout")) {
|
||||
if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),key) == true) {
|
||||
GraphicComponent::saveAllCustomProperties(containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
}
|
||||
|
||||
}}//end namespace
|
||||
}
|
||||
} //end namespace
|
||||
|
@ -1,48 +1,52 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATENEWGAME_H_
|
||||
#define _GLEST_GAME_MENUSTATENEWGAME_H_
|
||||
# define _GLEST_GAME_MENUSTATENEWGAME_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateNewGame
|
||||
// class MenuStateNewGame
|
||||
// ===============================
|
||||
|
||||
class MenuStateNewGame: public MenuState{
|
||||
private:
|
||||
GraphicButton buttonCustomGame;
|
||||
GraphicButton buttonScenario;
|
||||
GraphicButton buttonJoinGame;
|
||||
GraphicButton buttonMasterserverGame;
|
||||
GraphicButton buttonTutorial;
|
||||
GraphicButton buttonReturn;
|
||||
class MenuStateNewGame:public MenuState
|
||||
{
|
||||
private:
|
||||
GraphicButton buttonCustomGame;
|
||||
GraphicButton buttonScenario;
|
||||
GraphicButton buttonJoinGame;
|
||||
GraphicButton buttonMasterserverGame;
|
||||
GraphicButton buttonTutorial;
|
||||
GraphicButton buttonReturn;
|
||||
|
||||
public:
|
||||
MenuStateNewGame(Program *program, MainMenu *mainMenu);
|
||||
public:
|
||||
MenuStateNewGame (Program * program, MainMenu * mainMenu);
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void update();
|
||||
void render();
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void update ();
|
||||
void render ();
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
void reloadUI();
|
||||
};
|
||||
void reloadUI ();
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +1,124 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEOPTIONS_H_
|
||||
#define _GLEST_GAME_MENUSTATEOPTIONS_H_
|
||||
# define _GLEST_GAME_MENUSTATEOPTIONS_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateOptions
|
||||
// class MenuStateOptions
|
||||
// ===============================
|
||||
|
||||
class MenuStateOptions: public MenuState{
|
||||
private:
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
class MenuStateOptions:public MenuState
|
||||
{
|
||||
private:
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
|
||||
GraphicLabel labelLang;
|
||||
GraphicListBox listBoxLang;
|
||||
GraphicLabel labelPlayerName;
|
||||
GraphicLabel labelPlayerNameLabel;
|
||||
GraphicLabel *activeInputLabel;
|
||||
GraphicLabel labelLang;
|
||||
GraphicListBox listBoxLang;
|
||||
GraphicLabel labelPlayerName;
|
||||
GraphicLabel labelPlayerNameLabel;
|
||||
GraphicLabel *activeInputLabel;
|
||||
|
||||
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
|
||||
GraphicLabel labelFontSizeAdjustment;
|
||||
GraphicListBox listFontSizeAdjustment;
|
||||
GraphicLabel labelFontSizeAdjustment;
|
||||
GraphicListBox listFontSizeAdjustment;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
GraphicLabel labelScreenShotType;
|
||||
GraphicListBox listBoxScreenShotType;
|
||||
GraphicLabel labelScreenShotType;
|
||||
GraphicListBox listBoxScreenShotType;
|
||||
|
||||
GraphicLabel labelDisableScreenshotConsoleText;
|
||||
GraphicCheckBox checkBoxDisableScreenshotConsoleText;
|
||||
GraphicLabel labelDisableScreenshotConsoleText;
|
||||
GraphicCheckBox checkBoxDisableScreenshotConsoleText;
|
||||
|
||||
GraphicLabel labelMouseMoveScrollsWorld;
|
||||
GraphicCheckBox checkBoxMouseMoveScrollsWorld;
|
||||
GraphicLabel labelMouseMoveScrollsWorld;
|
||||
GraphicCheckBox checkBoxMouseMoveScrollsWorld;
|
||||
|
||||
GraphicLabel labelCameraMoveSpeed;
|
||||
GraphicListBox listCameraMoveSpeed;
|
||||
GraphicLabel labelCameraMoveSpeed;
|
||||
GraphicListBox listCameraMoveSpeed;
|
||||
|
||||
GraphicLabel labelVisibleHud;
|
||||
GraphicCheckBox checkBoxVisibleHud;
|
||||
GraphicLabel labelHealthBars;
|
||||
GraphicListBox listBoxHealthBars;
|
||||
GraphicLabel labelVisibleHud;
|
||||
GraphicCheckBox checkBoxVisibleHud;
|
||||
GraphicLabel labelHealthBars;
|
||||
GraphicListBox listBoxHealthBars;
|
||||
|
||||
GraphicLabel labelTimeDisplay;
|
||||
GraphicCheckBox checkBoxTimeDisplay;
|
||||
GraphicLabel labelChatStaysActive;
|
||||
GraphicCheckBox checkBoxChatStaysActive;
|
||||
GraphicLabel labelTimeDisplay;
|
||||
GraphicCheckBox checkBoxTimeDisplay;
|
||||
GraphicLabel labelChatStaysActive;
|
||||
GraphicCheckBox checkBoxChatStaysActive;
|
||||
|
||||
GraphicLabel labelLuaDisableSecuritySandbox;
|
||||
GraphicCheckBox checkBoxLuaDisableSecuritySandbox;
|
||||
GraphicLabel labelLuaDisableSecuritySandbox;
|
||||
GraphicCheckBox checkBoxLuaDisableSecuritySandbox;
|
||||
|
||||
GraphicMessageBox luaMessageBox;
|
||||
int luaMessageBoxState;
|
||||
GraphicMessageBox luaMessageBox;
|
||||
int luaMessageBoxState;
|
||||
|
||||
map<string,string> languageList;
|
||||
map < string, string > languageList;
|
||||
|
||||
GraphicLabel labelCustomTranslation;
|
||||
GraphicCheckBox checkBoxCustomTranslation;
|
||||
GraphicLabel labelCustomTranslation;
|
||||
GraphicCheckBox checkBoxCustomTranslation;
|
||||
|
||||
GraphicButton buttonGetNewLanguageFiles;
|
||||
GraphicButton buttonDeleteNewLanguageFiles;
|
||||
GraphicLabel labelTransifexUserLabel;
|
||||
GraphicLabel labelTransifexUser;
|
||||
GraphicLabel labelTransifexPwdLabel;
|
||||
GraphicLabel labelTransifexPwd;
|
||||
GraphicLabel labelTransifexI18NLabel;
|
||||
GraphicLabel labelTransifexI18N;
|
||||
GraphicButton buttonGetNewLanguageFiles;
|
||||
GraphicButton buttonDeleteNewLanguageFiles;
|
||||
GraphicLabel labelTransifexUserLabel;
|
||||
GraphicLabel labelTransifexUser;
|
||||
GraphicLabel labelTransifexPwdLabel;
|
||||
GraphicLabel labelTransifexPwd;
|
||||
GraphicLabel labelTransifexI18NLabel;
|
||||
GraphicLabel labelTransifexI18N;
|
||||
|
||||
ProgramState **parentUI;
|
||||
ProgramState **parentUI;
|
||||
|
||||
public:
|
||||
MenuStateOptions(Program *program, MainMenu *mainMenu, ProgramState **parentUI=NULL);
|
||||
virtual ~MenuStateOptions();
|
||||
public:
|
||||
MenuStateOptions (Program * program, MainMenu * mainMenu,
|
||||
ProgramState ** parentUI = NULL);
|
||||
virtual ~ MenuStateOptions ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
virtual bool textInput(std::string text);
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
virtual bool isInSpecialKeyCaptureEvent();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
virtual bool textInput (std::string text);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
virtual bool isInSpecialKeyCaptureEvent ();
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
private:
|
||||
void saveConfig();
|
||||
void setActiveInputLable(GraphicLabel* newLable);
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void showLuaMessageBox(const string &text, const string &header, bool toggle);
|
||||
private:
|
||||
void saveConfig ();
|
||||
void setActiveInputLable (GraphicLabel * newLable);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void showLuaMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
|
||||
void setupTransifexUI();
|
||||
};
|
||||
void setupTransifexUI ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,122 +1,128 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEOPTIONS_GRAPHICS_H_
|
||||
#define _GLEST_GAME_MENUSTATEOPTIONS_GRAPHICS_H_
|
||||
# define _GLEST_GAME_MENUSTATEOPTIONS_GRAPHICS_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateOptionsGraphics
|
||||
// class MenuStateOptionsGraphics
|
||||
// ===============================
|
||||
|
||||
class MenuStateOptionsGraphics: public MenuState{
|
||||
private:
|
||||
class MenuStateOptionsGraphics:public MenuState
|
||||
{
|
||||
private:
|
||||
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonAutoConfig;
|
||||
GraphicButton buttonVideoInfo;
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonAutoConfig;
|
||||
GraphicButton buttonVideoInfo;
|
||||
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
|
||||
GraphicLabel labelShadows;
|
||||
GraphicListBox listBoxShadows;
|
||||
GraphicLabel labelFilter;
|
||||
GraphicListBox listBoxFilter;
|
||||
GraphicLabel labelFilterMaxAnisotropy;
|
||||
GraphicListBox listBoxFilterMaxAnisotropy;
|
||||
GraphicLabel labelShadows;
|
||||
GraphicListBox listBoxShadows;
|
||||
GraphicLabel labelFilter;
|
||||
GraphicListBox listBoxFilter;
|
||||
GraphicLabel labelFilterMaxAnisotropy;
|
||||
GraphicListBox listBoxFilterMaxAnisotropy;
|
||||
|
||||
GraphicLabel labelTextures3D;
|
||||
GraphicCheckBox checkBoxTextures3D;
|
||||
GraphicLabel labelLights;
|
||||
GraphicListBox listBoxLights;
|
||||
GraphicLabel labelUnitParticles;
|
||||
GraphicCheckBox checkBoxUnitParticles;
|
||||
GraphicLabel labelTextures3D;
|
||||
GraphicCheckBox checkBoxTextures3D;
|
||||
GraphicLabel labelLights;
|
||||
GraphicListBox listBoxLights;
|
||||
GraphicLabel labelUnitParticles;
|
||||
GraphicCheckBox checkBoxUnitParticles;
|
||||
|
||||
GraphicLabel labelTilesetParticles;
|
||||
GraphicCheckBox checkBoxTilesetParticles;
|
||||
GraphicLabel labelAnimatedTilesetObjects;
|
||||
GraphicListBox listBoxAnimatedTilesetObjects;
|
||||
GraphicLabel labelTilesetParticles;
|
||||
GraphicCheckBox checkBoxTilesetParticles;
|
||||
GraphicLabel labelAnimatedTilesetObjects;
|
||||
GraphicListBox listBoxAnimatedTilesetObjects;
|
||||
|
||||
|
||||
GraphicLabel labelScreenModes;
|
||||
GraphicListBox listBoxScreenModes;
|
||||
vector<ModeInfo> modeInfos;
|
||||
GraphicLabel labelScreenModes;
|
||||
GraphicListBox listBoxScreenModes;
|
||||
vector < ModeInfo > modeInfos;
|
||||
|
||||
GraphicLabel labelFullscreenWindowed;
|
||||
GraphicCheckBox checkBoxFullscreenWindowed;
|
||||
GraphicLabel labelFullscreenWindowed;
|
||||
GraphicCheckBox checkBoxFullscreenWindowed;
|
||||
|
||||
|
||||
GraphicLabel labelMapPreview;
|
||||
GraphicCheckBox checkBoxMapPreview;
|
||||
GraphicLabel labelMapPreview;
|
||||
GraphicCheckBox checkBoxMapPreview;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
GraphicLabel labelEnableTextureCompression;
|
||||
GraphicCheckBox checkBoxEnableTextureCompression;
|
||||
GraphicLabel labelEnableTextureCompression;
|
||||
GraphicCheckBox checkBoxEnableTextureCompression;
|
||||
|
||||
GraphicLabel labelRainEffect;
|
||||
GraphicLabel labelRainEffectSeparator;
|
||||
GraphicCheckBox checkBoxRainEffect;
|
||||
GraphicCheckBox checkBoxRainEffectMenu;
|
||||
GraphicLabel labelRainEffect;
|
||||
GraphicLabel labelRainEffectSeparator;
|
||||
GraphicCheckBox checkBoxRainEffect;
|
||||
GraphicCheckBox checkBoxRainEffectMenu;
|
||||
|
||||
GraphicLabel labelGammaCorrection;
|
||||
GraphicListBox listBoxGammaCorrection;
|
||||
GraphicLabel labelGammaCorrection;
|
||||
GraphicListBox listBoxGammaCorrection;
|
||||
|
||||
GraphicLabel labelShadowIntensity;
|
||||
GraphicListBox listBoxShadowIntensity;
|
||||
GraphicLabel labelShadowIntensity;
|
||||
GraphicListBox listBoxShadowIntensity;
|
||||
|
||||
GraphicLabel labelShadowTextureSize;
|
||||
GraphicListBox listBoxShadowTextureSize;
|
||||
GraphicLabel labelShadowTextureSize;
|
||||
GraphicListBox listBoxShadowTextureSize;
|
||||
|
||||
GraphicLabel labelVideos;
|
||||
GraphicCheckBox checkBoxVideos;
|
||||
GraphicLabel labelVideos;
|
||||
GraphicCheckBox checkBoxVideos;
|
||||
|
||||
GraphicLabel labelSelectionType;
|
||||
GraphicListBox listBoxSelectionType;
|
||||
GraphicLabel labelSelectionType;
|
||||
GraphicListBox listBoxSelectionType;
|
||||
|
||||
ProgramState **parentUI;
|
||||
time_t screenModeChangedTimer;
|
||||
ProgramState **parentUI;
|
||||
time_t screenModeChangedTimer;
|
||||
|
||||
public:
|
||||
MenuStateOptionsGraphics(Program *program, MainMenu *mainMenu, ProgramState **parentUI=NULL);
|
||||
public:
|
||||
MenuStateOptionsGraphics (Program * program, MainMenu * mainMenu,
|
||||
ProgramState ** parentUI = NULL);
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
|
||||
private:
|
||||
void saveConfig();
|
||||
void setActiveInputLable(GraphicLabel* newLable);
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void revertScreenMode();
|
||||
void setupTransifexUI();
|
||||
virtual void update();
|
||||
};
|
||||
private:
|
||||
void saveConfig ();
|
||||
void setActiveInputLable (GraphicLabel * newLable);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void revertScreenMode ();
|
||||
void setupTransifexUI ();
|
||||
virtual void update ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,90 +1,95 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEOPTIONS_NETWORK_H_
|
||||
#define _GLEST_GAME_MENUSTATEOPTIONS_NETWORK_H_
|
||||
# define _GLEST_GAME_MENUSTATEOPTIONS_NETWORK_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateOptionsNetwork
|
||||
// class MenuStateOptionsNetwork
|
||||
// ===============================
|
||||
|
||||
class MenuStateOptionsNetwork: public MenuState{
|
||||
private:
|
||||
class MenuStateOptionsNetwork:public MenuState
|
||||
{
|
||||
private:
|
||||
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
GraphicLabel labelExternalPort;
|
||||
GraphicLabel labelServerPortLabel;
|
||||
GraphicLabel labelExternalPort;
|
||||
GraphicLabel labelServerPortLabel;
|
||||
|
||||
GraphicLabel labelPublishServerExternalPort;
|
||||
GraphicListBox listBoxServerPort;
|
||||
GraphicLabel labelPublishServerExternalPort;
|
||||
GraphicListBox listBoxServerPort;
|
||||
|
||||
GraphicLabel labelEnableFTP;
|
||||
GraphicCheckBox checkBoxEnableFTP;
|
||||
GraphicLabel labelEnableFTP;
|
||||
GraphicCheckBox checkBoxEnableFTP;
|
||||
|
||||
GraphicLabel labelEnableFTPServer;
|
||||
GraphicCheckBox checkBoxEnableFTPServer;
|
||||
GraphicLabel labelEnableFTPServer;
|
||||
GraphicCheckBox checkBoxEnableFTPServer;
|
||||
|
||||
GraphicLabel labelFTPServerPortLabel;
|
||||
GraphicLabel labelFTPServerPort;
|
||||
GraphicLabel labelFTPServerPortLabel;
|
||||
GraphicLabel labelFTPServerPort;
|
||||
|
||||
GraphicLabel labelFTPServerDataPortsLabel;
|
||||
GraphicLabel labelFTPServerDataPorts;
|
||||
GraphicLabel labelFTPServerDataPortsLabel;
|
||||
GraphicLabel labelFTPServerDataPorts;
|
||||
|
||||
GraphicLabel labelEnableFTPServerInternetTilesetXfer;
|
||||
GraphicCheckBox checkBoxEnableFTPServerInternetTilesetXfer;
|
||||
GraphicLabel labelEnableFTPServerInternetTilesetXfer;
|
||||
GraphicCheckBox checkBoxEnableFTPServerInternetTilesetXfer;
|
||||
|
||||
GraphicLabel labelEnableFTPServerInternetTechtreeXfer;
|
||||
GraphicCheckBox checkBoxEnableFTPServerInternetTechtreeXfer;
|
||||
GraphicLabel labelEnableFTPServerInternetTechtreeXfer;
|
||||
GraphicCheckBox checkBoxEnableFTPServerInternetTechtreeXfer;
|
||||
|
||||
GraphicLabel labelEnablePrivacy;
|
||||
GraphicCheckBox checkBoxEnablePrivacy;
|
||||
GraphicLabel labelEnablePrivacy;
|
||||
GraphicCheckBox checkBoxEnablePrivacy;
|
||||
|
||||
ProgramState **parentUI;
|
||||
ProgramState **parentUI;
|
||||
|
||||
public:
|
||||
MenuStateOptionsNetwork(Program *program, MainMenu *mainMenu, ProgramState **parentUI=NULL);
|
||||
public:
|
||||
MenuStateOptionsNetwork (Program * program, MainMenu * mainMenu,
|
||||
ProgramState ** parentUI = NULL);
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
|
||||
private:
|
||||
void saveConfig();
|
||||
void setActiveInputLable(GraphicLabel* newLable);
|
||||
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
};
|
||||
private:
|
||||
void saveConfig ();
|
||||
void setActiveInputLable (GraphicLabel * newLable);
|
||||
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#include "menu_state_options_sound.h"
|
||||
@ -28,407 +28,528 @@
|
||||
#include "metrics.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace
|
||||
Shared::Util;
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
|
||||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMenu, ProgramState **parentUI) :
|
||||
MenuState(program, mainMenu, "config"),
|
||||
buttonOk("Options_Sound","buttonOk"),
|
||||
buttonReturn("Options_Sound","buttonReturn"),
|
||||
|
||||
buttonKeyboardSetup("Options_Sound","buttonKeyboardSetup"),
|
||||
buttonVideoSection("Options_Sound","buttonVideoSection"),
|
||||
buttonAudioSection("Options_Sound","buttonAudioSection"),
|
||||
buttonMiscSection("Options_Sound","buttonMiscSection"),
|
||||
buttonNetworkSettings("Options_Sound","buttonNetworkSettings"),
|
||||
|
||||
labelSoundFactory("Options_Sound","labelSoundFactory"),
|
||||
listBoxSoundFactory("Options_Sound","listBoxSoundFactory"),
|
||||
|
||||
labelVolumeFx("Options_Sound","labelVolumeFx"),
|
||||
listBoxVolumeFx("Options_Sound","listBoxVolumeFx"),
|
||||
|
||||
labelVolumeAmbient("Options_Sound","labelVolumeAmbient"),
|
||||
listBoxVolumeAmbient("Options_Sound","listBoxVolumeAmbient"),
|
||||
|
||||
labelVolumeMusic("Options_Sound","labelVolumeMusic"),
|
||||
listBoxVolumeMusic("Options_Sound","listBoxVolumeMusic"),
|
||||
|
||||
mainMessageBox("Options_Sound","mainMessageBox")
|
||||
namespace
|
||||
Glest
|
||||
{
|
||||
try {
|
||||
containerName = "Options_Sound";
|
||||
this->parentUI=parentUI;
|
||||
Lang &lang= Lang::getInstance();
|
||||
Config &config= Config::getInstance();
|
||||
this->console.setOnlyChatMessagesInStoredLines(false);
|
||||
namespace
|
||||
Game
|
||||
{
|
||||
|
||||
int leftLabelStart=100;
|
||||
int leftColumnStart=leftLabelStart+300;
|
||||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptionsSound::MenuStateOptionsSound (Program * program,
|
||||
MainMenu * mainMenu,
|
||||
ProgramState ** parentUI):
|
||||
MenuState (program, mainMenu, "config"),
|
||||
buttonOk ("Options_Sound", "buttonOk"),
|
||||
buttonReturn ("Options_Sound", "buttonReturn"),
|
||||
buttonKeyboardSetup ("Options_Sound", "buttonKeyboardSetup"),
|
||||
buttonVideoSection ("Options_Sound", "buttonVideoSection"),
|
||||
buttonAudioSection ("Options_Sound", "buttonAudioSection"),
|
||||
buttonMiscSection ("Options_Sound", "buttonMiscSection"),
|
||||
buttonNetworkSettings ("Options_Sound", "buttonNetworkSettings"),
|
||||
labelSoundFactory ("Options_Sound", "labelSoundFactory"),
|
||||
listBoxSoundFactory ("Options_Sound", "listBoxSoundFactory"),
|
||||
labelVolumeFx ("Options_Sound", "labelVolumeFx"),
|
||||
listBoxVolumeFx ("Options_Sound", "listBoxVolumeFx"),
|
||||
labelVolumeAmbient ("Options_Sound", "labelVolumeAmbient"),
|
||||
listBoxVolumeAmbient ("Options_Sound", "listBoxVolumeAmbient"),
|
||||
labelVolumeMusic ("Options_Sound", "labelVolumeMusic"),
|
||||
listBoxVolumeMusic ("Options_Sound", "listBoxVolumeMusic"),
|
||||
mainMessageBox ("Options_Sound", "mainMessageBox")
|
||||
{
|
||||
try
|
||||
{
|
||||
containerName = "Options_Sound";
|
||||
this->
|
||||
parentUI = parentUI;
|
||||
Lang &
|
||||
lang = Lang::getInstance ();
|
||||
Config &
|
||||
config = Config::getInstance ();
|
||||
this->
|
||||
console.
|
||||
setOnlyChatMessagesInStoredLines (false);
|
||||
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
int
|
||||
leftLabelStart = 100;
|
||||
int
|
||||
leftColumnStart = leftLabelStart + 300;
|
||||
int
|
||||
buttonRowPos = 50;
|
||||
int
|
||||
buttonStartPos = 170;
|
||||
int
|
||||
lineOffset = 30;
|
||||
int
|
||||
tabButtonWidth = 200;
|
||||
int
|
||||
tabButtonHeight = 30;
|
||||
|
||||
buttonAudioSection.init(0, 700,tabButtonWidth,tabButtonHeight+20);
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.init(200, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
//currentLine-=lineOffset;
|
||||
//MiscSection
|
||||
buttonMiscSection.init(400, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.init(600, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
mainMessageBox.
|
||||
init (lang.getString ("Ok"));
|
||||
mainMessageBox.
|
||||
setEnabled (false);
|
||||
mainMessageBoxState = 0;
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.init(800, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.getString("Keyboardsetup"));
|
||||
buttonAudioSection.
|
||||
init (0, 700, tabButtonWidth, tabButtonHeight + 20);
|
||||
buttonAudioSection.
|
||||
setFont (CoreData::getInstance ().getMenuFontVeryBig ());
|
||||
buttonAudioSection.
|
||||
setFont3D (CoreData::getInstance ().getMenuFontVeryBig3D ());
|
||||
buttonAudioSection.
|
||||
setText (lang.getString ("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.
|
||||
init (200, 720, tabButtonWidth, tabButtonHeight);
|
||||
buttonVideoSection.
|
||||
setFont (CoreData::getInstance ().getMenuFontVeryBig ());
|
||||
buttonVideoSection.
|
||||
setFont3D (CoreData::getInstance ().getMenuFontVeryBig3D ());
|
||||
buttonVideoSection.
|
||||
setText (lang.getString ("Video"));
|
||||
//currentLine-=lineOffset;
|
||||
//MiscSection
|
||||
buttonMiscSection.
|
||||
init (400, 720, tabButtonWidth, tabButtonHeight);
|
||||
buttonMiscSection.
|
||||
setFont (CoreData::getInstance ().getMenuFontVeryBig ());
|
||||
buttonMiscSection.
|
||||
setFont3D (CoreData::getInstance ().getMenuFontVeryBig3D ());
|
||||
buttonMiscSection.
|
||||
setText (lang.getString ("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.
|
||||
init (600, 720, tabButtonWidth, tabButtonHeight);
|
||||
buttonNetworkSettings.
|
||||
setFont (CoreData::getInstance ().getMenuFontVeryBig ());
|
||||
buttonNetworkSettings.
|
||||
setFont3D (CoreData::getInstance ().getMenuFontVeryBig3D ());
|
||||
buttonNetworkSettings.
|
||||
setText (lang.getString ("Network"));
|
||||
|
||||
int currentLine=650; // reset line pos
|
||||
int currentLabelStart=leftLabelStart; // set to right side
|
||||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.
|
||||
init (800, 720, tabButtonWidth, tabButtonHeight);
|
||||
buttonKeyboardSetup.
|
||||
setFont (CoreData::getInstance ().getMenuFontVeryBig ());
|
||||
buttonKeyboardSetup.
|
||||
setFont3D (CoreData::getInstance ().getMenuFontVeryBig3D ());
|
||||
buttonKeyboardSetup.
|
||||
setText (lang.getString ("Keyboardsetup"));
|
||||
|
||||
//soundboxes
|
||||
labelSoundFactory.init(currentLabelStart, currentLine);
|
||||
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
|
||||
int
|
||||
currentLine = 650; // reset line pos
|
||||
int
|
||||
currentLabelStart = leftLabelStart; // set to right side
|
||||
int
|
||||
currentColumnStart = leftColumnStart; // set to right side
|
||||
|
||||
listBoxSoundFactory.init(currentColumnStart, currentLine, 175);
|
||||
listBoxSoundFactory.pushBackItem(lang.getString("None"));
|
||||
listBoxSoundFactory.pushBackItem("OpenAL");
|
||||
//soundboxes
|
||||
labelSoundFactory.
|
||||
init (currentLabelStart, currentLine);
|
||||
labelSoundFactory.
|
||||
setText (lang.getString ("SoundAndMusic2"));
|
||||
|
||||
string FSoundMode=config.getString("FactorySound");
|
||||
string FSoundModeT=lang.getString(config.getString("FactorySound"));
|
||||
if(FSoundModeT != "???" + FSoundMode + "???") {
|
||||
FSoundMode=FSoundModeT;
|
||||
}
|
||||
listBoxSoundFactory.setSelectedItem(FSoundMode);
|
||||
currentLine-=lineOffset;
|
||||
listBoxSoundFactory.
|
||||
init (currentColumnStart, currentLine, 175);
|
||||
listBoxSoundFactory.
|
||||
pushBackItem (lang.getString ("None"));
|
||||
listBoxSoundFactory.
|
||||
pushBackItem ("OpenAL");
|
||||
|
||||
labelVolumeFx.init(currentLabelStart, currentLine);
|
||||
labelVolumeFx.setText(lang.getString("FxVolume"));
|
||||
string
|
||||
FSoundMode = config.getString ("FactorySound");
|
||||
string
|
||||
FSoundModeT = lang.getString (config.getString ("FactorySound"));
|
||||
if (FSoundModeT != "???" + FSoundMode + "???")
|
||||
{
|
||||
FSoundMode = FSoundModeT;
|
||||
}
|
||||
listBoxSoundFactory.
|
||||
setSelectedItem (FSoundMode);
|
||||
currentLine -=
|
||||
lineOffset;
|
||||
|
||||
listBoxVolumeFx.init(currentColumnStart, currentLine, 80);
|
||||
currentLine-=lineOffset;
|
||||
labelVolumeFx.
|
||||
init (currentLabelStart, currentLine);
|
||||
labelVolumeFx.
|
||||
setText (lang.getString ("FxVolume"));
|
||||
|
||||
labelVolumeAmbient.init(currentLabelStart, currentLine);
|
||||
listBoxVolumeFx.
|
||||
init (currentColumnStart, currentLine, 80);
|
||||
currentLine -=
|
||||
lineOffset;
|
||||
|
||||
listBoxVolumeAmbient.init(currentColumnStart, currentLine, 80);
|
||||
labelVolumeAmbient.setText(lang.getString("AmbientVolume"));
|
||||
currentLine-=lineOffset;
|
||||
labelVolumeAmbient.
|
||||
init (currentLabelStart, currentLine);
|
||||
|
||||
labelVolumeMusic.init(currentLabelStart, currentLine);
|
||||
listBoxVolumeAmbient.
|
||||
init (currentColumnStart, currentLine, 80);
|
||||
labelVolumeAmbient.
|
||||
setText (lang.getString ("AmbientVolume"));
|
||||
currentLine -=
|
||||
lineOffset;
|
||||
|
||||
listBoxVolumeMusic.init(currentColumnStart, currentLine, 80);
|
||||
labelVolumeMusic.setText(lang.getString("MusicVolume"));
|
||||
//currentLine-=lineOffset;
|
||||
labelVolumeMusic.
|
||||
init (currentLabelStart, currentLine);
|
||||
|
||||
for(int i=0; i<=100; i+=5){
|
||||
listBoxVolumeFx.pushBackItem(intToStr(i));
|
||||
listBoxVolumeAmbient.pushBackItem(intToStr(i));
|
||||
listBoxVolumeMusic.pushBackItem(intToStr(i));
|
||||
}
|
||||
listBoxVolumeFx.setSelectedItem(intToStr(config.getInt("SoundVolumeFx")/5*5));
|
||||
listBoxVolumeAmbient.setSelectedItem(intToStr(config.getInt("SoundVolumeAmbient")/5*5));
|
||||
listBoxVolumeMusic.setSelectedItem(intToStr(config.getInt("SoundVolumeMusic")/5*5));
|
||||
listBoxVolumeMusic.
|
||||
init (currentColumnStart, currentLine, 80);
|
||||
labelVolumeMusic.
|
||||
setText (lang.getString ("MusicVolume"));
|
||||
//currentLine-=lineOffset;
|
||||
|
||||
//currentLine-=lineOffset/2;
|
||||
for (int i = 0; i <= 100; i += 5)
|
||||
{
|
||||
listBoxVolumeFx.pushBackItem (intToStr (i));
|
||||
listBoxVolumeAmbient.
|
||||
pushBackItem (intToStr (i));
|
||||
listBoxVolumeMusic.
|
||||
pushBackItem (intToStr (i));
|
||||
}
|
||||
listBoxVolumeFx.
|
||||
setSelectedItem (intToStr (config.getInt ("SoundVolumeFx") / 5 * 5));
|
||||
listBoxVolumeAmbient.
|
||||
setSelectedItem (intToStr
|
||||
(config.getInt ("SoundVolumeAmbient") / 5 * 5));
|
||||
listBoxVolumeMusic.
|
||||
setSelectedItem (intToStr
|
||||
(config.getInt ("SoundVolumeMusic") / 5 * 5));
|
||||
|
||||
//currentLine-=lineOffset/2;
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
///////// RIGHT SIDE
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////
|
||||
///////// RIGHT SIDE
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//currentLine=700; // reset line pos
|
||||
//currentLabelStart=rightLabelStart; // set to right side
|
||||
//currentColumnStart=rightColumnStart; // set to right side
|
||||
//currentLine=700; // reset line pos
|
||||
//currentLabelStart=rightLabelStart; // set to right side
|
||||
//currentColumnStart=rightColumnStart; // set to right side
|
||||
|
||||
|
||||
// buttons
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
// buttons
|
||||
buttonOk.init (buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText (lang.getString ("Save"));
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
buttonReturn.init (buttonStartPos + 110, buttonRowPos, 100);
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
}
|
||||
catch(exception &e) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error loading options: %s\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
throw megaglest_runtime_error(string("Error loading options msg: ") + e.what());
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateOptionsSound::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
|
||||
|
||||
std::vector<string> listboxData;
|
||||
listboxData.push_back(lang.getString("None"));
|
||||
listboxData.push_back("OpenAL");
|
||||
|
||||
listBoxSoundFactory.setItems(listboxData);
|
||||
|
||||
labelVolumeFx.setText(lang.getString("FxVolume"));
|
||||
labelVolumeAmbient.setText(lang.getString("AmbientVolume"));
|
||||
labelVolumeMusic.setText(lang.getString("MusicVolume"));
|
||||
|
||||
listboxData.clear();
|
||||
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
}
|
||||
|
||||
void MenuStateOptionsSound::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
||||
//Config &config= Config::getInstance();
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
|
||||
if(mainMessageBox.getEnabled()) {
|
||||
int button= 0;
|
||||
if(mainMessageBox.mouseClick(x, y, button)) {
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
if(button == 0) {
|
||||
if(mainMessageBoxState == 1) {
|
||||
mainMessageBoxState=0;
|
||||
mainMessageBox.setEnabled(false);
|
||||
saveConfig();
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
||||
}
|
||||
else {
|
||||
mainMessageBox.setEnabled(false);
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(mainMessageBoxState == 1) {
|
||||
mainMessageBoxState=0;
|
||||
mainMessageBox.setEnabled(false);
|
||||
|
||||
Lang &lang= Lang::getInstance();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
|
||||
|
||||
this->mainMenu->init();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(buttonOk.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
saveConfig();
|
||||
//mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
||||
return;
|
||||
GraphicComponent::applyAllCustomProperties (containerName);
|
||||
}
|
||||
catch (exception & e)
|
||||
{
|
||||
SystemFlags::OutputDebug (SystemFlags::debugError,
|
||||
"In [%s::%s Line: %d] Error loading options: %s\n",
|
||||
__FILE__, __FUNCTION__, __LINE__,
|
||||
e.what ());
|
||||
throw
|
||||
megaglest_runtime_error (string ("Error loading options msg: ") +
|
||||
e.what ());
|
||||
}
|
||||
}
|
||||
else if(buttonReturn.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
if(this->parentUI != NULL) {
|
||||
*this->parentUI = NULL;
|
||||
delete *this->parentUI;
|
||||
}
|
||||
mainMenu->setState(new MenuStateRoot(program, mainMenu));
|
||||
return;
|
||||
|
||||
void
|
||||
MenuStateOptionsSound::reloadUI ()
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
mainMessageBox.init (lang.getString ("Ok"));
|
||||
|
||||
buttonAudioSection.setText (lang.getString ("Audio"));
|
||||
buttonVideoSection.setText (lang.getString ("Video"));
|
||||
buttonMiscSection.setText (lang.getString ("Misc"));
|
||||
buttonNetworkSettings.setText (lang.getString ("Network"));
|
||||
labelSoundFactory.setText (lang.getString ("SoundAndMusic2"));
|
||||
|
||||
std::vector < string > listboxData;
|
||||
listboxData.push_back (lang.getString ("None"));
|
||||
listboxData.push_back ("OpenAL");
|
||||
|
||||
listBoxSoundFactory.setItems (listboxData);
|
||||
|
||||
labelVolumeFx.setText (lang.getString ("FxVolume"));
|
||||
labelVolumeAmbient.setText (lang.getString ("AmbientVolume"));
|
||||
labelVolumeMusic.setText (lang.getString ("MusicVolume"));
|
||||
|
||||
listboxData.clear ();
|
||||
|
||||
buttonOk.setText (lang.getString ("Save"));
|
||||
buttonReturn.setText (lang.getString ("Return"));
|
||||
}
|
||||
else if(buttonKeyboardSetup.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
//mainMenu->setState(new MenuStateKeysetup(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//mainMenu->setState(new MenuStateOptionsGraphics(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//mainMenu->setState(new MenuStateOptionsNetwork(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
mainMenu->setState(new MenuStateKeysetup(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//showMessageBox("Not implemented yet", "Keyboard setup", false);
|
||||
return;
|
||||
}
|
||||
else if(buttonAudioSection.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
//mainMenu->setState(new MenuStateOptionsSound(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if(buttonNetworkSettings.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
mainMenu->setState(new MenuStateOptionsNetwork(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if(buttonMiscSection.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
mainMenu->setState(new MenuStateOptions(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if(buttonVideoSection.mouseClick(x, y)){
|
||||
soundRenderer.playFx(coreData.getClickSoundA());
|
||||
mainMenu->setState(new MenuStateOptionsGraphics(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
listBoxSoundFactory.mouseClick(x, y);
|
||||
listBoxVolumeFx.mouseClick(x, y);
|
||||
listBoxVolumeAmbient.mouseClick(x, y);
|
||||
listBoxVolumeMusic.mouseClick(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuStateOptionsSound::mouseMove(int x, int y, const MouseState *ms){
|
||||
if (mainMessageBox.getEnabled()) {
|
||||
mainMessageBox.mouseMove(x, y);
|
||||
}
|
||||
buttonOk.mouseMove(x, y);
|
||||
buttonReturn.mouseMove(x, y);
|
||||
buttonKeyboardSetup.mouseMove(x, y);
|
||||
buttonAudioSection.mouseMove(x, y);
|
||||
buttonNetworkSettings.mouseMove(x, y);
|
||||
buttonMiscSection.mouseMove(x, y);
|
||||
buttonVideoSection.mouseMove(x, y);
|
||||
void
|
||||
MenuStateOptionsSound::mouseClick (int x, int y, MouseButton mouseButton)
|
||||
{
|
||||
|
||||
listBoxSoundFactory.mouseMove(x, y);
|
||||
listBoxVolumeFx.mouseMove(x, y);
|
||||
listBoxVolumeAmbient.mouseMove(x, y);
|
||||
listBoxVolumeMusic.mouseMove(x, y);
|
||||
}
|
||||
//Config &config= Config::getInstance();
|
||||
CoreData & coreData = CoreData::getInstance ();
|
||||
SoundRenderer & soundRenderer = SoundRenderer::getInstance ();
|
||||
|
||||
if (mainMessageBox.getEnabled ())
|
||||
{
|
||||
int
|
||||
button = 0;
|
||||
if (mainMessageBox.mouseClick (x, y, button))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
if (button == 0)
|
||||
{
|
||||
if (mainMessageBoxState == 1)
|
||||
{
|
||||
mainMessageBoxState = 0;
|
||||
mainMessageBox.setEnabled (false);
|
||||
saveConfig ();
|
||||
|
||||
Lang & lang = Lang::getInstance ();
|
||||
mainMessageBox.init (lang.getString ("Ok"));
|
||||
mainMenu->setState (new MenuStateOptions (program, mainMenu));
|
||||
}
|
||||
else
|
||||
{
|
||||
mainMessageBox.setEnabled (false);
|
||||
|
||||
Lang & lang = Lang::getInstance ();
|
||||
mainMessageBox.init (lang.getString ("Ok"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mainMessageBoxState == 1)
|
||||
{
|
||||
mainMessageBoxState = 0;
|
||||
mainMessageBox.setEnabled (false);
|
||||
|
||||
Lang & lang = Lang::getInstance ();
|
||||
mainMessageBox.init (lang.getString ("Ok"));
|
||||
|
||||
|
||||
this->mainMenu->init ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (buttonOk.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
saveConfig ();
|
||||
//mainMenu->setState(new MenuStateOptions(program, mainMenu));
|
||||
return;
|
||||
}
|
||||
else if (buttonReturn.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
if (this->parentUI != NULL)
|
||||
{
|
||||
*this->parentUI = NULL;
|
||||
delete *
|
||||
this->
|
||||
parentUI;
|
||||
}
|
||||
mainMenu->setState (new MenuStateRoot (program, mainMenu));
|
||||
return;
|
||||
}
|
||||
else if (buttonKeyboardSetup.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
//mainMenu->setState(new MenuStateKeysetup(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//mainMenu->setState(new MenuStateOptionsGraphics(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//mainMenu->setState(new MenuStateOptionsNetwork(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
mainMenu->setState (new MenuStateKeysetup (program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
//showMessageBox("Not implemented yet", "Keyboard setup", false);
|
||||
return;
|
||||
}
|
||||
else if (buttonAudioSection.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
//mainMenu->setState(new MenuStateOptionsSound(program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if (buttonNetworkSettings.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
mainMenu->setState (new MenuStateOptionsNetwork (program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if (buttonMiscSection.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
mainMenu->setState (new MenuStateOptions (program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else if (buttonVideoSection.mouseClick (x, y))
|
||||
{
|
||||
soundRenderer.playFx (coreData.getClickSoundA ());
|
||||
mainMenu->setState (new MenuStateOptionsGraphics (program, mainMenu)); // open keyboard shortcuts setup screen
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
listBoxSoundFactory.mouseClick (x, y);
|
||||
listBoxVolumeFx.mouseClick (x, y);
|
||||
listBoxVolumeAmbient.mouseClick (x, y);
|
||||
listBoxVolumeMusic.mouseClick (x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MenuStateOptionsSound::mouseMove (int x, int y, const MouseState * ms)
|
||||
{
|
||||
if (mainMessageBox.getEnabled ())
|
||||
{
|
||||
mainMessageBox.mouseMove (x, y);
|
||||
}
|
||||
buttonOk.mouseMove (x, y);
|
||||
buttonReturn.mouseMove (x, y);
|
||||
buttonKeyboardSetup.mouseMove (x, y);
|
||||
buttonAudioSection.mouseMove (x, y);
|
||||
buttonNetworkSettings.mouseMove (x, y);
|
||||
buttonMiscSection.mouseMove (x, y);
|
||||
buttonVideoSection.mouseMove (x, y);
|
||||
|
||||
listBoxSoundFactory.mouseMove (x, y);
|
||||
listBoxVolumeFx.mouseMove (x, y);
|
||||
listBoxVolumeAmbient.mouseMove (x, y);
|
||||
listBoxVolumeMusic.mouseMove (x, y);
|
||||
}
|
||||
|
||||
//bool MenuStateOptionsSound::isInSpecialKeyCaptureEvent() {
|
||||
// return (activeInputLabel != NULL);
|
||||
// return (activeInputLabel != NULL);
|
||||
//}
|
||||
//
|
||||
//void MenuStateOptionsSound::keyDown(SDL_KeyboardEvent key) {
|
||||
// if(activeInputLabel != NULL) {
|
||||
// keyDownEditLabel(key, &activeInputLabel);
|
||||
// }
|
||||
// if(activeInputLabel != NULL) {
|
||||
// keyDownEditLabel(key, &activeInputLabel);
|
||||
// }
|
||||
//}
|
||||
|
||||
void MenuStateOptionsSound::keyPress(SDL_KeyboardEvent c) {
|
||||
// if(activeInputLabel != NULL) {
|
||||
// //printf("[%d]\n",c); fflush(stdout);
|
||||
// if( &labelPlayerName == activeInputLabel ||
|
||||
// &labelTransifexUser == activeInputLabel ||
|
||||
// &labelTransifexPwd == activeInputLabel ||
|
||||
// &labelTransifexI18N == activeInputLabel) {
|
||||
// textInputEditLabel(c, &activeInputLabel);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
Config &configKeys = Config::getInstance(std::pair<ConfigType,ConfigType>(cfgMainKeys,cfgUserKeys));
|
||||
if(isKeyPressed(configKeys.getSDLKey("SaveGUILayout"),c) == true) {
|
||||
GraphicComponent::saveAllCustomProperties(containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
void MenuStateOptionsSound::render(){
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
|
||||
if(mainMessageBox.getEnabled()){
|
||||
renderer.renderMessageBox(&mainMessageBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.renderButton(&buttonOk);
|
||||
renderer.renderButton(&buttonReturn);
|
||||
renderer.renderButton(&buttonKeyboardSetup);
|
||||
renderer.renderButton(&buttonVideoSection);
|
||||
renderer.renderButton(&buttonAudioSection);
|
||||
renderer.renderButton(&buttonMiscSection);
|
||||
renderer.renderButton(&buttonNetworkSettings);
|
||||
renderer.renderListBox(&listBoxSoundFactory);
|
||||
renderer.renderLabel(&labelSoundFactory);
|
||||
|
||||
|
||||
renderer.renderListBox(&listBoxVolumeFx);
|
||||
renderer.renderLabel(&labelVolumeFx);
|
||||
renderer.renderListBox(&listBoxVolumeAmbient);
|
||||
renderer.renderLabel(&labelVolumeAmbient);
|
||||
renderer.renderListBox(&listBoxVolumeMusic);
|
||||
renderer.renderLabel(&labelVolumeMusic);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
renderer.renderConsole(&console);
|
||||
if(program != NULL) program->renderProgramMsgBox();
|
||||
}
|
||||
|
||||
void MenuStateOptionsSound::saveConfig(){
|
||||
Config &config= Config::getInstance();
|
||||
Lang &lang= Lang::getInstance();
|
||||
setActiveInputLable(NULL);
|
||||
|
||||
int FSoundIndex=listBoxSoundFactory.getSelectedItemIndex();
|
||||
string FSoundMode;
|
||||
switch (FSoundIndex) {
|
||||
case 0:
|
||||
FSoundMode = "None";
|
||||
break;
|
||||
case 1:
|
||||
FSoundMode = "OpenAL";
|
||||
break;
|
||||
}
|
||||
config.setString("FactorySound",FSoundMode);
|
||||
|
||||
config.setString("SoundVolumeFx", listBoxVolumeFx.getSelectedItem());
|
||||
config.setString("SoundVolumeAmbient", listBoxVolumeAmbient.getSelectedItem());
|
||||
CoreData::getInstance().getMenuMusic()->setVolume(strToInt(listBoxVolumeMusic.getSelectedItem())/100.f);
|
||||
config.setString("SoundVolumeMusic", listBoxVolumeMusic.getSelectedItem());
|
||||
|
||||
config.save();
|
||||
|
||||
if(config.getBool("DisableLuaSandbox","false") == true) {
|
||||
LuaScript::setDisableSandbox(true);
|
||||
}
|
||||
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
soundRenderer.stopAllSounds();
|
||||
program->stopSoundSystem();
|
||||
soundRenderer.init(program->getWindow());
|
||||
soundRenderer.loadConfig();
|
||||
soundRenderer.setMusicVolume(CoreData::getInstance().getMenuMusic());
|
||||
program->startSoundSystem();
|
||||
|
||||
if(CoreData::getInstance().hasMainMenuVideoFilename() == false) {
|
||||
soundRenderer.playMusic(CoreData::getInstance().getMenuMusic());
|
||||
void
|
||||
MenuStateOptionsSound::keyPress (SDL_KeyboardEvent c)
|
||||
{
|
||||
// if(activeInputLabel != NULL) {
|
||||
// //printf("[%d]\n",c); fflush(stdout);
|
||||
// if( &labelPlayerName == activeInputLabel ||
|
||||
// &labelTransifexUser == activeInputLabel ||
|
||||
// &labelTransifexPwd == activeInputLabel ||
|
||||
// &labelTransifexI18N == activeInputLabel) {
|
||||
// textInputEditLabel(c, &activeInputLabel);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
Config & configKeys =
|
||||
Config::getInstance (std::pair < ConfigType,
|
||||
ConfigType > (cfgMainKeys, cfgUserKeys));
|
||||
if (isKeyPressed (configKeys.getSDLKey ("SaveGUILayout"), c) == true)
|
||||
{
|
||||
GraphicComponent::saveAllCustomProperties (containerName);
|
||||
//Lang &lang= Lang::getInstance();
|
||||
//console.addLine(lang.getString("GUILayoutSaved") + " [" + (saved ? lang.getString("Yes") : lang.getString("No"))+ "]");
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
Renderer::getInstance().loadConfig();
|
||||
console.addLine(lang.getString("SettingsSaved"));
|
||||
}
|
||||
void
|
||||
MenuStateOptionsSound::render ()
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
|
||||
void MenuStateOptionsSound::setActiveInputLable(GraphicLabel *newLable) {
|
||||
}
|
||||
if (mainMessageBox.getEnabled ())
|
||||
{
|
||||
renderer.renderMessageBox (&mainMessageBox);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.renderButton (&buttonOk);
|
||||
renderer.renderButton (&buttonReturn);
|
||||
renderer.renderButton (&buttonKeyboardSetup);
|
||||
renderer.renderButton (&buttonVideoSection);
|
||||
renderer.renderButton (&buttonAudioSection);
|
||||
renderer.renderButton (&buttonMiscSection);
|
||||
renderer.renderButton (&buttonNetworkSettings);
|
||||
renderer.renderListBox (&listBoxSoundFactory);
|
||||
renderer.renderLabel (&labelSoundFactory);
|
||||
|
||||
}}//end namespace
|
||||
|
||||
renderer.renderListBox (&listBoxVolumeFx);
|
||||
renderer.renderLabel (&labelVolumeFx);
|
||||
renderer.renderListBox (&listBoxVolumeAmbient);
|
||||
renderer.renderLabel (&labelVolumeAmbient);
|
||||
renderer.renderListBox (&listBoxVolumeMusic);
|
||||
renderer.renderLabel (&labelVolumeMusic);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
renderer.renderConsole (&console);
|
||||
if (program != NULL)
|
||||
program->renderProgramMsgBox ();
|
||||
}
|
||||
|
||||
void
|
||||
MenuStateOptionsSound::saveConfig ()
|
||||
{
|
||||
Config & config = Config::getInstance ();
|
||||
Lang & lang = Lang::getInstance ();
|
||||
setActiveInputLable (NULL);
|
||||
|
||||
int
|
||||
FSoundIndex = listBoxSoundFactory.getSelectedItemIndex ();
|
||||
string
|
||||
FSoundMode;
|
||||
switch (FSoundIndex)
|
||||
{
|
||||
case 0:
|
||||
FSoundMode = "None";
|
||||
break;
|
||||
case 1:
|
||||
FSoundMode = "OpenAL";
|
||||
break;
|
||||
}
|
||||
config.setString ("FactorySound", FSoundMode);
|
||||
|
||||
config.setString ("SoundVolumeFx", listBoxVolumeFx.getSelectedItem ());
|
||||
config.setString ("SoundVolumeAmbient",
|
||||
listBoxVolumeAmbient.getSelectedItem ());
|
||||
CoreData::getInstance ().getMenuMusic ()->
|
||||
setVolume (strToInt (listBoxVolumeMusic.getSelectedItem ()) / 100.f);
|
||||
config.setString ("SoundVolumeMusic",
|
||||
listBoxVolumeMusic.getSelectedItem ());
|
||||
|
||||
config.save ();
|
||||
|
||||
if (config.getBool ("DisableLuaSandbox", "false") == true)
|
||||
{
|
||||
LuaScript::setDisableSandbox (true);
|
||||
}
|
||||
|
||||
SoundRenderer & soundRenderer = SoundRenderer::getInstance ();
|
||||
soundRenderer.stopAllSounds ();
|
||||
program->stopSoundSystem ();
|
||||
soundRenderer.init (program->getWindow ());
|
||||
soundRenderer.loadConfig ();
|
||||
soundRenderer.setMusicVolume (CoreData::getInstance ().getMenuMusic ());
|
||||
program->startSoundSystem ();
|
||||
|
||||
if (CoreData::getInstance ().hasMainMenuVideoFilename () == false)
|
||||
{
|
||||
soundRenderer.playMusic (CoreData::getInstance ().getMenuMusic ());
|
||||
}
|
||||
|
||||
Renderer::getInstance ().loadConfig ();
|
||||
console.addLine (lang.getString ("SettingsSaved"));
|
||||
}
|
||||
|
||||
void
|
||||
MenuStateOptionsSound::setActiveInputLable (GraphicLabel * newLable)
|
||||
{
|
||||
}
|
||||
|
||||
}} //end namespace
|
||||
|
@ -1,74 +1,79 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEOPTIONS_SOUND_H_
|
||||
#define _GLEST_GAME_MENUSTATEOPTIONS_SOUND_H_
|
||||
# define _GLEST_GAME_MENUSTATEOPTIONS_SOUND_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateOptionsSound
|
||||
// class MenuStateOptionsSound
|
||||
// ===============================
|
||||
|
||||
class MenuStateOptionsSound: public MenuState{
|
||||
private:
|
||||
class MenuStateOptionsSound:public MenuState
|
||||
{
|
||||
private:
|
||||
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonOk;
|
||||
GraphicButton buttonReturn;
|
||||
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
GraphicButton buttonKeyboardSetup; // configure the keyboard
|
||||
GraphicButton buttonVideoSection;
|
||||
GraphicButton buttonAudioSection;
|
||||
GraphicButton buttonMiscSection;
|
||||
GraphicButton buttonNetworkSettings;
|
||||
|
||||
GraphicLabel labelSoundFactory;
|
||||
GraphicListBox listBoxSoundFactory;
|
||||
GraphicLabel labelSoundFactory;
|
||||
GraphicListBox listBoxSoundFactory;
|
||||
|
||||
GraphicLabel labelVolumeFx;
|
||||
GraphicListBox listBoxVolumeFx;
|
||||
GraphicLabel labelVolumeFx;
|
||||
GraphicListBox listBoxVolumeFx;
|
||||
|
||||
GraphicLabel labelVolumeAmbient;
|
||||
GraphicListBox listBoxVolumeAmbient;
|
||||
GraphicLabel labelVolumeAmbient;
|
||||
GraphicListBox listBoxVolumeAmbient;
|
||||
|
||||
GraphicLabel labelVolumeMusic;
|
||||
GraphicListBox listBoxVolumeMusic;
|
||||
GraphicLabel labelVolumeMusic;
|
||||
GraphicListBox listBoxVolumeMusic;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
ProgramState **parentUI;
|
||||
ProgramState **parentUI;
|
||||
|
||||
public:
|
||||
MenuStateOptionsSound(Program *program, MainMenu *mainMenu, ProgramState **parentUI=NULL);
|
||||
public:
|
||||
MenuStateOptionsSound (Program * program, MainMenu * mainMenu,
|
||||
ProgramState ** parentUI = NULL);
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress(SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
//virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyPress (SDL_KeyboardEvent c);
|
||||
//virtual bool isInSpecialKeyCaptureEvent();
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
|
||||
private:
|
||||
void saveConfig();
|
||||
void setActiveInputLable(GraphicLabel* newLable);
|
||||
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
};
|
||||
private:
|
||||
void saveConfig ();
|
||||
void setActiveInputLable (GraphicLabel * newLable);
|
||||
//void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,81 +1,91 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
// Copyright (C) 2001-2008 Martiño Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATEROOT_H_
|
||||
#define _GLEST_GAME_MENUSTATEROOT_H_
|
||||
# define _GLEST_GAME_MENUSTATEROOT_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "simple_threads.h"
|
||||
#include "miniftpclient.h"
|
||||
# include "main_menu.h"
|
||||
# include "simple_threads.h"
|
||||
# include "miniftpclient.h"
|
||||
|
||||
#include "leak_dumper.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateRoot
|
||||
// class MenuStateRoot
|
||||
// ===============================
|
||||
|
||||
class GraphicMessageBox;
|
||||
class PopupMenu;
|
||||
class GraphicMessageBox;
|
||||
class PopupMenu;
|
||||
|
||||
class MenuStateRoot: public MenuState, public SimpleTaskCallbackInterface, public FTPClientCallbackInterface {
|
||||
private:
|
||||
GraphicButton buttonNewGame;
|
||||
GraphicButton buttonLoadGame;
|
||||
GraphicButton buttonMods;
|
||||
GraphicButton buttonOptions;
|
||||
GraphicButton buttonAbout;
|
||||
GraphicButton buttonExit;
|
||||
GraphicLabel labelVersion;
|
||||
GraphicLabel labelGreeting;
|
||||
class MenuStateRoot:public MenuState, public SimpleTaskCallbackInterface,
|
||||
public FTPClientCallbackInterface
|
||||
{
|
||||
private:
|
||||
GraphicButton buttonNewGame;
|
||||
GraphicButton buttonLoadGame;
|
||||
GraphicButton buttonMods;
|
||||
GraphicButton buttonOptions;
|
||||
GraphicButton buttonAbout;
|
||||
GraphicButton buttonExit;
|
||||
GraphicLabel labelVersion;
|
||||
GraphicLabel labelGreeting;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
GraphicMessageBox errorMessageBox;
|
||||
GraphicMessageBox ftpMessageBox;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
GraphicMessageBox errorMessageBox;
|
||||
GraphicMessageBox ftpMessageBox;
|
||||
|
||||
PopupMenu popupMenu;
|
||||
PopupMenu popupMenu;
|
||||
|
||||
static bool gameUpdateChecked;
|
||||
SimpleTaskThread *updatesHttpServerThread;
|
||||
FTPClientThread *ftpClientThread;
|
||||
std::map<string,pair<int,string> > fileFTPProgressList;
|
||||
string ftpFileName;
|
||||
string ftpFileURL;
|
||||
int lastDownloadProgress;
|
||||
static bool gameUpdateChecked;
|
||||
SimpleTaskThread *updatesHttpServerThread;
|
||||
FTPClientThread *ftpClientThread;
|
||||
std::map < string, pair < int, string > >fileFTPProgressList;
|
||||
string ftpFileName;
|
||||
string ftpFileURL;
|
||||
int lastDownloadProgress;
|
||||
|
||||
virtual void simpleTask(BaseThread *callingThread,void *userdata);
|
||||
void startFTPClientIfRequired();
|
||||
virtual void FTPClient_CallbackEvent(string itemName,
|
||||
FTP_Client_CallbackType type, pair<FTP_Client_ResultType,string> result,void *userdata);
|
||||
virtual void simpleTask (BaseThread * callingThread, void *userdata);
|
||||
void startFTPClientIfRequired ();
|
||||
virtual void FTPClient_CallbackEvent (string itemName,
|
||||
FTP_Client_CallbackType type,
|
||||
pair < FTP_Client_ResultType,
|
||||
string > result, void *userdata);
|
||||
|
||||
public:
|
||||
MenuStateRoot(Program *program, MainMenu *mainMenu);
|
||||
virtual ~MenuStateRoot();
|
||||
public:
|
||||
MenuStateRoot (Program * program, MainMenu * mainMenu);
|
||||
virtual ~ MenuStateRoot ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
void update ();
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void showErrorMessageBox(const string &text, const string &header, bool toggle);
|
||||
void showFTPMessageBox(const string &text, const string &header, bool toggle, bool okOnly);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void showErrorMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
void showFTPMessageBox (const string & text, const string & header,
|
||||
bool toggle, bool okOnly);
|
||||
|
||||
virtual bool isMasterserverMode() const;
|
||||
virtual void reloadUI();
|
||||
};
|
||||
virtual bool isMasterserverMode () const;
|
||||
virtual void reloadUI ();
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,85 +1,97 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
// Copyright (C) 2001-2005 Martio Figueroa
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_MENUSTATESCENARIO_H_
|
||||
#define _GLEST_GAME_MENUSTATESCENARIO_H_
|
||||
# define _GLEST_GAME_MENUSTATESCENARIO_H_
|
||||
|
||||
#include "main_menu.h"
|
||||
#include "leak_dumper.h"
|
||||
# include "main_menu.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// class MenuStateScenario
|
||||
// class MenuStateScenario
|
||||
// ===============================
|
||||
|
||||
class MenuStateScenario: public MenuState {
|
||||
private:
|
||||
class MenuStateScenario:public MenuState
|
||||
{
|
||||
private:
|
||||
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonPlayNow;
|
||||
GraphicButton buttonReturn;
|
||||
GraphicButton buttonPlayNow;
|
||||
|
||||
GraphicLabel labelInfo;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
GraphicLabel labelScenarioName;
|
||||
GraphicLabel labelInfo;
|
||||
GraphicLabel labelScenario;
|
||||
GraphicListBox listBoxScenario;
|
||||
GraphicLabel labelScenarioName;
|
||||
|
||||
|
||||
vector<string> scenarioFiles;
|
||||
vector < string > scenarioFiles;
|
||||
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector<string> dirList;
|
||||
ScenarioInfo scenarioInfo;
|
||||
vector < string > dirList;
|
||||
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
GraphicMessageBox mainMessageBox;
|
||||
int mainMessageBoxState;
|
||||
|
||||
string autoloadScenarioName;
|
||||
string autoloadScenarioName;
|
||||
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
time_t previewLoadDelayTimer;
|
||||
bool needToLoadTextures;
|
||||
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *scenarioLogoTexture;
|
||||
bool enableScenarioTexturePreview;
|
||||
Texture2D *scenarioLogoTexture;
|
||||
|
||||
bool isTutorialMode;
|
||||
bool isTutorialMode;
|
||||
|
||||
public:
|
||||
MenuStateScenario(Program *program, MainMenu *mainMenu, bool isTutorialMode, const vector<string> &dirList, string autoloadScenarioName="");
|
||||
virtual ~MenuStateScenario();
|
||||
public:
|
||||
MenuStateScenario (Program * program, MainMenu * mainMenu,
|
||||
bool isTutorialMode,
|
||||
const vector < string > &dirList,
|
||||
string autoloadScenarioName = "");
|
||||
virtual ~ MenuStateScenario ();
|
||||
|
||||
void mouseClick(int x, int y, MouseButton mouseButton);
|
||||
void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
void render();
|
||||
void update();
|
||||
void mouseClick (int x, int y, MouseButton mouseButton);
|
||||
void mouseMove (int x, int y, const MouseState * mouseState);
|
||||
void render ();
|
||||
void update ();
|
||||
|
||||
void launchGame();
|
||||
void setScenario(int i);
|
||||
int getScenarioCount() const { return listBoxScenario.getItemCount(); }
|
||||
void launchGame ();
|
||||
void setScenario (int i);
|
||||
int getScenarioCount () const
|
||||
{
|
||||
return listBoxScenario.getItemCount ();
|
||||
}
|
||||
|
||||
virtual void keyDown(SDL_KeyboardEvent key);
|
||||
virtual void keyDown (SDL_KeyboardEvent key);
|
||||
|
||||
virtual void reloadUI();
|
||||
virtual void reloadUI ();
|
||||
|
||||
private:
|
||||
private:
|
||||
|
||||
void loadScenarioInfo(string file, ScenarioInfo *scenarioInfo);
|
||||
void loadGameSettings(const ScenarioInfo *scenarioInfo, GameSettings *gameSettings);
|
||||
void loadScenarioPreviewTexture();
|
||||
Difficulty computeDifficulty(const ScenarioInfo *scenarioInfo);
|
||||
void showMessageBox(const string &text, const string &header, bool toggle);
|
||||
void loadScenarioInfo (string file, ScenarioInfo * scenarioInfo);
|
||||
void loadGameSettings (const ScenarioInfo * scenarioInfo,
|
||||
GameSettings * gameSettings);
|
||||
void loadScenarioPreviewTexture ();
|
||||
Difficulty computeDifficulty (const ScenarioInfo * scenarioInfo);
|
||||
void showMessageBox (const string & text, const string & header,
|
||||
bool toggle);
|
||||
|
||||
void cleanupPreviewTexture();
|
||||
};
|
||||
void cleanupPreviewTexture ();
|
||||
};
|
||||
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
@ -1,12 +1,12 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2010- by Titus Tscharntke
|
||||
// Copyright (C) 2010- by Titus Tscharntke
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
|
||||
@ -21,275 +21,342 @@
|
||||
|
||||
#include "leak_dumper.h"
|
||||
|
||||
namespace Glest {
|
||||
namespace Game {
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// =====================================================
|
||||
// class ServerLine
|
||||
// class ServerLine
|
||||
// =====================================================
|
||||
|
||||
ServerLine::ServerLine(MasterServerInfo *mServerInfo, int lineIndex, int baseY, int lineHeight,
|
||||
const char * containerName){
|
||||
this->containerName= containerName;
|
||||
this->countryTexture= NULL;
|
||||
Lang &lang= Lang::getInstance();
|
||||
ServerLine::ServerLine (MasterServerInfo * mServerInfo, int lineIndex,
|
||||
int baseY, int lineHeight,
|
||||
const char *containerName)
|
||||
{
|
||||
this->containerName = containerName;
|
||||
this->countryTexture = NULL;
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
this->lineHeight= lineHeight;
|
||||
int lineOffset= lineHeight * lineIndex;
|
||||
masterServerInfo= *mServerInfo;
|
||||
int i= 5;
|
||||
this->baseY= baseY;
|
||||
Vec3f color=Vec3f(1.0f,1.0f,1.0f);
|
||||
this->lineHeight = lineHeight;
|
||||
int lineOffset = lineHeight * lineIndex;
|
||||
masterServerInfo = *mServerInfo;
|
||||
int i = 5;
|
||||
this->baseY = baseY;
|
||||
Vec3f color = Vec3f (1.0f, 1.0f, 1.0f);
|
||||
|
||||
if(masterServerInfo.getConnectedClients()==0){
|
||||
color=Vec3f(0.6f,0.7f,1.0f);
|
||||
}
|
||||
if (masterServerInfo.getConnectedClients () == 0)
|
||||
{
|
||||
color = Vec3f (0.6f, 0.7f, 1.0f);
|
||||
}
|
||||
|
||||
|
||||
//general info:
|
||||
//i+= 10;
|
||||
glestVersionLabel.init(i, baseY - lineOffset);
|
||||
glestVersionLabel.setRenderBackground(true);
|
||||
glestVersionLabel.setMaxEditRenderWidth(970); // use background for whole line
|
||||
glestVersionLabel.setTextColor(color);
|
||||
glestVersionLabel.setText(" " + masterServerInfo.getGlestVersion());
|
||||
glestVersionLabel.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
glestVersionLabel.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
//general info:
|
||||
//i+= 10;
|
||||
glestVersionLabel.init (i, baseY - lineOffset);
|
||||
glestVersionLabel.setRenderBackground (true);
|
||||
glestVersionLabel.setMaxEditRenderWidth (970); // use background for whole line
|
||||
glestVersionLabel.setTextColor (color);
|
||||
glestVersionLabel.setText (" " + masterServerInfo.getGlestVersion ());
|
||||
glestVersionLabel.setFont (CoreData::getInstance ().
|
||||
getDisplayFontSmall ());
|
||||
glestVersionLabel.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
i+= 80;
|
||||
string platform=masterServerInfo.getPlatform();
|
||||
size_t revOffset = platform.find("-Rev");
|
||||
if(revOffset != platform.npos) {
|
||||
platform = platform.substr(0,revOffset);
|
||||
}
|
||||
i += 80;
|
||||
string platform = masterServerInfo.getPlatform ();
|
||||
size_t revOffset = platform.find ("-Rev");
|
||||
if (revOffset != platform.npos)
|
||||
{
|
||||
platform = platform.substr (0, revOffset);
|
||||
}
|
||||
|
||||
platformLabel.init(i, baseY - lineOffset);
|
||||
platformLabel.setTextColor(color);
|
||||
platformLabel.setText(platform);
|
||||
platformLabel.setFont(CoreData::getInstance().getDisplayFontSmall());
|
||||
platformLabel.setFont3D(CoreData::getInstance().getDisplayFontSmall3D());
|
||||
platformLabel.init (i, baseY - lineOffset);
|
||||
platformLabel.setTextColor (color);
|
||||
platformLabel.setText (platform);
|
||||
platformLabel.setFont (CoreData::getInstance ().getDisplayFontSmall ());
|
||||
platformLabel.setFont3D (CoreData::getInstance ().
|
||||
getDisplayFontSmall3D ());
|
||||
|
||||
// i+=50;
|
||||
// registeredObjNameList.push_back("binaryCompileDateLabel" + intToStr(lineIndex));
|
||||
// binaryCompileDateLabel.registerGraphicComponent(containerName,"binaryCompileDateLabel" + intToStr(lineIndex));
|
||||
// binaryCompileDateLabel.init(i,baseY-lineOffset);
|
||||
// binaryCompileDateLabel.setText(masterServerInfo.getBinaryCompileDate());
|
||||
// i+=50;
|
||||
// registeredObjNameList.push_back("binaryCompileDateLabel" + intToStr(lineIndex));
|
||||
// binaryCompileDateLabel.registerGraphicComponent(containerName,"binaryCompileDateLabel" + intToStr(lineIndex));
|
||||
// binaryCompileDateLabel.init(i,baseY-lineOffset);
|
||||
// binaryCompileDateLabel.setText(masterServerInfo.getBinaryCompileDate());
|
||||
|
||||
//game info:
|
||||
i+= 120;
|
||||
serverTitleLabel.init(i, baseY - lineOffset);
|
||||
serverTitleLabel.setTextColor(color);
|
||||
serverTitleLabel.setText(masterServerInfo.getServerTitle());
|
||||
//game info:
|
||||
i += 120;
|
||||
serverTitleLabel.init (i, baseY - lineOffset);
|
||||
serverTitleLabel.setTextColor (color);
|
||||
serverTitleLabel.setText (masterServerInfo.getServerTitle ());
|
||||
|
||||
i+= 170;
|
||||
country.init(i, baseY - lineOffset);
|
||||
country.setTextColor(color);
|
||||
country.setText(masterServerInfo.getCountry());
|
||||
i += 170;
|
||||
country.init (i, baseY - lineOffset);
|
||||
country.setTextColor (color);
|
||||
country.setText (masterServerInfo.getCountry ());
|
||||
|
||||
string data_path= getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||
string countryLogoPath= data_path + "data/core/misc_textures/flags";
|
||||
string data_path =
|
||||
getGameReadWritePath (GameConstants::path_data_CacheLookupKey);
|
||||
string countryLogoPath = data_path + "data/core/misc_textures/flags";
|
||||
|
||||
Config &config= Config::getInstance();
|
||||
if(config.getString("CountryTexturePath", "") != ""){
|
||||
countryLogoPath = config.getString("CountryTexturePath", "");
|
||||
}
|
||||
endPathWithSlash(countryLogoPath);
|
||||
Config & config = Config::getInstance ();
|
||||
if (config.getString ("CountryTexturePath", "") != "")
|
||||
{
|
||||
countryLogoPath = config.getString ("CountryTexturePath", "");
|
||||
}
|
||||
endPathWithSlash (countryLogoPath);
|
||||
|
||||
string logoFile= countryLogoPath + toLower(masterServerInfo.getCountry()) + ".png";
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] logoFile [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFile.c_str());
|
||||
string logoFile =
|
||||
countryLogoPath + toLower (masterServerInfo.getCountry ()) + ".png";
|
||||
if (SystemFlags::getSystemSettingType (SystemFlags::debugSystem).
|
||||
enabled)
|
||||
SystemFlags::OutputDebug (SystemFlags::debugSystem,
|
||||
"In [%s::%s Line: %d] logoFile [%s]\n",
|
||||
__FILE__, __FUNCTION__, __LINE__,
|
||||
logoFile.c_str ());
|
||||
|
||||
if(fileExists(logoFile) == true){
|
||||
countryTexture= GraphicsInterface::getInstance().getFactory()->newTexture2D();
|
||||
//loadingTexture = renderer.newTexture2D(rsGlobal);
|
||||
countryTexture->setMipmap(true);
|
||||
//loadingTexture->getPixmap()->load(filepath);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] logoFile [%s]\n",__FILE__,__FUNCTION__,__LINE__,logoFile.c_str());
|
||||
countryTexture->load(logoFile);
|
||||
if (fileExists (logoFile) == true)
|
||||
{
|
||||
countryTexture =
|
||||
GraphicsInterface::getInstance ().getFactory ()->newTexture2D ();
|
||||
//loadingTexture = renderer.newTexture2D(rsGlobal);
|
||||
countryTexture->setMipmap (true);
|
||||
//loadingTexture->getPixmap()->load(filepath);
|
||||
if (SystemFlags::getSystemSettingType (SystemFlags::debugSystem).
|
||||
enabled)
|
||||
SystemFlags::OutputDebug (SystemFlags::debugSystem,
|
||||
"In [%s::%s Line: %d] logoFile [%s]\n",
|
||||
__FILE__, __FUNCTION__, __LINE__,
|
||||
logoFile.c_str ());
|
||||
countryTexture->load (logoFile);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if (SystemFlags::getSystemSettingType (SystemFlags::debugSystem).
|
||||
enabled)
|
||||
SystemFlags::OutputDebug (SystemFlags::debugSystem,
|
||||
"In [%s::%s Line: %d]\n", __FILE__,
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
renderer.initTexture(rsGlobal, countryTexture);
|
||||
}
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
renderer.initTexture (rsGlobal, countryTexture);
|
||||
}
|
||||
|
||||
i+= 60;
|
||||
// ipAddressLabel.init(i,baseY-lineOffset);
|
||||
// ipAddressLabel.setText(masterServerInfo.getIpAddress());
|
||||
// i+=100;
|
||||
i += 60;
|
||||
// ipAddressLabel.init(i,baseY-lineOffset);
|
||||
// ipAddressLabel.setText(masterServerInfo.getIpAddress());
|
||||
// i+=100;
|
||||
|
||||
wrongVersionLabel.init(i, baseY - lineOffset);
|
||||
wrongVersionLabel.setTextColor(Vec3f(1.0f,0.0f,0.0f));
|
||||
wrongVersionLabel.setText(lang.getString("IncompatibleVersion"));
|
||||
wrongVersionLabel.init (i, baseY - lineOffset);
|
||||
wrongVersionLabel.setTextColor (Vec3f (1.0f, 0.0f, 0.0f));
|
||||
wrongVersionLabel.setText (lang.getString ("IncompatibleVersion"));
|
||||
|
||||
//game setup info:
|
||||
techLabel.init(i, baseY - lineOffset);
|
||||
techLabel.setTextColor(color);
|
||||
techLabel.setText(masterServerInfo.getTech());
|
||||
//game setup info:
|
||||
techLabel.init (i, baseY - lineOffset);
|
||||
techLabel.setTextColor (color);
|
||||
techLabel.setText (masterServerInfo.getTech ());
|
||||
|
||||
i+= 130;
|
||||
mapLabel.init(i, baseY - lineOffset);
|
||||
mapLabel.setTextColor(color);
|
||||
mapLabel.setText(masterServerInfo.getMap());
|
||||
i+= 130;
|
||||
i += 130;
|
||||
mapLabel.init (i, baseY - lineOffset);
|
||||
mapLabel.setTextColor (color);
|
||||
mapLabel.setText (masterServerInfo.getMap ());
|
||||
i += 130;
|
||||
|
||||
// tilesetLabel.init(i,baseY-lineOffset);
|
||||
// tilesetLabel.setText(masterServerInfo.getTileset());
|
||||
// i+=100;
|
||||
// tilesetLabel.init(i,baseY-lineOffset);
|
||||
// tilesetLabel.setText(masterServerInfo.getTileset());
|
||||
// i+=100;
|
||||
|
||||
activeSlotsLabel.init(i, baseY - lineOffset);
|
||||
activeSlotsLabel.setTextColor(color);
|
||||
activeSlotsLabel.setText(intToStr(masterServerInfo.getActiveSlots()) + "/" + intToStr(
|
||||
masterServerInfo.getNetworkSlots()) + "/" + intToStr(masterServerInfo.getConnectedClients()));
|
||||
activeSlotsLabel.init (i, baseY - lineOffset);
|
||||
activeSlotsLabel.setTextColor (color);
|
||||
activeSlotsLabel.
|
||||
setText (intToStr (masterServerInfo.getActiveSlots ()) + "/" +
|
||||
intToStr (masterServerInfo.getNetworkSlots ()) + "/" +
|
||||
intToStr (masterServerInfo.getConnectedClients ()));
|
||||
|
||||
i+= 50;
|
||||
//externalConnectPort.init(i, baseY - lineOffset);
|
||||
//externalConnectPort.setTextColor(color);
|
||||
//externalConnectPort.setText(intToStr(masterServerInfo.getExternalConnectPort()));
|
||||
i += 50;
|
||||
//externalConnectPort.init(i, baseY - lineOffset);
|
||||
//externalConnectPort.setTextColor(color);
|
||||
//externalConnectPort.setText(intToStr(masterServerInfo.getExternalConnectPort()));
|
||||
|
||||
i+= 30;
|
||||
status.init(i-10, baseY - lineOffset);
|
||||
status.setTextColor(color);
|
||||
status.setText(lang.getString("MGGameStatus" + intToStr(masterServerInfo.getStatus())));
|
||||
i += 30;
|
||||
status.init (i - 10, baseY - lineOffset);
|
||||
status.setTextColor (color);
|
||||
status.setText (lang.
|
||||
getString ("MGGameStatus" +
|
||||
intToStr (masterServerInfo.getStatus ())));
|
||||
|
||||
i+= 130;
|
||||
selectButton.init(i+25, baseY - lineOffset, 35, lineHeight - 5);
|
||||
selectButton.setText(">");
|
||||
selectButton.setAlwaysLighted(true);
|
||||
i += 130;
|
||||
selectButton.init (i + 25, baseY - lineOffset, 35, lineHeight - 5);
|
||||
selectButton.setText (">");
|
||||
selectButton.setAlwaysLighted (true);
|
||||
|
||||
//printf("glestVersionString [%s] masterServerInfo->getGlestVersion() [%s]\n",glestVersionString.c_str(),masterServerInfo->getGlestVersion().c_str());
|
||||
compatible= checkVersionComptability(glestVersionString, masterServerInfo.getGlestVersion());
|
||||
selectButton.setEnabled(compatible);
|
||||
selectButton.setEditable(compatible);
|
||||
//printf("glestVersionString [%s] masterServerInfo->getGlestVersion() [%s]\n",glestVersionString.c_str(),masterServerInfo->getGlestVersion().c_str());
|
||||
compatible =
|
||||
checkVersionComptability (glestVersionString,
|
||||
masterServerInfo.getGlestVersion ());
|
||||
selectButton.setEnabled (compatible);
|
||||
selectButton.setEditable (compatible);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLine::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
void ServerLine::reloadUI ()
|
||||
{
|
||||
Lang & lang = Lang::getInstance ();
|
||||
|
||||
glestVersionLabel.setText(masterServerInfo.getGlestVersion());
|
||||
glestVersionLabel.setText (masterServerInfo.getGlestVersion ());
|
||||
|
||||
string platform = masterServerInfo.getPlatform();
|
||||
size_t revOffset = platform.find("-Rev");
|
||||
if(revOffset != platform.npos) {
|
||||
platform = platform.substr(0,revOffset);
|
||||
}
|
||||
string platform = masterServerInfo.getPlatform ();
|
||||
size_t revOffset = platform.find ("-Rev");
|
||||
if (revOffset != platform.npos)
|
||||
{
|
||||
platform = platform.substr (0, revOffset);
|
||||
}
|
||||
|
||||
platformLabel.setText(platform);
|
||||
platformLabel.setText (platform);
|
||||
|
||||
serverTitleLabel.setText(masterServerInfo.getServerTitle());
|
||||
serverTitleLabel.setText (masterServerInfo.getServerTitle ());
|
||||
|
||||
country.setText(masterServerInfo.getCountry());
|
||||
country.setText (masterServerInfo.getCountry ());
|
||||
|
||||
wrongVersionLabel.setText(lang.getString("IncompatibleVersion"));
|
||||
wrongVersionLabel.setText (lang.getString ("IncompatibleVersion"));
|
||||
|
||||
techLabel.setText(masterServerInfo.getTech());
|
||||
techLabel.setText (masterServerInfo.getTech ());
|
||||
|
||||
mapLabel.setText(masterServerInfo.getMap());
|
||||
activeSlotsLabel.setText(intToStr(masterServerInfo.getActiveSlots()) + "/" + intToStr(
|
||||
masterServerInfo.getNetworkSlots()) + "/" + intToStr(masterServerInfo.getConnectedClients()));
|
||||
mapLabel.setText (masterServerInfo.getMap ());
|
||||
activeSlotsLabel.
|
||||
setText (intToStr (masterServerInfo.getActiveSlots ()) + "/" +
|
||||
intToStr (masterServerInfo.getNetworkSlots ()) + "/" +
|
||||
intToStr (masterServerInfo.getConnectedClients ()));
|
||||
|
||||
//externalConnectPort.setText(intToStr(masterServerInfo.getExternalConnectPort()));
|
||||
//externalConnectPort.setText(intToStr(masterServerInfo.getExternalConnectPort()));
|
||||
|
||||
status.setText(lang.getString("MGGameStatus" + intToStr(masterServerInfo.getStatus())));
|
||||
status.setText (lang.
|
||||
getString ("MGGameStatus" +
|
||||
intToStr (masterServerInfo.getStatus ())));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
GraphicComponent::
|
||||
reloadFontsForRegisterGraphicComponents (containerName);
|
||||
}
|
||||
|
||||
ServerLine::~ServerLine(){
|
||||
//delete masterServerInfo;
|
||||
ServerLine::~ServerLine ()
|
||||
{
|
||||
//delete masterServerInfo;
|
||||
|
||||
if(countryTexture != NULL){
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if (countryTexture != NULL)
|
||||
{
|
||||
if (SystemFlags::getSystemSettingType (SystemFlags::debugSystem).
|
||||
enabled)
|
||||
SystemFlags::OutputDebug (SystemFlags::debugSystem,
|
||||
"In [%s::%s Line: %d]\n", __FILE__,
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
countryTexture->end();
|
||||
delete countryTexture;
|
||||
countryTexture->end ();
|
||||
delete countryTexture;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if (SystemFlags::getSystemSettingType (SystemFlags::debugSystem).
|
||||
enabled)
|
||||
SystemFlags::OutputDebug (SystemFlags::debugSystem,
|
||||
"In [%s::%s Line: %d]\n", __FILE__,
|
||||
__FUNCTION__, __LINE__);
|
||||
|
||||
//delete loadingTexture;
|
||||
countryTexture= NULL;
|
||||
}
|
||||
}
|
||||
//delete loadingTexture;
|
||||
countryTexture = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
bool ServerLine::buttonMouseClick(int x, int y){
|
||||
return selectButton.mouseClick(x, y);
|
||||
}
|
||||
bool ServerLine::buttonMouseClick (int x, int y)
|
||||
{
|
||||
return selectButton.mouseClick (x, y);
|
||||
}
|
||||
|
||||
bool ServerLine::buttonMouseMove(int x, int y){
|
||||
return selectButton.mouseMove(x, y);
|
||||
}
|
||||
bool ServerLine::buttonMouseMove (int x, int y)
|
||||
{
|
||||
return selectButton.mouseMove (x, y);
|
||||
}
|
||||
|
||||
void ServerLine::render(){
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
//general info:
|
||||
renderer.renderLabel(&glestVersionLabel);
|
||||
renderer.renderLabel(&platformLabel);
|
||||
//renderer.renderLabel(&binaryCompileDateLabel);
|
||||
void ServerLine::render ()
|
||||
{
|
||||
Renderer & renderer = Renderer::getInstance ();
|
||||
//general info:
|
||||
renderer.renderLabel (&glestVersionLabel);
|
||||
renderer.renderLabel (&platformLabel);
|
||||
//renderer.renderLabel(&binaryCompileDateLabel);
|
||||
|
||||
|
||||
//game info:
|
||||
renderer.renderLabel(&serverTitleLabel);
|
||||
if(countryTexture != NULL){
|
||||
renderer.renderTextureQuad(country.getX()+1, country.getY()+4, countryTexture->getTextureWidth(),
|
||||
countryTexture->getTextureHeight(), countryTexture, 0.7f);
|
||||
}
|
||||
else{
|
||||
renderer.renderLabel(&country);
|
||||
}
|
||||
if(compatible){
|
||||
if(selectButton.getEnabled() == true){
|
||||
//renderer.renderLabel(&ipAddressLabel);
|
||||
//game setup info:
|
||||
renderer.renderLabel(&techLabel);
|
||||
renderer.renderLabel(&mapLabel);
|
||||
//renderer.renderLabel(&tilesetLabel);
|
||||
renderer.renderLabel(&activeSlotsLabel);
|
||||
//renderer.renderLabel(&externalConnectPort);
|
||||
renderer.renderLabel(&status);
|
||||
}
|
||||
}
|
||||
else{
|
||||
renderer.renderLabel(&wrongVersionLabel);
|
||||
}
|
||||
renderer.renderLabel(&status);
|
||||
//game info:
|
||||
renderer.renderLabel (&serverTitleLabel);
|
||||
if (countryTexture != NULL)
|
||||
{
|
||||
renderer.renderTextureQuad (country.getX () + 1, country.getY () + 4,
|
||||
countryTexture->getTextureWidth (),
|
||||
countryTexture->getTextureHeight (),
|
||||
countryTexture, 0.7f);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.renderLabel (&country);
|
||||
}
|
||||
if (compatible)
|
||||
{
|
||||
if (selectButton.getEnabled () == true)
|
||||
{
|
||||
//renderer.renderLabel(&ipAddressLabel);
|
||||
//game setup info:
|
||||
renderer.renderLabel (&techLabel);
|
||||
renderer.renderLabel (&mapLabel);
|
||||
//renderer.renderLabel(&tilesetLabel);
|
||||
renderer.renderLabel (&activeSlotsLabel);
|
||||
//renderer.renderLabel(&externalConnectPort);
|
||||
renderer.renderLabel (&status);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
renderer.renderLabel (&wrongVersionLabel);
|
||||
}
|
||||
renderer.renderLabel (&status);
|
||||
|
||||
bool joinEnabled= (masterServerInfo.getNetworkSlots() > masterServerInfo.getConnectedClients());
|
||||
if(joinEnabled == true){
|
||||
if(compatible){
|
||||
selectButton.setEnabled(true);
|
||||
selectButton.setVisible(true);
|
||||
renderer.renderButton(&selectButton);
|
||||
}
|
||||
}
|
||||
else{
|
||||
selectButton.setEnabled(false);
|
||||
selectButton.setVisible(false);
|
||||
}
|
||||
}
|
||||
bool joinEnabled =
|
||||
(masterServerInfo.getNetworkSlots () >
|
||||
masterServerInfo.getConnectedClients ());
|
||||
if (joinEnabled == true)
|
||||
{
|
||||
if (compatible)
|
||||
{
|
||||
selectButton.setEnabled (true);
|
||||
selectButton.setVisible (true);
|
||||
renderer.renderButton (&selectButton);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
selectButton.setEnabled (false);
|
||||
selectButton.setVisible (false);
|
||||
}
|
||||
}
|
||||
|
||||
void ServerLine::setY(int y){
|
||||
selectButton.setY(y);
|
||||
void ServerLine::setY (int y)
|
||||
{
|
||||
selectButton.setY (y);
|
||||
|
||||
//general info:
|
||||
glestVersionLabel.setY(y);
|
||||
platformLabel.setY(y);
|
||||
//binaryCompileDateLabel.setY(y);
|
||||
//general info:
|
||||
glestVersionLabel.setY (y);
|
||||
platformLabel.setY (y);
|
||||
//binaryCompileDateLabel.setY(y);
|
||||
|
||||
//game info:
|
||||
serverTitleLabel.setY(y);
|
||||
country.setY(y);
|
||||
status.setY(y);
|
||||
//ipAddressLabel.setY(y);
|
||||
//game info:
|
||||
serverTitleLabel.setY (y);
|
||||
country.setY (y);
|
||||
status.setY (y);
|
||||
//ipAddressLabel.setY(y);
|
||||
|
||||
//game setup info:
|
||||
techLabel.setY(y);
|
||||
mapLabel.setY(y);
|
||||
//tilesetLabel.setY(y);
|
||||
activeSlotsLabel.setY(y);
|
||||
//game setup info:
|
||||
techLabel.setY (y);
|
||||
mapLabel.setY (y);
|
||||
//tilesetLabel.setY(y);
|
||||
activeSlotsLabel.setY (y);
|
||||
|
||||
//externalConnectPort.setY(y);
|
||||
//externalConnectPort.setY(y);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}//end namespace
|
||||
}
|
||||
} //end namespace
|
||||
|
@ -1,83 +1,94 @@
|
||||
// ==============================================================
|
||||
// This file is part of Glest (www.glest.org)
|
||||
// This file is part of Glest (www.glest.org)
|
||||
//
|
||||
// Copyright (C) 2010- by Titus Tscharntke
|
||||
// Copyright (C) 2010- by Titus Tscharntke
|
||||
//
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// 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
|
||||
// License, or (at your option) any later version
|
||||
// ==============================================================
|
||||
|
||||
#ifndef _GLEST_GAME_SERVERLINE_H_
|
||||
#define _GLEST_GAME_SERVERLINE_H_
|
||||
# define _GLEST_GAME_SERVERLINE_H_
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock2.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
# ifdef WIN32
|
||||
# include <winsock2.h>
|
||||
# include <winsock.h>
|
||||
# endif
|
||||
|
||||
#include "masterserver_info.h"
|
||||
#include "components.h"
|
||||
#include "lang.h"
|
||||
#include "world.h"
|
||||
# include "masterserver_info.h"
|
||||
# include "components.h"
|
||||
# include "lang.h"
|
||||
# include "world.h"
|
||||
|
||||
#include "leak_dumper.h"
|
||||
# include "leak_dumper.h"
|
||||
|
||||
namespace Glest{ namespace Game{
|
||||
namespace Glest
|
||||
{
|
||||
namespace Game
|
||||
{
|
||||
|
||||
// ===============================
|
||||
// ServerLine
|
||||
// ServerLine
|
||||
// ===============================
|
||||
|
||||
class ServerLine {
|
||||
private:
|
||||
class ServerLine
|
||||
{
|
||||
private:
|
||||
|
||||
MasterServerInfo masterServerInfo;
|
||||
int lineHeight;
|
||||
int baseY;
|
||||
bool compatible;
|
||||
GraphicButton selectButton;
|
||||
GraphicLabel wrongVersionLabel;
|
||||
MasterServerInfo masterServerInfo;
|
||||
int lineHeight;
|
||||
int baseY;
|
||||
bool compatible;
|
||||
GraphicButton selectButton;
|
||||
GraphicLabel wrongVersionLabel;
|
||||
|
||||
//general info:
|
||||
GraphicLabel glestVersionLabel;
|
||||
GraphicLabel platformLabel;
|
||||
//GraphicLabel binaryCompileDateLabel;
|
||||
//general info:
|
||||
GraphicLabel glestVersionLabel;
|
||||
GraphicLabel platformLabel;
|
||||
//GraphicLabel binaryCompileDateLabel;
|
||||
|
||||
//game info:
|
||||
GraphicLabel serverTitleLabel;
|
||||
GraphicLabel ipAddressLabel;
|
||||
//game info:
|
||||
GraphicLabel serverTitleLabel;
|
||||
GraphicLabel ipAddressLabel;
|
||||
|
||||
//game setup info:
|
||||
GraphicLabel techLabel;
|
||||
GraphicLabel mapLabel;
|
||||
GraphicLabel tilesetLabel;
|
||||
GraphicLabel activeSlotsLabel;
|
||||
//game setup info:
|
||||
GraphicLabel techLabel;
|
||||
GraphicLabel mapLabel;
|
||||
GraphicLabel tilesetLabel;
|
||||
GraphicLabel activeSlotsLabel;
|
||||
|
||||
GraphicLabel externalConnectPort;
|
||||
GraphicLabel externalConnectPort;
|
||||
|
||||
GraphicLabel country;
|
||||
GraphicLabel status;
|
||||
GraphicLabel country;
|
||||
GraphicLabel status;
|
||||
|
||||
Texture2D *countryTexture;
|
||||
Texture2D *countryTexture;
|
||||
|
||||
const char * containerName;
|
||||
const char *containerName;
|
||||
|
||||
public:
|
||||
ServerLine( MasterServerInfo *mServerInfo, int lineIndex, int baseY, int lineHeight, const char *containerName);
|
||||
virtual ~ServerLine();
|
||||
MasterServerInfo *getMasterServerInfo() {return &masterServerInfo;}
|
||||
const int getLineHeight() const {return lineHeight;}
|
||||
bool buttonMouseClick(int x, int y);
|
||||
bool buttonMouseMove(int x, int y);
|
||||
void setY(int y);
|
||||
//void setIndex(int value);
|
||||
void render();
|
||||
public:
|
||||
ServerLine (MasterServerInfo * mServerInfo, int lineIndex, int baseY,
|
||||
int lineHeight, const char *containerName);
|
||||
virtual ~ ServerLine ();
|
||||
MasterServerInfo *getMasterServerInfo ()
|
||||
{
|
||||
return &masterServerInfo;
|
||||
}
|
||||
const int getLineHeight () const
|
||||
{
|
||||
return lineHeight;
|
||||
}
|
||||
bool buttonMouseClick (int x, int y);
|
||||
bool buttonMouseMove (int x, int y);
|
||||
void setY (int y);
|
||||
//void setIndex(int value);
|
||||
void render ();
|
||||
|
||||
virtual void reloadUI();
|
||||
};
|
||||
virtual void reloadUI ();
|
||||
};
|
||||
|
||||
}}//end namespace
|
||||
}} //end namespace
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user