Merge branch 'develop' of https://github.com/MegaGlest/megaglest-source into develop
This commit is contained in:
commit
edd9ae1fca
|
@ -4,12 +4,26 @@
|
|||
# Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
|
||||
# Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+
|
||||
|
||||
CPPCHECK=$(which cppcheck)
|
||||
# (Actual) Location of the cppcheck binary
|
||||
CPPCHECK=$(readlink -f $(which cppcheck))
|
||||
|
||||
# cppcheck now depends on this library (see 'cppcheck --help' for the '--library' option)
|
||||
# If you use the Debian / Ubuntu package set this to: /usr/share/cppcheck/cfg/std.cfg
|
||||
CPPCHECKLIB=$(dirname $CPPCHECK)/cfg/std.cfg
|
||||
|
||||
# File to write results to
|
||||
LOGFILE=/tmp/cppcheck.log
|
||||
|
||||
CPUS=`lscpu -p | grep -cv '^#'`
|
||||
if [ "$CPUS" = '' ]; then CPUS=1; fi
|
||||
|
||||
$CPPCHECK ../../source/ -i ../../source/win32_deps -i ../../source/configurator -i ../../source/shared_lib/sources/libircclient -i ../../source/shared_lib/sources/platform/miniupnpc -i ../../source/shared_lib/sources/streflop -j $CPUS --enable=all --force --verbose 2> $LOGFILE
|
||||
$CPPCHECK ../../source/ \
|
||||
-i ../../source/win32_deps \
|
||||
-i ../../source/configurator \
|
||||
-i ../../source/shared_lib/sources/libircclient \
|
||||
-i ../../source/shared_lib/sources/platform/miniupnpc \
|
||||
-i ../../source/shared_lib/sources/streflop \
|
||||
--library=$CPPCHECKLIB \
|
||||
--enable=all \
|
||||
--force \
|
||||
--verbose \
|
||||
2> $LOGFILE
|
||||
|
||||
echo "Results from cppcheck were written to $LOGFILE"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
// Set your assigned depot ID here
|
||||
"DepotID" "578873"
|
||||
"ContentRoot" "/home/softcoder/Code/steamworks_sdk/sdk/tools/ContentBuilder/content/base_content"
|
||||
"ContentRoot" "../content/base_content"
|
||||
|
||||
// include all files recursivley
|
||||
"FileMapping"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
// Set your assigned depot ID here
|
||||
"DepotID" "578871"
|
||||
"ContentRoot" "/home/softcoder/Code/steamworks_sdk/sdk/tools/ContentBuilder/content/linux_x64"
|
||||
"ContentRoot" "../content/linux_x64"
|
||||
|
||||
// include all files recursivley
|
||||
"FileMapping"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
// Set your assigned depot ID here
|
||||
"DepotID" "578874"
|
||||
"ContentRoot" "C:\Code\steamworks_sdk\sdk\tools\ContentBuilder\content\win_x64\"
|
||||
"ContentRoot" "..\content\win_x64\"
|
||||
|
||||
// include all files recursivley
|
||||
"FileMapping"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{
|
||||
// Set your assigned depot ID here
|
||||
"DepotID" "578872"
|
||||
"ContentRoot" "C:\Code\steamworks_sdk\sdk\tools\ContentBuilder\content\win_x86\"
|
||||
"ContentRoot" "..\content\win_x86\"
|
||||
|
||||
// include all files recursivley
|
||||
"FileMapping"
|
||||
|
|
|
@ -49,6 +49,39 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
|
|||
MESSAGE(STATUS " wxWidgets: ${wxWidgets_INCLUDE_DIRS} ;/; ${wxWidgets_LIBRARIES}")
|
||||
ENDIF()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(STREFLOP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${PROJECT_SOURCE_DIR}/source/win32_deps/wxWidgets-2.8.10/lib/libwx_mswu-2.8-i586-mingw32msvc.dll.a)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${PROJECT_SOURCE_DIR}/source/win32_deps/wxWidgets-2.8.10/lib/libwx_mswu_gl-2.8-i586-mingw32msvc.dll.a)
|
||||
|
@ -107,7 +140,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
|
|||
${GLEST_MAIN_INCLUDE_ROOT}global
|
||||
${GLEST_MAIN_INCLUDE_ROOT}sound)
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
${GLEST_LIB_INCLUDE_DIRS}
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop)
|
||||
|
@ -157,7 +190,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
|
|||
|
||||
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -139,11 +139,44 @@ IF(BUILD_MEGAGLEST)
|
|||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(STREFLOP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#########################################################################################
|
||||
# megaglest game
|
||||
|
||||
SET(DIRS_WITH_SRC
|
||||
ai
|
||||
ai
|
||||
facilities
|
||||
game
|
||||
global
|
||||
|
@ -174,7 +207,7 @@ IF(BUILD_MEGAGLEST)
|
|||
${GLEST_LIB_INCLUDE_ROOT}lua
|
||||
${GLEST_LIB_INCLUDE_ROOT}map)
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
${GLEST_LIB_INCLUDE_DIRS}
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop
|
||||
|
@ -241,7 +274,7 @@ IF(BUILD_MEGAGLEST)
|
|||
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
|
||||
SET(MG_STREFLOP "")
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
SET(MG_STREFLOP "streflop")
|
||||
ENDIF()
|
||||
|
||||
|
@ -262,7 +295,7 @@ IF(BUILD_MEGAGLEST)
|
|||
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 ${SDL_VERSION_NAME} ${SDL_VERSION_NAME}main lua5.1 ${MG_STREFLOP} libmegaglest stdc++ moldname mingwex msvcrt user32 kernel32)
|
||||
ENDIF()
|
||||
IF(NOT WIN32)
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${MG_STREFLOP})
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "util.h"
|
||||
#include "conversion.h"
|
||||
#include "lang.h"
|
||||
#include "gen_uuid.h"
|
||||
//#include <cxxabi.h>
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -39,12 +41,23 @@ Vec3f GraphicComponent::customTextColor = Vec3f(1.0,1.0,1.0);
|
|||
|
||||
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
|
||||
|
||||
GraphicComponent::GraphicComponent(std::string containerName, std::string objName) {
|
||||
GraphicComponent::GraphicComponent(std::string containerName, std::string objName, bool registerControl) {
|
||||
this->containerName = containerName;
|
||||
this->instanceName = "";
|
||||
if(objName != "") {
|
||||
if(containerName == "" || objName == "") {
|
||||
//char szBuf[8096]="";
|
||||
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",containerName.c_str(),objName.c_str());
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
if(objName != "" && registerControl) {
|
||||
registerGraphicComponent(containerName,objName);
|
||||
}
|
||||
else {
|
||||
this->instanceName = objName;
|
||||
}
|
||||
this->fontCallbackName = objName + "_" + getNewUUD();
|
||||
CoreData::getInstance().registerFontChangedCallback(this->getFontCallbackName(), this);
|
||||
|
||||
enabled = true;
|
||||
editable = true;
|
||||
visible = true;
|
||||
|
@ -58,8 +71,14 @@ GraphicComponent::GraphicComponent(std::string containerName, std::string objNam
|
|||
textNativeTranslation = "";
|
||||
}
|
||||
|
||||
string GraphicComponent::getNewUUD() {
|
||||
char uuid_str[38];
|
||||
get_uuid_string(uuid_str,sizeof(uuid_str));
|
||||
return string(uuid_str);
|
||||
}
|
||||
|
||||
GraphicComponent::~GraphicComponent() {
|
||||
CoreData::getInstance().unRegisterFontChangedCallback(this->getInstanceName());
|
||||
CoreData::getInstance().unRegisterFontChangedCallback(this->getFontCallbackName());
|
||||
}
|
||||
|
||||
void GraphicComponent::clearRegisteredComponents(std::string containerName) {
|
||||
|
@ -85,18 +104,44 @@ void GraphicComponent::clearRegisterGraphicComponent(std::string containerName,
|
|||
}
|
||||
|
||||
void GraphicComponent::registerGraphicComponent(std::string containerName, std::string objName) {
|
||||
// unregistered old name if we have been renamed
|
||||
if(this->getInstanceName() != "") {
|
||||
//printf("RENAME Register Callback detected calling: Control old [%s] new [%s]\n",this->getInstanceName().c_str(),objName.c_str());
|
||||
clearRegisterGraphicComponent(this->containerName, this->getInstanceName());
|
||||
}
|
||||
else {
|
||||
//printf("NEW Register Callback detected calling: Control container [%s] name [%s]\n",containerName.c_str(),objName.c_str());
|
||||
}
|
||||
|
||||
if(containerName == "" || objName == "") {
|
||||
//char szBuf[8096]="";
|
||||
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str());
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
this->containerName = containerName;
|
||||
this->instanceName = objName;
|
||||
registeredGraphicComponentList[containerName][objName] = this;
|
||||
CoreData::getInstance().registerFontChangedCallback(this->getInstanceName(), this);
|
||||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] registered [%s] [%s] count = %d\n",__FILE__,__FUNCTION__,__LINE__,containerName.c_str(),instanceName.c_str(),registeredGraphicComponentList[containerName].size());
|
||||
}
|
||||
|
||||
void GraphicComponent::registerGraphicComponentOnlyFontCallbacks(std::string containerName, std::string objName) {
|
||||
if(this->getInstanceName() != "") {
|
||||
//printf("(FONT ONLY) RENAME Register Callback detected calling: Control old [%s] new [%s]\n",this->getInstanceName().c_str(),objName.c_str());
|
||||
clearRegisterGraphicComponent(this->containerName, this->getInstanceName());
|
||||
}
|
||||
else {
|
||||
//printf("(FONT ONLY) NEW Register Callback detected calling: Control container [%s] name [%s]\n",containerName.c_str(),objName.c_str());
|
||||
}
|
||||
|
||||
if(containerName == "" || objName == "") {
|
||||
//char szBuf[8096]="";
|
||||
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str());
|
||||
//throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
this->containerName = containerName;
|
||||
this->instanceName = objName;
|
||||
CoreData::getInstance().registerFontChangedCallback(this->getInstanceName(), this);
|
||||
}
|
||||
|
||||
GraphicComponent * GraphicComponent::findRegisteredComponent(std::string containerName, std::string objName) {
|
||||
|
@ -149,8 +194,6 @@ void GraphicComponent::applyCustomProperties(std::string containerName) {
|
|||
ctl->w = config.getInt(containerName + "_" + iterFind2->first + "_w_" + languageToken, intToStr(ctl->w).c_str());
|
||||
ctl->h = config.getInt(containerName + "_" + iterFind2->first + "_h_" + languageToken, intToStr(ctl->h).c_str());
|
||||
ctl->visible = config.getBool(containerName + "_" + iterFind2->first + "_visible_" + languageToken,boolToStr(ctl->visible).c_str());
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,7 +285,7 @@ void GraphicComponent::setFont3D(Font3D *font) {
|
|||
}
|
||||
|
||||
void GraphicComponent::FontChangedCallback(std::string fontUniqueId, Font *font) {
|
||||
//printf("In FontChanged for [%s] font [%p]\n", fontUniqueId.c_str(),font);
|
||||
//printf("In FontChanged for [%s] font [%p] Control 2D [%s] 3D [%s]\n", fontUniqueId.c_str(),font,this->font2DUniqueId.c_str(),this->font3DUniqueId.c_str());
|
||||
if (fontUniqueId != "") {
|
||||
if (fontUniqueId == this->font2DUniqueId) {
|
||||
if (font != NULL) {
|
||||
|
@ -327,7 +370,8 @@ void GraphicComponent::resetFade(){
|
|||
const int GraphicLabel::defH= 20;
|
||||
const int GraphicLabel::defW= 70;
|
||||
|
||||
GraphicLabel::GraphicLabel() {
|
||||
GraphicLabel::GraphicLabel(std::string containerName, std::string objName, bool registerControl) :
|
||||
GraphicComponent(containerName, objName, registerControl) {
|
||||
centered = false;
|
||||
wordWrap = false;
|
||||
centeredW = -1;
|
||||
|
@ -394,8 +438,8 @@ void GraphicLabel::setCenteredH(bool centered) {
|
|||
const int GraphicButton::defH= 22;
|
||||
const int GraphicButton::defW= 90;
|
||||
|
||||
GraphicButton::GraphicButton(std::string containerName, std::string objName) :
|
||||
GraphicComponent(containerName,objName) {
|
||||
GraphicButton::GraphicButton(std::string containerName, std::string objName, bool registerControl) :
|
||||
GraphicComponent(containerName,objName,registerControl) {
|
||||
|
||||
lighted = false;
|
||||
alwaysLighted = false;
|
||||
|
@ -426,8 +470,8 @@ const int GraphicListBox::defH= 22;
|
|||
const int GraphicListBox::defW= 140;
|
||||
|
||||
GraphicListBox::GraphicListBox(std::string containerName, std::string objName)
|
||||
: GraphicComponent(containerName, objName), graphButton1(containerName, instanceName + "_button1"),
|
||||
graphButton2(containerName, instanceName + "_button2") {
|
||||
: GraphicComponent(containerName, objName), graphButton1(containerName, objName + "_button1"),
|
||||
graphButton2(containerName, objName + "_button2") {
|
||||
selectedItemIndex = 0;
|
||||
lighted = false;
|
||||
leftControlled = false;
|
||||
|
@ -497,14 +541,6 @@ void GraphicListBox::setLeftControlled(bool leftControlled) {
|
|||
graphButton1.setW(graphButton1.getW()-4);
|
||||
graphButton2.setY(graphButton2.getY()+2);
|
||||
graphButton1.setY(graphButton1.getY()+2);
|
||||
|
||||
// graphButton2.setX(x);
|
||||
// graphButton2.setH(graphButton2.getH()/2);
|
||||
// graphButton2.setW(graphButton2.getW()/2);
|
||||
// graphButton1.setH(graphButton1.getH()/2);
|
||||
// graphButton1.setW(graphButton1.getW()/2);
|
||||
// graphButton2.setY(graphButton2.getY()+graphButton1.getH());
|
||||
|
||||
}
|
||||
else {
|
||||
graphButton2.setX(x+w-graphButton2.getW()+4);
|
||||
|
@ -514,14 +550,6 @@ void GraphicListBox::setLeftControlled(bool leftControlled) {
|
|||
graphButton1.setW(graphButton1.getW()+4);
|
||||
graphButton2.setY(graphButton2.getY()-2);
|
||||
graphButton1.setY(graphButton1.getY()-2);
|
||||
|
||||
|
||||
// graphButton2.setY(graphButton2.getY()-graphButton1.getH());
|
||||
// graphButton2.setH(graphButton2.getH()*2);
|
||||
// graphButton2.setW(graphButton2.getW()*2);
|
||||
// graphButton1.setH(graphButton1.getH()*2);
|
||||
// graphButton1.setW(graphButton1.getW()*2);
|
||||
// graphButton2.setX(x+w-graphButton2.getW());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -680,13 +708,12 @@ const int GraphicMessageBox::defH= 280;
|
|||
const int GraphicMessageBox::defW= 350;
|
||||
|
||||
GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objName) :
|
||||
GraphicComponent(containerName, objName){
|
||||
GraphicComponent(containerName, objName) {
|
||||
header= "";
|
||||
autoWordWrap=true;
|
||||
}
|
||||
|
||||
GraphicMessageBox::~GraphicMessageBox(){
|
||||
//remove buttons
|
||||
removeButtons();
|
||||
}
|
||||
|
||||
|
@ -722,7 +749,7 @@ void GraphicMessageBox::init(int newWidth, int newHeight) {
|
|||
}
|
||||
|
||||
void GraphicMessageBox::addButton(const string &buttonStr, int width, int height){
|
||||
GraphicButton *newButton= new GraphicButton(containerName, instanceName + "_" + buttonStr);
|
||||
GraphicButton *newButton= new GraphicButton(containerName, instanceName + "_Button_" + buttonStr);
|
||||
newButton->init(0, 0);
|
||||
newButton->setText(buttonStr);
|
||||
if(width != -1){
|
||||
|
@ -1014,7 +1041,9 @@ void GraphicScrollBar::arrangeComponents(vector<GraphicComponent *> &gcs) {
|
|||
const int PopupMenu::defH= 240;
|
||||
const int PopupMenu::defW= 350;
|
||||
|
||||
PopupMenu::PopupMenu() {
|
||||
PopupMenu::PopupMenu(std::string containerName, std::string objName) : GraphicComponent(containerName, objName, false) {
|
||||
registerGraphicComponentOnlyFontCallbacks(containerName,objName);
|
||||
|
||||
h= defH;
|
||||
w= defW;
|
||||
}
|
||||
|
@ -1076,8 +1105,8 @@ void PopupMenu::init(string menuHeader,std::vector<string> menuItems) {
|
|||
}
|
||||
|
||||
for(unsigned int i = 0; i < menuItems.size(); ++i) {
|
||||
GraphicButton button;
|
||||
button.registerGraphicComponentOnlyFontCallbacks(containerName, instanceName + "_Button_" + menuItems[i]);
|
||||
GraphicButton button(containerName, instanceName + "_Popup_Button_" + menuItems[i],false);
|
||||
button.registerGraphicComponentOnlyFontCallbacks(containerName, instanceName + "_Popup_Button_" + menuItems[i]);
|
||||
button.init(x+(w-maxButtonWidth)/2, yStartOffset - (i*(textHeight + textHeightSpacing)));
|
||||
button.setText(menuItems[i]);
|
||||
button.setW(maxButtonWidth);
|
||||
|
|
|
@ -69,11 +69,13 @@ protected:
|
|||
|
||||
string containerName;
|
||||
string instanceName;
|
||||
string fontCallbackName;
|
||||
|
||||
string getNewUUD();
|
||||
virtual void FontChangedCallback(std::string fontUniqueId, Font *font);
|
||||
|
||||
public:
|
||||
GraphicComponent(std::string containerName="", std::string objName="");
|
||||
GraphicComponent(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
virtual ~GraphicComponent();
|
||||
|
||||
static void setCustomTextColor(Vec3f value) { customTextColor = value; }
|
||||
|
@ -93,7 +95,9 @@ public:
|
|||
|
||||
virtual void init(int x, int y, int w, int h);
|
||||
|
||||
string getContainerName() const { return containerName; }
|
||||
string getInstanceName() const { return instanceName; }
|
||||
string getFontCallbackName() const { return fontCallbackName; }
|
||||
void setInstanceName(string value) { instanceName = value; }
|
||||
|
||||
virtual int getX() const {return x;}
|
||||
|
@ -160,7 +164,7 @@ private:
|
|||
Texture2D *texture;
|
||||
|
||||
public:
|
||||
GraphicLabel();
|
||||
GraphicLabel(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false);
|
||||
|
||||
virtual bool mouseMove(int x, int y);
|
||||
|
@ -224,7 +228,7 @@ private:
|
|||
Texture *customTexture;
|
||||
|
||||
public:
|
||||
GraphicButton(std::string containerName="", std::string objName="");
|
||||
GraphicButton(std::string containerName="", std::string objName="", bool registerControl=true);
|
||||
void init(int x, int y, int w=defW, int h=defH);
|
||||
|
||||
bool getUseCustomTexture() const { return useCustomTexture; }
|
||||
|
@ -443,7 +447,7 @@ private:
|
|||
string header;
|
||||
|
||||
public:
|
||||
PopupMenu();
|
||||
PopupMenu(std::string containerName="", std::string objName="");
|
||||
virtual ~PopupMenu();
|
||||
void init(string menuHeader, std::vector<string> menuItems);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ const int Logger::logLineCount= 15;
|
|||
|
||||
// ===================== PUBLIC ========================
|
||||
|
||||
Logger::Logger() {
|
||||
Logger::Logger() : buttonCancel("Logger","buttonCancel"), buttonNextHint("Logger","buttonCancel") {
|
||||
progress = 0;
|
||||
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
|
||||
if(logs_path != "") {
|
||||
|
|
|
@ -490,7 +490,7 @@ void ChatManager::updateNetwork() {
|
|||
if(msg.chatText.find(playerName) != string::npos){
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
soundRenderer.playFx(coreData.getHighlightSound());
|
||||
soundRenderer.playFx(coreData.getHighlightSound(),true);
|
||||
}
|
||||
console->addLine(msg.chatText.substr(1,msg.chatText.size()), true, msg.chatPlayerIndex,Vec3f(1.f, 1.f, 1.f),teamMode);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "core_data.h"
|
||||
#include <stdexcept>
|
||||
#include "network_manager.h"
|
||||
#include "gen_uuid.h"
|
||||
#include "leak_dumper.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -30,8 +31,10 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
|
||||
Console::Console() {
|
||||
//config
|
||||
this->instanceName = "Generic-Console";
|
||||
registerGraphicComponent("Console", "Generic-Console");
|
||||
this->fontCallbackName = getInstanceName() + "_" + getNewUUD();
|
||||
CoreData::getInstance().registerFontChangedCallback(this->getFontCallbackName(), this);
|
||||
|
||||
maxLines = Config::getInstance().getInt("ConsoleMaxLines");
|
||||
maxStoredLines = Config::getInstance().getInt("ConsoleMaxLinesStored");
|
||||
timeout = Config::getInstance().getInt("ConsoleTimeout");
|
||||
|
@ -46,8 +49,14 @@ Console::Console() {
|
|||
onlyChatMessagesInStoredLines=true;
|
||||
}
|
||||
|
||||
string Console::getNewUUD() {
|
||||
char uuid_str[38];
|
||||
get_uuid_string(uuid_str,sizeof(uuid_str));
|
||||
return string(uuid_str);
|
||||
}
|
||||
|
||||
Console::~Console() {
|
||||
CoreData::getInstance().unRegisterFontChangedCallback(this->getInstanceName());
|
||||
CoreData::getInstance().unRegisterFontChangedCallback(this->getFontCallbackName());
|
||||
}
|
||||
|
||||
void Console::setFont(Font2D *font) {
|
||||
|
@ -72,11 +81,9 @@ void Console::setFont3D(Font3D *font) {
|
|||
|
||||
void Console::registerGraphicComponent(std::string containerName, std::string objName) {
|
||||
this->instanceName = objName;
|
||||
CoreData::getInstance().registerFontChangedCallback(this->getInstanceName(), this);
|
||||
}
|
||||
|
||||
void Console::FontChangedCallback(std::string fontUniqueId, Font *font) {
|
||||
//printf("In FontChanged for [%s] font [%p]\n", fontUniqueId.c_str(),font);
|
||||
if (fontUniqueId != "") {
|
||||
if (fontUniqueId == this->font2DUniqueId) {
|
||||
if (font != NULL) {
|
||||
|
|
|
@ -83,14 +83,19 @@ private:
|
|||
bool onlyChatMessagesInStoredLines;
|
||||
|
||||
string instanceName;
|
||||
string fontCallbackName;
|
||||
|
||||
string getNewUUD();
|
||||
|
||||
public:
|
||||
|
||||
Console();
|
||||
virtual ~Console();
|
||||
|
||||
void registerGraphicComponent(std::string containerName, std::string objName);
|
||||
string getInstanceName() const { return instanceName; }
|
||||
void setInstanceName(string value) { instanceName = value; }
|
||||
string getFontCallbackName() const { return fontCallbackName; }
|
||||
|
||||
int getStoredLineCount() const {return (int)storedLines.size();}
|
||||
int getLineCount() const {return (int)lines.size();}
|
||||
|
|
|
@ -3097,7 +3097,7 @@ void Game::addOrReplaceInHighlightedCells(MarkedCell mc){
|
|||
//printf("faction [%p][%s]\n",faction,(faction != NULL ? faction->getType()->getName().c_str() : ""));
|
||||
if((faction == NULL) ||
|
||||
(faction->getTeam() == getWorld()->getThisFaction()->getTeam())) {
|
||||
soundRenderer.playFx(coreData.getMarkerSound());
|
||||
soundRenderer.playFx(coreData.getMarkerSound(),true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5291,13 +5291,6 @@ void Game::render3d(){
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderUnits]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
// renderTeamColorPlane
|
||||
if((renderExtraTeamColor&renderTeamColorPlaneBit)>0){
|
||||
renderer.renderTeamColorPlane();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderObjects]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
}
|
||||
|
||||
//water
|
||||
renderer.renderWater();
|
||||
renderer.renderWaterEffects();
|
||||
|
@ -5319,6 +5312,13 @@ void Game::render3d(){
|
|||
renderer.renderHealthBars(healthbarMode);
|
||||
}
|
||||
|
||||
// renderTeamColorPlane
|
||||
if((renderExtraTeamColor&renderTeamColorPlaneBit)>0){
|
||||
renderer.renderTeamColorPlane();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderObjects]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
}
|
||||
|
||||
//mouse 3d
|
||||
renderer.renderMouse3d();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderMouse3d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
|
||||
|
|
|
@ -1156,8 +1156,8 @@ bool CoreData::hasBattleEndVideoFilename(bool won) const {
|
|||
|
||||
void CoreData::registerFontChangedCallback(std::string entityName, FontChangedCallbackInterface *cb) {
|
||||
if(entityName == "") {
|
||||
//printf("Register Font Callback detected a blank entityName!\n");
|
||||
//throw megaglest_runtime_error("Register Font Callback detected a blank entityName!");
|
||||
printf("Register Font Callback detected a blank entityName!\n");
|
||||
throw megaglest_runtime_error("Register Font Callback detected a blank entityName!");
|
||||
}
|
||||
if (entityName != "") {
|
||||
registeredFontChangedCallbacks[entityName].push_back(cb);
|
||||
|
@ -1165,25 +1165,25 @@ void CoreData::registerFontChangedCallback(std::string entityName, FontChangedCa
|
|||
}
|
||||
void CoreData::unRegisterFontChangedCallback(std::string entityName) {
|
||||
if (entityName == "") {
|
||||
//printf("UnRegister Font Callback detected a blank entityName!\n");
|
||||
//throw megaglest_runtime_error("UnRegister Font Callback detected a blank entityName!");
|
||||
printf("UnRegister Font Callback detected a blank entityName!\n");
|
||||
throw megaglest_runtime_error("UnRegister Font Callback detected a blank entityName!");
|
||||
}
|
||||
if(entityName != "") {
|
||||
registeredFontChangedCallbacks.erase(entityName);
|
||||
}
|
||||
}
|
||||
void CoreData::triggerFontChangedCallbacks(std::string fontUniqueId, Font *font) {
|
||||
for (std::map<std::string, std::vector<FontChangedCallbackInterface *>>::const_iterator iterMap =
|
||||
for (std::map<std::string, std::vector<FontChangedCallbackInterface *> >::const_iterator iterMap =
|
||||
registeredFontChangedCallbacks.begin();
|
||||
iterMap != registeredFontChangedCallbacks.end(); iterMap++) {
|
||||
for (int index = 0; index < iterMap->second.size(); ++index) {
|
||||
for (unsigned int index = 0; index < iterMap->second.size(); ++index) {
|
||||
//printf("Font Callback detected calling: Control [%s] for Font: [%s] value [%p]\n",iterMap->first.c_str(),fontUniqueId.c_str(),font);
|
||||
FontChangedCallbackInterface *cb = iterMap->second[index];
|
||||
cb->FontChangedCallback(fontUniqueId, font);
|
||||
}
|
||||
}
|
||||
}
|
||||
void CoreData::loadFonts() {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
//display font
|
||||
|
@ -1202,40 +1202,10 @@ void CoreData::loadFonts() {
|
|||
if(lang.hasString("FontDisplayBaseSize") == true) {
|
||||
displayFontSize = computeFontSize(strToInt(lang.getString("FontDisplayBaseSize")));
|
||||
}
|
||||
|
||||
string displayFontName = displayFontNamePrefix + intToStr(displayFontSize) + displayFontNamePostfix;
|
||||
|
||||
if(displayFont) {
|
||||
string fontUniqueId = displayFont->getFontUniqueId();
|
||||
renderer.endFont(displayFont, rsGlobal);
|
||||
displayFont=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, displayFont);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
displayFont= renderer.newFont(rsGlobal);
|
||||
if(displayFont) {
|
||||
displayFont->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
|
||||
displayFont->setSize(displayFontSize);
|
||||
displayFont->setFontUniqueId("displayFont");
|
||||
triggerFontChangedCallbacks(displayFont->getFontUniqueId(), displayFont);
|
||||
}
|
||||
}
|
||||
|
||||
if(displayFont3D) {
|
||||
string fontUniqueId = displayFont3D->getFontUniqueId();
|
||||
renderer.endFont(displayFont3D, rsGlobal);
|
||||
displayFont3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, displayFont3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
displayFont3D= renderer.newFont3D(rsGlobal);
|
||||
if(displayFont3D) {
|
||||
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
|
||||
displayFont3D->setSize(displayFontSize);
|
||||
displayFont3D->setFontUniqueId("displayFont3D");
|
||||
triggerFontChangedCallbacks(displayFont3D->getFontUniqueId(), displayFont3D);
|
||||
}
|
||||
}
|
||||
displayFont = loadFont<Font2D>(displayFont, displayFontName, displayFontSize, "FontDisplay", "FontDisplayFamily", "displayFont");
|
||||
displayFont3D = loadFont<Font3D>(displayFont3D, displayFontName, displayFontSize, "FontDisplay", "FontDisplayFamily", "displayFont3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
|
||||
|
||||
|
@ -1253,48 +1223,16 @@ void CoreData::loadFonts() {
|
|||
if(lang.hasString("FontDisplaySmallBaseSize") == true) {
|
||||
displayFontNameSmallSize = computeFontSize(strToInt(lang.getString("FontDisplaySmallBaseSize")));
|
||||
}
|
||||
|
||||
string displayFontNameSmall = displayFontNameSmallPrefix + intToStr(displayFontNameSmallSize) + displayFontNameSmallPostfix;
|
||||
|
||||
if(displayFontSmall) {
|
||||
string fontUniqueId = displayFontSmall->getFontUniqueId();
|
||||
renderer.endFont(displayFontSmall, rsGlobal);
|
||||
displayFontSmall=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, displayFontSmall);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
displayFontSmall= renderer.newFont(rsGlobal);
|
||||
if(displayFontSmall) {
|
||||
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
|
||||
displayFontSmall->setSize(displayFontNameSmallSize);
|
||||
displayFontSmall->setFontUniqueId("displayFontSmall");
|
||||
triggerFontChangedCallbacks(displayFontSmall->getFontUniqueId(), displayFontSmall);
|
||||
}
|
||||
}
|
||||
|
||||
if(displayFontSmall3D) {
|
||||
string fontUniqueId = displayFontSmall3D->getFontUniqueId();
|
||||
renderer.endFont(displayFontSmall3D, rsGlobal);
|
||||
displayFontSmall3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, displayFontSmall3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
displayFontSmall3D= renderer.newFont3D(rsGlobal);
|
||||
if(displayFontSmall3D) {
|
||||
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
|
||||
displayFontSmall3D->setSize(displayFontNameSmallSize);
|
||||
displayFontSmall3D->setFontUniqueId("displayFontSmall3D");
|
||||
triggerFontChangedCallbacks(displayFontSmall3D->getFontUniqueId(), displayFontSmall3D);
|
||||
}
|
||||
}
|
||||
displayFontSmall = loadFont<Font2D>(displayFontSmall, displayFontNameSmall, displayFontNameSmallSize, "FontSmallDisplay", "FontSmallDisplayFamily", "displayFontSmall");
|
||||
displayFontSmall3D = loadFont<Font3D>(displayFontSmall3D, displayFontNameSmall, displayFontNameSmallSize, "FontSmallDisplay", "FontSmallDisplayFamily", "displayFontSmall3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
|
||||
|
||||
string menuFontNameNormalPrefix = config.getString("FontMenuNormalPrefix");
|
||||
string menuFontNameNormalPostfix = config.getString("FontMenuNormalPostfix");
|
||||
int menuFontNameNormalSize = computeFontSize(config.getInt("FontMenuNormalBaseSize"));
|
||||
//printf("#1 menuFontNameNormalSize = %d\n",menuFontNameNormalSize);
|
||||
|
||||
if(lang.hasString("FontMenuNormalPrefix") == true) {
|
||||
menuFontNameNormalPrefix = lang.getString("FontMenuNormalPrefix");
|
||||
}
|
||||
|
@ -1303,44 +1241,11 @@ void CoreData::loadFonts() {
|
|||
}
|
||||
if(lang.hasString("FontMenuNormalBaseSize") == true) {
|
||||
menuFontNameNormalSize = computeFontSize(strToInt(lang.getString("FontMenuNormalBaseSize")));
|
||||
//printf("#2 menuFontNameNormalSize = %d\n",menuFontNameNormalSize);
|
||||
}
|
||||
|
||||
string menuFontNameNormal= menuFontNameNormalPrefix + intToStr(menuFontNameNormalSize) + menuFontNameNormalPostfix;
|
||||
|
||||
if(menuFontNormal) {
|
||||
string fontUniqueId = menuFontNormal->getFontUniqueId();
|
||||
renderer.endFont(menuFontNormal, rsGlobal);
|
||||
menuFontNormal=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontNormal);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontNormal= renderer.newFont(rsGlobal);
|
||||
if(menuFontNormal) {
|
||||
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
|
||||
menuFontNormal->setSize(menuFontNameNormalSize);
|
||||
menuFontNormal->setWidth(Font::wBold);
|
||||
menuFontNormal->setFontUniqueId("menuFontNormal");
|
||||
triggerFontChangedCallbacks(menuFontNormal->getFontUniqueId(), menuFontNormal);
|
||||
}
|
||||
}
|
||||
|
||||
if(menuFontNormal3D) {
|
||||
string fontUniqueId = menuFontNormal3D->getFontUniqueId();
|
||||
renderer.endFont(menuFontNormal3D, rsGlobal);
|
||||
menuFontNormal3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontNormal3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontNormal3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontNormal3D) {
|
||||
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
|
||||
menuFontNormal3D->setSize(menuFontNameNormalSize);
|
||||
menuFontNormal3D->setWidth(Font::wBold);
|
||||
menuFontNormal3D->setFontUniqueId("menuFontNormal3D");
|
||||
triggerFontChangedCallbacks(menuFontNormal3D->getFontUniqueId(), menuFontNormal3D);
|
||||
}
|
||||
}
|
||||
menuFontNormal = loadFont<Font2D>(menuFontNormal, menuFontNameNormal, menuFontNameNormalSize, "FontMenuNormal", "FontMenuNormalFamily", "menuFontNormal");
|
||||
menuFontNormal3D = loadFont<Font3D>(menuFontNormal3D, menuFontNameNormal, menuFontNameNormalSize, "FontMenuNormal", "FontMenuNormalFamily", "menuFontNormal3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
|
||||
|
||||
|
@ -1357,40 +1262,10 @@ void CoreData::loadFonts() {
|
|||
if(lang.hasString("FontMenuBigBaseSize") == true) {
|
||||
menuFontNameBigSize = computeFontSize(strToInt(lang.getString("FontMenuBigBaseSize")));
|
||||
}
|
||||
|
||||
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
|
||||
|
||||
if(menuFontBig) {
|
||||
string fontUniqueId = menuFontBig->getFontUniqueId();
|
||||
renderer.endFont(menuFontBig, rsGlobal);
|
||||
menuFontBig=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontBig);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontBig= renderer.newFont(rsGlobal);
|
||||
if(menuFontBig) {
|
||||
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
|
||||
menuFontBig->setSize(menuFontNameBigSize);
|
||||
menuFontBig->setFontUniqueId("menuFontBig");
|
||||
triggerFontChangedCallbacks(menuFontBig->getFontUniqueId(), menuFontBig);
|
||||
}
|
||||
}
|
||||
|
||||
if(menuFontBig3D) {
|
||||
string fontUniqueId = menuFontBig3D->getFontUniqueId();
|
||||
renderer.endFont(menuFontBig3D, rsGlobal);
|
||||
menuFontBig3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontBig3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontBig3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontBig3D) {
|
||||
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
|
||||
menuFontBig3D->setSize(menuFontNameBigSize);
|
||||
menuFontBig3D->setFontUniqueId("menuFontBig3D");
|
||||
triggerFontChangedCallbacks(menuFontBig3D->getFontUniqueId(), menuFontBig3D);
|
||||
}
|
||||
}
|
||||
menuFontBig = loadFont<Font2D>(menuFontBig, menuFontNameBig, menuFontNameBigSize, "FontMenuBig", "FontMenuBigFamily", "menuFontBig");
|
||||
menuFontBig3D = loadFont<Font3D>(menuFontBig3D, menuFontNameBig, menuFontNameBigSize, "FontMenuBig", "FontMenuBigFamily", "menuFontBig3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
|
||||
|
||||
|
@ -1407,40 +1282,10 @@ void CoreData::loadFonts() {
|
|||
if(lang.hasString("FontMenuVeryBigBaseSize") == true) {
|
||||
menuFontNameVeryBigSize = computeFontSize(strToInt(lang.getString("FontMenuVeryBigBaseSize")));
|
||||
}
|
||||
|
||||
string menuFontNameVeryBig= menuFontNameVeryBigPrefix + intToStr(menuFontNameVeryBigSize) + menuFontNameVeryBigPostfix;
|
||||
|
||||
if(menuFontVeryBig) {
|
||||
string fontUniqueId = menuFontVeryBig->getFontUniqueId();
|
||||
renderer.endFont(menuFontVeryBig, rsGlobal);
|
||||
menuFontVeryBig=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontVeryBig);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontVeryBig= renderer.newFont(rsGlobal);
|
||||
if(menuFontVeryBig) {
|
||||
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
|
||||
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
|
||||
menuFontVeryBig->setFontUniqueId("menuFontVeryBig");
|
||||
triggerFontChangedCallbacks(menuFontVeryBig->getFontUniqueId(), menuFontVeryBig);
|
||||
}
|
||||
}
|
||||
|
||||
if(menuFontVeryBig3D) {
|
||||
string fontUniqueId = menuFontVeryBig3D->getFontUniqueId();
|
||||
renderer.endFont(menuFontVeryBig3D, rsGlobal);
|
||||
menuFontVeryBig3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFontVeryBig3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontVeryBig3D) {
|
||||
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
|
||||
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
|
||||
menuFontVeryBig3D->setFontUniqueId("menuFontVeryBig3D");
|
||||
triggerFontChangedCallbacks(menuFontVeryBig3D->getFontUniqueId(), menuFontVeryBig3D);
|
||||
}
|
||||
}
|
||||
menuFontVeryBig = loadFont<Font2D>(menuFontVeryBig, menuFontNameVeryBig, menuFontNameVeryBigSize, "FontMenuVeryBig", "FontMenuVeryBigFamily", "menuFontVeryBig");
|
||||
menuFontVeryBig3D = loadFont<Font3D>(menuFontVeryBig3D, menuFontNameVeryBig, menuFontNameVeryBigSize, "FontMenuVeryBig", "FontMenuVeryBigFamily", "menuFontVeryBig3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameVeryBig = [%s] menuFontNameVeryBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameVeryBig.c_str(),menuFontNameVeryBigSize);
|
||||
|
||||
|
@ -1458,45 +1303,41 @@ void CoreData::loadFonts() {
|
|||
if(lang.hasString("FontConsoleBaseSize") == true) {
|
||||
consoleFontNameSize = computeFontSize(strToInt(lang.getString("FontConsoleBaseSize")));
|
||||
}
|
||||
|
||||
string consoleFontName= consoleFontNamePrefix + intToStr(consoleFontNameSize) + consoleFontNamePostfix;
|
||||
|
||||
if(consoleFont) {
|
||||
string fontUniqueId = consoleFont->getFontUniqueId();
|
||||
renderer.endFont(consoleFont, rsGlobal);
|
||||
consoleFont=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, consoleFont);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
consoleFont= renderer.newFont(rsGlobal);
|
||||
if(consoleFont) {
|
||||
consoleFont->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
|
||||
consoleFont->setSize(consoleFontNameSize);
|
||||
consoleFont->setFontUniqueId("consoleFont");
|
||||
triggerFontChangedCallbacks(consoleFont->getFontUniqueId(), consoleFont);
|
||||
}
|
||||
}
|
||||
|
||||
if(consoleFont3D) {
|
||||
string fontUniqueId = consoleFont3D->getFontUniqueId();
|
||||
renderer.endFont(consoleFont3D, rsGlobal);
|
||||
consoleFont3D=NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, consoleFont3D);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == true) {
|
||||
consoleFont3D= renderer.newFont3D(rsGlobal);
|
||||
if(consoleFont3D) {
|
||||
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
|
||||
consoleFont3D->setSize(consoleFontNameSize);
|
||||
consoleFont3D->setFontUniqueId("consoleFont3D");
|
||||
triggerFontChangedCallbacks(consoleFont3D->getFontUniqueId(), consoleFont3D);
|
||||
|
||||
}
|
||||
}
|
||||
consoleFont = loadFont<Font2D>(consoleFont, consoleFontName, consoleFontNameSize, "FontConsole", "FontConsoleFamily", "consoleFont");
|
||||
consoleFont3D = loadFont<Font3D>(consoleFont3D, consoleFontName, consoleFontNameSize, "FontConsole", "FontConsoleFamily", "consoleFont3D");
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
|
||||
}
|
||||
|
||||
|
||||
template<typename T> T * CoreData::loadFont(Font *menuFont, string menuFontName,
|
||||
int menuFontNameSize, string fontType, string fontTypeFamily, string fontUniqueKey) {
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
if(menuFont) {
|
||||
string fontUniqueId = menuFont->getFontUniqueId();
|
||||
renderer.endFont(menuFont, rsGlobal);
|
||||
menuFont = NULL;
|
||||
triggerFontChangedCallbacks(fontUniqueId, menuFont);
|
||||
}
|
||||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFont = renderer.newFont(rsGlobal);
|
||||
}
|
||||
else {
|
||||
menuFont = renderer.newFont3D(rsGlobal);
|
||||
}
|
||||
if(menuFont) {
|
||||
Config &config= Config::getInstance();
|
||||
menuFont->setType(menuFontName,config.getString(fontType,""),config.getString(fontTypeFamily,""));
|
||||
menuFont->setSize(menuFontNameSize);
|
||||
menuFont->setWidth(Font::wBold);
|
||||
menuFont->setFontUniqueId(fontUniqueKey);
|
||||
triggerFontChangedCallbacks(menuFont->getFontUniqueId(), menuFont);
|
||||
}
|
||||
return (T *)menuFont;
|
||||
}
|
||||
|
||||
int CoreData::computeFontSize(int size) {
|
||||
int rs = size;
|
||||
Config &config= Config::getInstance();
|
||||
|
|
|
@ -114,7 +114,7 @@ private:
|
|||
string battleEndLoseVideoFilenameFallback;
|
||||
string battleEndLoseMusicFilename;
|
||||
|
||||
std::map<std::string,std::vector<FontChangedCallbackInterface *>> registeredFontChangedCallbacks;
|
||||
std::map<std::string,std::vector<FontChangedCallbackInterface *> > registeredFontChangedCallbacks;
|
||||
public:
|
||||
|
||||
enum TextureSystemType {
|
||||
|
@ -264,6 +264,7 @@ private:
|
|||
void loadMusicIfRequired();
|
||||
|
||||
void triggerFontChangedCallbacks(std::string fontUniqueId, Font *font);
|
||||
template<typename T> T * loadFont(Font *menuFontNormal, string menuFontNameNormal, int menuFontNameNormalSize, string fontType, string fontTypeFamily, string fontUniqueKey);
|
||||
};
|
||||
|
||||
}} //end namespace
|
||||
|
|
|
@ -3248,6 +3248,7 @@ void Renderer::renderLabel(GraphicLabel *label,const Vec4f *color) {
|
|||
if(label->getVisible() == false) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
|
@ -3316,6 +3317,16 @@ void Renderer::renderLabel(GraphicLabel *label,const Vec4f *color) {
|
|||
}
|
||||
}
|
||||
glPopAttrib();
|
||||
}
|
||||
catch(const exception &e) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s] For Control [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),label->getInstanceName().c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverride, bool *lightedOverride) {
|
||||
|
@ -3327,6 +3338,12 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
//char szBuf[8096]="";
|
||||
//snprintf(szBuf,8096,"In [%s::%s Line: %d]\n For Control container [%s] name [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,button->getContainerName().c_str(), button->getInstanceName().c_str());
|
||||
//printf(szBuf);
|
||||
|
||||
int x= button->getX();
|
||||
int y= button->getY();
|
||||
int h= button->getH();
|
||||
|
@ -3454,6 +3471,15 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid
|
|||
}
|
||||
|
||||
glPopAttrib();
|
||||
}
|
||||
catch(const exception &e) {
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s] For Control container [%s] name [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),button->getContainerName().c_str(), button->getInstanceName().c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
||||
throw megaglest_runtime_error(szBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void Renderer::renderCheckBox(const GraphicCheckBox *box) {
|
||||
|
@ -3774,8 +3800,8 @@ void Renderer::renderListBox(GraphicListBox *listBox) {
|
|||
glPushAttrib(GL_ENABLE_BIT);
|
||||
glEnable(GL_BLEND);
|
||||
|
||||
GraphicLabel label;
|
||||
label.setInstanceName("ListBox_render_label");
|
||||
GraphicLabel label("ListBox_render_label","label",false);
|
||||
//label.setInstanceName("ListBox_render_label");
|
||||
if(listBox->getLeftControlled()==true){
|
||||
label.init(listBox->getX()+listBox->getButton1()->getW()+listBox->getButton2()->getW()+2, listBox->getY(), listBox->getW(), listBox->getH(), false,listBox->getTextColor());
|
||||
}
|
||||
|
@ -5215,9 +5241,11 @@ void Renderer::renderTeamColorPlane(){
|
|||
for(int visibleUnitIndex = 0;
|
||||
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
|
||||
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
|
||||
Vec3f currVec= unit->getCurrVectorFlat();
|
||||
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
|
||||
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
|
||||
if( unit->isAlive()){
|
||||
Vec3f currVec= unit->getCurrVectorFlat();
|
||||
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
|
||||
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
|
||||
}
|
||||
}
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glPopAttrib();
|
||||
|
|
|
@ -816,9 +816,9 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
|
|||
// class MainWindow
|
||||
// =====================================================
|
||||
|
||||
MainWindow::MainWindow(Program *program) : WindowGl() {
|
||||
MainWindow::MainWindow(Program *program) : WindowGl(), popupMenu("MainWindow", "popupMenu") {
|
||||
this->program= program;
|
||||
this->popupMenu.registerGraphicComponentOnlyFontCallbacks("MainWindow", "popupMenu");
|
||||
//this->popupMenu.registerGraphicComponentOnlyFontCallbacks("MainWindow", "popupMenu");
|
||||
this->popupMenu.setEnabled(false);
|
||||
this->popupMenu.setVisible(false);
|
||||
this->triggerLanguageToggle = false;
|
||||
|
|
|
@ -181,7 +181,7 @@ void Program::ShowMessageProgramState::update() {
|
|||
bool Program::rendererInitOk = false;
|
||||
bool Program::tryingRendererInit = false;
|
||||
|
||||
Program::Program() {
|
||||
Program::Program() : msgBox("Program", "msgBox") {
|
||||
//this->masterserverMode = false;
|
||||
this->window = NULL;
|
||||
this->shutdownApplicationEnabled = false;
|
||||
|
@ -194,7 +194,7 @@ Program::Program() {
|
|||
|
||||
//mesage box
|
||||
Lang &lang= Lang::getInstance();
|
||||
msgBox.registerGraphicComponent("Program", "msgBox");
|
||||
//msgBox.registerGraphicComponent("Program", "msgBox");
|
||||
msgBox.init(lang.getString("Ok"));
|
||||
msgBox.setEnabled(false);
|
||||
}
|
||||
|
|
|
@ -276,6 +276,11 @@ void MainMenu::setState(MenuState *newstate) {
|
|||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In MainMenu::setState() #5\n");
|
||||
}
|
||||
|
||||
if(this->state != NULL) {
|
||||
|
||||
}
|
||||
|
||||
//printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
this->state= newstate;
|
||||
|
||||
|
@ -299,9 +304,9 @@ void MainMenu::consoleAddLine(string line) {
|
|||
// class MenuState
|
||||
// =====================================================
|
||||
|
||||
MenuState::MenuState(Program *program, MainMenu *mainMenu, const string &stateName){
|
||||
MenuState::MenuState(Program *program, MainMenu *mainMenu, const string &stateName) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
this->containerName = "";
|
||||
this->containerName = "MenuState";
|
||||
this->program= program;
|
||||
this->mainMenu= mainMenu;
|
||||
console.registerGraphicComponent(containerName, "menuStateConsole");
|
||||
|
@ -364,7 +369,7 @@ void MenuState::consoleAddLine(string line) {
|
|||
}
|
||||
|
||||
void MenuState::reloadUI() {
|
||||
console.resetFonts();
|
||||
//console.resetFonts();
|
||||
}
|
||||
|
||||
void MenuState::setActiveInputLabel(GraphicLabel *newLabel, GraphicLabel **activeInputLabelPtr) {
|
||||
|
|
|
@ -36,9 +36,31 @@ namespace Glest{ namespace Game{
|
|||
|
||||
MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
||||
ProgramState **parentUI) :
|
||||
MenuState(program, mainMenu, "config")
|
||||
MenuState(program, mainMenu, "config"),
|
||||
buttonOk("KeySetup","buttonOk"),
|
||||
buttonDefaults("KeySetup","buttonDefaults"),
|
||||
buttonReturn("KeySetup","buttonReturn"),
|
||||
|
||||
buttonKeyboardSetup("KeySetup","buttonKeyboardSetup"),
|
||||
buttonVideoSection("KeySetup","buttonVideoSection"),
|
||||
buttonAudioSection("KeySetup","buttonAudioSection"),
|
||||
buttonMiscSection("KeySetup","buttonMiscSection"),
|
||||
buttonNetworkSettings("KeySetup","buttonNetworkSettings"),
|
||||
|
||||
labelTitle("KeySetup","labelTitle"),
|
||||
|
||||
keyScrollBar("KeySetup","keyScrollBar"),
|
||||
|
||||
mainMessageBox("KeySetup","mainMessageBox"),
|
||||
|
||||
labelTestTitle("KeySetup","labelTestTitle"),
|
||||
labelTestValue("KeySetup","labelTestValue")
|
||||
|
||||
{
|
||||
try {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
containerName = "KeySetup";
|
||||
|
||||
keyButtonsLineHeight=30;
|
||||
keyButtonsHeight=25;
|
||||
keyButtonsWidth=400;
|
||||
|
@ -47,9 +69,6 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
keyButtonsToRender=400/keyButtonsLineHeight;
|
||||
int labelWidth=100;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
containerName = "KeySetup";
|
||||
|
||||
this->parentUI = parentUI;
|
||||
this->console.setOnlyChatMessagesInStoredLines(false);
|
||||
hotkeyIndex = -1;
|
||||
|
@ -62,52 +81,44 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
||||
buttonAudioSection.registerGraphicComponent(containerName,"buttonAudioSection");
|
||||
buttonAudioSection.init(0, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.registerGraphicComponent(containerName,"labelVideoSection");
|
||||
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.registerGraphicComponent(containerName,"labelMiscSection");
|
||||
buttonMiscSection.init(400, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||
buttonNetworkSettings.init(600, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
||||
buttonKeyboardSetup.init(800, 700,tabButtonWidth,tabButtonHeight+20);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonKeyboardSetup.setText(lang.getString("Keyboardsetup"));
|
||||
}
|
||||
// header
|
||||
labelTitle.registerGraphicComponent(containerName,"labelTitle");
|
||||
labelTitle.init(375,650);
|
||||
labelTitle.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
labelTitle.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
labelTitle.setText(lang.getString("KeyboardsetupL"));
|
||||
|
||||
labelTestTitle.registerGraphicComponent(containerName,"labelTestTitle");
|
||||
labelTestTitle.init(keyButtonsXBase,155);
|
||||
labelTestTitle.setFont(CoreData::getInstance().getMenuFontNormal());
|
||||
labelTestTitle.setFont3D(CoreData::getInstance().getMenuFontNormal3D());
|
||||
labelTestTitle.setText(lang.getString("KeyboardsetupTest"));
|
||||
|
||||
labelTestValue.registerGraphicComponent(containerName,"labelTestValue");
|
||||
labelTestValue.init(keyButtonsXBase,155-28);
|
||||
labelTestValue.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelTestValue.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
||||
|
@ -116,7 +127,6 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
labelTestValue.setText("");
|
||||
|
||||
// mainMassegeBox
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
|
@ -128,15 +138,12 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
keyScrollBar.setVisibleStart(0);
|
||||
|
||||
// buttons
|
||||
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonReturn");
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
buttonDefaults.registerGraphicComponent(containerName,"buttonDefaults");
|
||||
buttonDefaults.init(buttonStartPos+230, buttonRowPos, 125);
|
||||
buttonDefaults.setText(lang.getString("Defaults"));
|
||||
|
||||
|
@ -174,11 +181,11 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
}
|
||||
}
|
||||
|
||||
GraphicButton *button=new GraphicButton();
|
||||
GraphicButton *button = new GraphicButton(containerName,string("ScrollButton")+intToStr(i));
|
||||
button->init(keyButtonsXBase, keyButtonsYBase, keyButtonsWidth,keyButtonsHeight);
|
||||
button->setText(mergedProperties[i].first);
|
||||
keyButtons.push_back(button);
|
||||
GraphicLabel *label=new GraphicLabel();
|
||||
GraphicLabel *label = new GraphicLabel(containerName,string("ScrollLabel")+intToStr(i));
|
||||
label->init(keyButtonsXBase+keyButtonsWidth+5,keyButtonsYBase,labelWidth,20);
|
||||
label->setRenderBackground(true);
|
||||
label->setMaxEditRenderWidth(105);
|
||||
|
@ -208,17 +215,8 @@ MenuStateKeysetup::MenuStateKeysetup(Program *program, MainMenu *mainMenu,
|
|||
void MenuStateKeysetup::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
console.resetFonts();
|
||||
labelTitle.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelTitle.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
||||
labelTitle.setText(lang.getString("KeyboardsetupL"));
|
||||
|
||||
labelTestTitle.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelTestTitle.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
||||
labelTestTitle.setText(lang.getString("KeyboardsetupTest"));
|
||||
|
||||
labelTestValue.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
labelTestValue.setFont3D(CoreData::getInstance().getMenuFontBig3D());
|
||||
labelTestValue.setText("");
|
||||
|
||||
// mainMassegeBox
|
||||
|
@ -226,10 +224,7 @@ void MenuStateKeysetup::reloadUI() {
|
|||
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
buttonDefaults.setText(lang.getString("Defaults"));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
void MenuStateKeysetup::cleanup() {
|
||||
|
@ -353,11 +348,6 @@ void MenuStateKeysetup::mouseClick(int x, int y, MouseButton mouseButton){
|
|||
if(this->parentUI==NULL){
|
||||
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)){
|
||||
|
|
|
@ -35,64 +35,109 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, ProgramState **parentUI):
|
||||
MenuState(program, mainMenu, "config")
|
||||
MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, ProgramState **parentUI) :
|
||||
MenuState(program, mainMenu, "config"),
|
||||
buttonOk("Options","buttonOk"),
|
||||
buttonReturn("Options","buttonReturn"),
|
||||
|
||||
labelLang("Options","labelLang"),
|
||||
listBoxLang("Options","listBoxLang"),
|
||||
labelPlayerName("Options","labelPlayerName"),
|
||||
labelPlayerNameLabel("Options","labelPlayerNameLabel"),
|
||||
|
||||
buttonKeyboardSetup("Options","buttonKeyboardSetup"),
|
||||
buttonVideoSection("Options","buttonVideoSection"),
|
||||
buttonAudioSection("Options","buttonAudioSection"),
|
||||
buttonMiscSection("Options","buttonMiscSection"),
|
||||
buttonNetworkSettings("Options","buttonNetworkSettings"),
|
||||
|
||||
labelFontSizeAdjustment("Options","labelFontSizeAdjustment"),
|
||||
listFontSizeAdjustment("Options","listFontSizeAdjustment"),
|
||||
|
||||
mainMessageBox("Options","mainMessageBox"),
|
||||
|
||||
labelScreenShotType("Options","labelScreenShotType"),
|
||||
listBoxScreenShotType("Options","listBoxScreenShotType"),
|
||||
|
||||
labelDisableScreenshotConsoleText("Options","labelDisableScreenshotConsoleText"),
|
||||
checkBoxDisableScreenshotConsoleText("Options","checkBoxDisableScreenshotConsoleText"),
|
||||
|
||||
labelMouseMoveScrollsWorld("Options","labelMouseMoveScrollsWorld"),
|
||||
checkBoxMouseMoveScrollsWorld("Options","checkBoxMouseMoveScrollsWorld"),
|
||||
|
||||
labelCameraMoveSpeed("Options","labelCameraMoveSpeed"),
|
||||
listCameraMoveSpeed("Options","listCameraMoveSpeed"),
|
||||
|
||||
labelVisibleHud("Options","labelVisibleHud"),
|
||||
checkBoxVisibleHud("Options","checkBoxVisibleHud"),
|
||||
labelHealthBars("Options","labelHealthBars"),
|
||||
listBoxHealthBars("Options","listBoxHealthBars"),
|
||||
|
||||
labelTimeDisplay("Options","labelTimeDisplay"),
|
||||
checkBoxTimeDisplay("Options","checkBoxTimeDisplay"),
|
||||
labelChatStaysActive("Options","labelChatStaysActive"),
|
||||
checkBoxChatStaysActive("Options","checkBoxChatStaysActive"),
|
||||
|
||||
labelLuaDisableSecuritySandbox("Options","labelLuaDisableSecuritySandbox"),
|
||||
checkBoxLuaDisableSecuritySandbox("Options","checkBoxLuaDisableSecuritySandbox"),
|
||||
|
||||
luaMessageBox("Options","luaMessageBox"),
|
||||
|
||||
labelCustomTranslation("Options","labelCustomTranslation"),
|
||||
checkBoxCustomTranslation("Options","checkBoxCustomTranslation"),
|
||||
|
||||
buttonGetNewLanguageFiles("Options","buttonGetNewLanguageFiles"),
|
||||
buttonDeleteNewLanguageFiles("Options","buttonDeleteNewLanguageFiles"),
|
||||
labelTransifexUserLabel("Options","labelTransifexUserLabel"),
|
||||
labelTransifexUser("Options","labelTransifexUser"),
|
||||
labelTransifexPwdLabel("Options","labelTransifexPwdLabel"),
|
||||
labelTransifexPwd("Options","labelTransifexPwd"),
|
||||
labelTransifexI18NLabel("Options","labelTransifexI18NLabel"),
|
||||
labelTransifexI18N("Options","labelTransifexI18N")
|
||||
|
||||
{
|
||||
try {
|
||||
containerName = "Options";
|
||||
this->parentUI=parentUI;
|
||||
Lang &lang= Lang::getInstance();
|
||||
Config &config= Config::getInstance();
|
||||
|
||||
this->console.setOnlyChatMessagesInStoredLines(false);
|
||||
//modeinfos=list<ModeInfo> ();
|
||||
activeInputLabel=NULL;
|
||||
|
||||
int leftLabelStart=100;
|
||||
int leftColumnStart=leftLabelStart+300;
|
||||
//int rightLabelStart=450;
|
||||
//int rightColumnStart=rightLabelStart+280;
|
||||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
|
||||
buttonAudioSection.registerGraphicComponent(containerName,"buttonAudioSection");
|
||||
buttonAudioSection.init(0, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.registerGraphicComponent(containerName,"labelVideoSection");
|
||||
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.registerGraphicComponent(containerName,"labelMiscSection");
|
||||
buttonMiscSection.init(400, 700,tabButtonWidth,tabButtonHeight+20);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||
buttonNetworkSettings.init(600, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
||||
buttonKeyboardSetup.init(800, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
|
@ -103,30 +148,12 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//lang
|
||||
labelLang.registerGraphicComponent(containerName,"labelLang");
|
||||
labelLang.init(currentLabelStart, currentLine);
|
||||
labelLang.setText(lang.getString("Language"));
|
||||
|
||||
listBoxLang.registerGraphicComponent(containerName,"listBoxLang");
|
||||
listBoxLang.init(currentColumnStart, currentLine, 375);
|
||||
vector<string> langResults;
|
||||
|
||||
// string data_path = getGameReadWritePath(GameConstants::path_data_CacheLookupKey);
|
||||
//
|
||||
// string userDataPath = getGameCustomCoreDataPath(data_path, "");
|
||||
// findAll(userDataPath + "data/lang/*.lng", langResults, true, false);
|
||||
//
|
||||
// vector<string> langResults2;
|
||||
// findAll(data_path + "data/lang/*.lng", langResults2, true);
|
||||
// if(langResults2.empty() && langResults.empty()) {
|
||||
// throw megaglest_runtime_error("There are no lang files");
|
||||
// }
|
||||
// for(unsigned int i = 0; i < langResults2.size(); ++i) {
|
||||
// string testLanguage = langResults2[i];
|
||||
// if(std::find(langResults.begin(),langResults.end(),testLanguage) == langResults.end()) {
|
||||
// langResults.push_back(testLanguage);
|
||||
// }
|
||||
// }
|
||||
languageList = Lang::getInstance().getDiscoveredLanguageList(true);
|
||||
for(map<string,string>::iterator iterMap = languageList.begin();
|
||||
iterMap != languageList.end(); ++iterMap) {
|
||||
|
@ -143,11 +170,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//playerName
|
||||
labelPlayerNameLabel.registerGraphicComponent(containerName,"labelPlayerNameLabel");
|
||||
labelPlayerNameLabel.init(currentLabelStart,currentLine);
|
||||
labelPlayerNameLabel.setText(lang.getString("Playername"));
|
||||
|
||||
labelPlayerName.registerGraphicComponent(containerName,"labelPlayerName");
|
||||
labelPlayerName.init(currentColumnStart,currentLine);
|
||||
labelPlayerName.setText(config.getString("NetPlayerName",Socket::getHostName().c_str()));
|
||||
labelPlayerName.setFont(CoreData::getInstance().getMenuFontBig());
|
||||
|
@ -158,11 +183,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//FontSizeAdjustment
|
||||
labelFontSizeAdjustment.registerGraphicComponent(containerName,"labelFontSizeAdjustment");
|
||||
labelFontSizeAdjustment.init(currentLabelStart,currentLine);
|
||||
labelFontSizeAdjustment.setText(lang.getString("FontSizeAdjustment"));
|
||||
|
||||
listFontSizeAdjustment.registerGraphicComponent(containerName,"listFontSizeAdjustment");
|
||||
listFontSizeAdjustment.init(currentColumnStart, currentLine, 80);
|
||||
for(int i=-5; i<=5; i+=1){
|
||||
listFontSizeAdjustment.pushBackItem(intToStr(i));
|
||||
|
@ -171,11 +194,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
|
||||
currentLine-=lineOffset;
|
||||
// Screenshot type flag
|
||||
labelScreenShotType.registerGraphicComponent(containerName,"labelScreenShotType");
|
||||
labelScreenShotType.init(currentLabelStart ,currentLine);
|
||||
labelScreenShotType.setText(lang.getString("ScreenShotFileType"));
|
||||
|
||||
listBoxScreenShotType.registerGraphicComponent(containerName,"listBoxScreenShotType");
|
||||
listBoxScreenShotType.init(currentColumnStart ,currentLine, 80 );
|
||||
listBoxScreenShotType.pushBackItem("bmp");
|
||||
listBoxScreenShotType.pushBackItem("jpg");
|
||||
|
@ -185,31 +206,25 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelDisableScreenshotConsoleText.registerGraphicComponent(containerName,"lavelDisableScreenshotConsoleText");
|
||||
labelDisableScreenshotConsoleText.init(currentLabelStart ,currentLine);
|
||||
labelDisableScreenshotConsoleText.setText(lang.getString("ScreenShotConsoleText"));
|
||||
|
||||
checkBoxDisableScreenshotConsoleText.registerGraphicComponent(containerName,"checkBoxDisableScreenshotConsoleText");
|
||||
checkBoxDisableScreenshotConsoleText.init(currentColumnStart ,currentLine );
|
||||
checkBoxDisableScreenshotConsoleText.setValue(!config.getBool("DisableScreenshotConsoleText","false"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelMouseMoveScrollsWorld.registerGraphicComponent(containerName,"labelMouseMoveScrollsWorld");
|
||||
labelMouseMoveScrollsWorld.init(currentLabelStart ,currentLine);
|
||||
labelMouseMoveScrollsWorld.setText(lang.getString("MouseScrollsWorld"));
|
||||
|
||||
checkBoxMouseMoveScrollsWorld.registerGraphicComponent(containerName,"checkBoxMouseMoveScrollsWorld");
|
||||
checkBoxMouseMoveScrollsWorld.init(currentColumnStart ,currentLine );
|
||||
checkBoxMouseMoveScrollsWorld.setValue(config.getBool("MouseMoveScrollsWorld","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
//CameraMoveSpeed
|
||||
labelCameraMoveSpeed.registerGraphicComponent(containerName,"labelCameraMoveSpeed");
|
||||
labelCameraMoveSpeed.init(currentLabelStart,currentLine);
|
||||
labelCameraMoveSpeed.setText(lang.getString("CameraMoveSpeed"));
|
||||
|
||||
listCameraMoveSpeed.registerGraphicComponent(containerName,"listCameraMoveSpeed");
|
||||
listCameraMoveSpeed.init(currentColumnStart, currentLine, 80);
|
||||
for(int i=15; i<=50; i+=5){
|
||||
listCameraMoveSpeed.pushBackItem(intToStr(i));
|
||||
|
@ -217,21 +232,17 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
listCameraMoveSpeed.setSelectedItem(intToStr((int) (config.getFloat("CameraMoveSpeed","15"))));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelVisibleHud.registerGraphicComponent(containerName,"lavelVisibleHud");
|
||||
labelVisibleHud.init(currentLabelStart ,currentLine);
|
||||
labelVisibleHud.setText(lang.getString("VisibleHUD"));
|
||||
|
||||
checkBoxVisibleHud.registerGraphicComponent(containerName,"checkBoxVisibleHud");
|
||||
checkBoxVisibleHud.init(currentColumnStart ,currentLine );
|
||||
checkBoxVisibleHud.setValue(config.getBool("VisibleHud","true"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelHealthBars.registerGraphicComponent(containerName,"labelHealthBars");
|
||||
labelHealthBars.init(currentLabelStart ,currentLine);
|
||||
labelHealthBars.setText(lang.getString("Healthbar"));
|
||||
|
||||
listBoxHealthBars.registerGraphicComponent(containerName,"lisBoxtHealthBars");
|
||||
listBoxHealthBars.init(currentColumnStart ,currentLine, 375);
|
||||
listBoxHealthBars.pushBackItem(lang.getString("HealthbarsFactionDefault"));
|
||||
listBoxHealthBars.pushBackItem(lang.getString("HealthbarsOff"));
|
||||
|
@ -270,35 +281,28 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelChatStaysActive.registerGraphicComponent(containerName,"labelChatStaysActive");
|
||||
labelChatStaysActive.init(currentLabelStart ,currentLine);
|
||||
labelChatStaysActive.setText(lang.getString("ChatStaysActive"));
|
||||
|
||||
checkBoxChatStaysActive.registerGraphicComponent(containerName,"checkBoxChatStaysActive");
|
||||
checkBoxChatStaysActive.init(currentColumnStart ,currentLine );
|
||||
checkBoxChatStaysActive.setValue(config.getBool("ChatStaysActive","false"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelTimeDisplay.registerGraphicComponent(containerName,"labelTimeDisplay");
|
||||
labelTimeDisplay.init(currentLabelStart ,currentLine);
|
||||
labelTimeDisplay.setText(lang.getString("TimeDisplay"));
|
||||
|
||||
checkBoxTimeDisplay.registerGraphicComponent(containerName,"checkBoxTimeDisplay");
|
||||
checkBoxTimeDisplay.init(currentColumnStart ,currentLine );
|
||||
checkBoxTimeDisplay.setValue(config.getBool("TimeDisplay","true"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"labelLuaDisableSecuritySandbox");
|
||||
labelLuaDisableSecuritySandbox.init(currentLabelStart ,currentLine);
|
||||
labelLuaDisableSecuritySandbox.setText(lang.getString("LuaDisableSecuritySandbox"));
|
||||
|
||||
checkBoxLuaDisableSecuritySandbox.registerGraphicComponent(containerName,"checkBoxLuaDisableSecuritySandbox");
|
||||
checkBoxLuaDisableSecuritySandbox.init(currentColumnStart ,currentLine );
|
||||
checkBoxLuaDisableSecuritySandbox.setValue(config.getBool("DisableLuaSandbox","false"));
|
||||
|
||||
luaMessageBox.registerGraphicComponent(containerName,"luaMessageBox");
|
||||
luaMessageBox.init(lang.getString("Yes"),lang.getString("No"));
|
||||
luaMessageBox.setEnabled(false);
|
||||
luaMessageBoxState=0;
|
||||
|
@ -308,47 +312,38 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
currentLine-=lineOffset/2;
|
||||
|
||||
// buttons
|
||||
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonAbort");
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
// Transifex related UI
|
||||
currentLine-=lineOffset*3;
|
||||
labelCustomTranslation.registerGraphicComponent(containerName,"labelCustomTranslation");
|
||||
labelCustomTranslation.init(currentLabelStart ,currentLine);
|
||||
labelCustomTranslation.setText(lang.getString("CustomTranslation"));
|
||||
|
||||
checkBoxCustomTranslation.registerGraphicComponent(containerName,"checkBoxCustomTranslation");
|
||||
checkBoxCustomTranslation.init(currentColumnStart ,currentLine );
|
||||
checkBoxCustomTranslation.setValue(false);
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelTransifexUserLabel.registerGraphicComponent(containerName,"labelTransifexUserLabel");
|
||||
labelTransifexUserLabel.init(currentLabelStart,currentLine);
|
||||
labelTransifexUserLabel.setText(lang.getString("TransifexUserName"));
|
||||
|
||||
labelTransifexPwdLabel.registerGraphicComponent(containerName,"labelTransifexPwdLabel");
|
||||
labelTransifexPwdLabel.init(currentLabelStart + 260 ,currentLine);
|
||||
labelTransifexPwdLabel.setText(lang.getString("TransifexPwd"));
|
||||
|
||||
labelTransifexI18NLabel.registerGraphicComponent(containerName,"labelTransifexI18NLabel");
|
||||
labelTransifexI18NLabel.init(currentLabelStart + 520 ,currentLine);
|
||||
labelTransifexI18NLabel.setText(lang.getString("TransifexI18N"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelTransifexUser.registerGraphicComponent(containerName,"labelTransifexUser");
|
||||
labelTransifexUser.init(currentLabelStart,currentLine);
|
||||
labelTransifexUser.setEditable(true);
|
||||
labelTransifexUser.setMaxEditWidth(28);
|
||||
labelTransifexUser.setMaxEditRenderWidth(250);
|
||||
labelTransifexUser.setText(config.getString("TranslationGetURLUser","<none>"));
|
||||
|
||||
labelTransifexPwd.registerGraphicComponent(containerName,"labelTransifexPwd");
|
||||
labelTransifexPwd.init(currentLabelStart + 260 ,currentLine);
|
||||
labelTransifexPwd.setIsPassword(true);
|
||||
labelTransifexPwd.setEditable(true);
|
||||
|
@ -356,7 +351,6 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
labelTransifexPwd.setMaxEditRenderWidth(250);
|
||||
labelTransifexPwd.setText(config.getString("TranslationGetURLPassword",""));
|
||||
|
||||
labelTransifexI18N.registerGraphicComponent(containerName,"labelTransifexI18N");
|
||||
labelTransifexI18N.init(currentLabelStart + 520 ,currentLine);
|
||||
labelTransifexI18N.setEditable(true);
|
||||
labelTransifexI18N.setMaxEditWidth(6);
|
||||
|
@ -364,11 +358,9 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
labelTransifexI18N.setText(config.getString("TranslationGetURLLanguage","en"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
buttonGetNewLanguageFiles.registerGraphicComponent(containerName,"buttonGetNewLanguageFiles");
|
||||
buttonGetNewLanguageFiles.init(currentLabelStart, currentLine, 250);
|
||||
buttonGetNewLanguageFiles.setText(lang.getString("TransifexGetLanguageFiles"));
|
||||
|
||||
buttonDeleteNewLanguageFiles.registerGraphicComponent(containerName,"buttonDeleteNewLanguageFiles");
|
||||
buttonDeleteNewLanguageFiles.init(currentLabelStart + 260, currentLine, 250);
|
||||
buttonDeleteNewLanguageFiles.setText(lang.getString("TransifexDeleteLanguageFiles"));
|
||||
|
||||
|
@ -382,10 +374,11 @@ MenuStateOptions::MenuStateOptions(Program *program, MainMenu *mainMenu, Program
|
|||
}
|
||||
}
|
||||
|
||||
MenuStateOptions::~MenuStateOptions() {
|
||||
}
|
||||
|
||||
void MenuStateOptions::reloadUI() {
|
||||
Lang &lang = Lang::getInstance();
|
||||
//console.resetFonts();
|
||||
//GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
luaMessageBox.init(lang.getString("Yes"),lang.getString("No"));
|
||||
|
@ -1023,6 +1016,9 @@ void MenuStateOptions::keyPress(SDL_KeyboardEvent c) {
|
|||
|
||||
void MenuStateOptions::render(){
|
||||
Renderer &renderer= Renderer::getInstance();
|
||||
// char szBuf[8096]="";
|
||||
// snprintf(szBuf,8096,"\nIn [%s::%s Line: %d]\n\nRender options menu [%p]!\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this);
|
||||
// printf(szBuf);
|
||||
|
||||
if(mainMessageBox.getEnabled()){
|
||||
renderer.renderMessageBox(&mainMessageBox);
|
||||
|
|
|
@ -91,6 +91,7 @@ private:
|
|||
|
||||
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);
|
||||
|
|
|
@ -36,8 +36,72 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *mainMenu, ProgramState **parentUI):
|
||||
MenuState(program, mainMenu, "config")
|
||||
MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *mainMenu, ProgramState **parentUI) :
|
||||
MenuState(program, mainMenu, "config"),
|
||||
buttonOk("Options_Graphics","buttonOk"),
|
||||
buttonReturn("Options_Graphics","buttonReturn"),
|
||||
buttonAutoConfig("Options_Graphics","buttonAutoConfig"),
|
||||
buttonVideoInfo("Options_Graphics","buttonVideoInfo"),
|
||||
|
||||
buttonKeyboardSetup("Options_Graphics","buttonKeyboardSetup"),
|
||||
buttonVideoSection("Options_Graphics","buttonVideoSection"),
|
||||
buttonAudioSection("Options_Graphics","buttonAudioSection"),
|
||||
buttonMiscSection("Options_Graphics","buttonMiscSection"),
|
||||
buttonNetworkSettings("Options_Graphics","buttonNetworkSettings"),
|
||||
|
||||
labelShadows("Options_Graphics","labelShadows"),
|
||||
listBoxShadows("Options_Graphics","listBoxShadows"),
|
||||
labelFilter("Options_Graphics","labelFilter"),
|
||||
listBoxFilter("Options_Graphics","listBoxFilter"),
|
||||
labelFilterMaxAnisotropy("Options_Graphics","labelFilterMaxAnisotropy"),
|
||||
listBoxFilterMaxAnisotropy("Options_Graphics","listBoxFilterMaxAnisotropy"),
|
||||
|
||||
labelTextures3D("Options_Graphics","labelTextures3D"),
|
||||
checkBoxTextures3D("Options_Graphics","checkBoxTextures3D"),
|
||||
labelLights("Options_Graphics","labelLights"),
|
||||
listBoxLights("Options_Graphics","listBoxLights"),
|
||||
labelUnitParticles("Options_Graphics","labelUnitParticles"),
|
||||
checkBoxUnitParticles("Options_Graphics","checkBoxUnitParticles"),
|
||||
|
||||
labelTilesetParticles("Options_Graphics","labelTilesetParticles"),
|
||||
checkBoxTilesetParticles("Options_Graphics","checkBoxTilesetParticles"),
|
||||
labelAnimatedTilesetObjects("Options_Graphics","labelAnimatedTilesetObjects"),
|
||||
listBoxAnimatedTilesetObjects("Options_Graphics","listBoxAnimatedTilesetObjects"),
|
||||
|
||||
labelScreenModes("Options_Graphics","labelScreenModes"),
|
||||
listBoxScreenModes("Options_Graphics","listBoxScreenModes"),
|
||||
|
||||
labelFullscreenWindowed("Options_Graphics","labelFullscreenWindowed"),
|
||||
checkBoxFullscreenWindowed("Options_Graphics","checkBoxFullscreenWindowed"),
|
||||
|
||||
labelMapPreview("Options_Graphics","labelMapPreview"),
|
||||
checkBoxMapPreview("Options_Graphics","checkBoxMapPreview"),
|
||||
|
||||
mainMessageBox("Options_Graphics","mainMessageBox"),
|
||||
|
||||
labelEnableTextureCompression("Options_Graphics","labelEnableTextureCompression"),
|
||||
checkBoxEnableTextureCompression("Options_Graphics","checkBoxEnableTextureCompression"),
|
||||
|
||||
labelRainEffect("Options_Graphics","labelRainEffect"),
|
||||
labelRainEffectSeparator("Options_Graphics","labelRainEffectSeparator"),
|
||||
checkBoxRainEffect("Options_Graphics","checkBoxRainEffect"),
|
||||
checkBoxRainEffectMenu("Options_Graphics","checkBoxRainEffectMenu"),
|
||||
|
||||
labelGammaCorrection("Options_Graphics","labelGammaCorrection"),
|
||||
listBoxGammaCorrection("Options_Graphics","listBoxGammaCorrection"),
|
||||
|
||||
labelShadowIntensity("Options_Graphics","labelShadowIntensity"),
|
||||
listBoxShadowIntensity("Options_Graphics","listBoxShadowIntensity"),
|
||||
|
||||
labelShadowTextureSize("Options_Graphics","labelShadowTextureSize"),
|
||||
listBoxShadowTextureSize("Options_Graphics","listBoxShadowTextureSize"),
|
||||
|
||||
labelVideos("Options_Graphics","labelVideos"),
|
||||
checkBoxVideos("Options_Graphics","checkBoxVideos"),
|
||||
|
||||
labelSelectionType("Options_Graphics","labelSelectionType"),
|
||||
listBoxSelectionType("Options_Graphics","listBoxSelectionType")
|
||||
|
||||
{
|
||||
try {
|
||||
containerName = "Options_Graphics";
|
||||
|
@ -46,55 +110,40 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
Config &config= Config::getInstance();
|
||||
this->console.setOnlyChatMessagesInStoredLines(false);
|
||||
screenModeChangedTimer= time(NULL); // just init
|
||||
//modeinfos=list<ModeInfo> ();
|
||||
|
||||
::Shared::PlatformCommon::getFullscreenVideoModes(&modeInfos,!config.getBool("Windowed"));
|
||||
|
||||
int leftLabelStart=100;
|
||||
int leftColumnStart=leftLabelStart+300;
|
||||
//int rightLabelStart=450;
|
||||
//int rightColumnStart=rightLabelStart+280;
|
||||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
|
||||
buttonAudioSection.registerGraphicComponent(containerName,"buttonAudioSection");
|
||||
buttonAudioSection.init(0, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.registerGraphicComponent(containerName,"labelVideoSection");
|
||||
buttonVideoSection.init(200, 700,tabButtonWidth,tabButtonHeight+20);
|
||||
buttonVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
//currentLine-=lineOffset;
|
||||
//MiscSection
|
||||
buttonMiscSection.registerGraphicComponent(containerName,"labelMiscSection");
|
||||
buttonMiscSection.init(400, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||
buttonNetworkSettings.init(600, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
||||
buttonKeyboardSetup.init(800, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
|
@ -105,11 +154,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//resolution
|
||||
labelScreenModes.registerGraphicComponent(containerName,"labelScreenModes");
|
||||
labelScreenModes.init(currentLabelStart, currentLine);
|
||||
labelScreenModes.setText(lang.getString("Resolution"));
|
||||
|
||||
listBoxScreenModes.registerGraphicComponent(containerName,"listBoxScreenModes");
|
||||
listBoxScreenModes.init(currentColumnStart, currentLine, 200);
|
||||
|
||||
string currentResString = config.getString("ScreenWidth") + "x" +
|
||||
|
@ -130,21 +177,17 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
|
||||
|
||||
//FullscreenWindowed
|
||||
labelFullscreenWindowed.registerGraphicComponent(containerName,"labelFullscreenWindowed");
|
||||
labelFullscreenWindowed.init(currentLabelStart, currentLine);
|
||||
|
||||
checkBoxFullscreenWindowed.registerGraphicComponent(containerName,"checkBoxFullscreenWindowed");
|
||||
checkBoxFullscreenWindowed.init(currentColumnStart, currentLine);
|
||||
labelFullscreenWindowed.setText(lang.getString("Windowed"));
|
||||
checkBoxFullscreenWindowed.setValue(config.getBool("Windowed"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
//gammaCorrection
|
||||
labelGammaCorrection.registerGraphicComponent(containerName,"labelGammaCorrection");
|
||||
labelGammaCorrection.init(currentLabelStart, currentLine);
|
||||
labelGammaCorrection.setText(lang.getString("GammaCorrection"));
|
||||
|
||||
listBoxGammaCorrection.registerGraphicComponent(containerName,"listBoxGammaCorrection");
|
||||
listBoxGammaCorrection.init(currentColumnStart, currentLine, 200);
|
||||
for (float f=0.5;f<3.0f;f=f+0.1f) {
|
||||
listBoxGammaCorrection.pushBackItem(floatToStr(f));
|
||||
|
@ -156,11 +199,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//filter
|
||||
labelFilter.registerGraphicComponent(containerName,"labelFilter");
|
||||
labelFilter.init(currentLabelStart, currentLine);
|
||||
labelFilter.setText(lang.getString("Filter"));
|
||||
|
||||
listBoxFilter.registerGraphicComponent(containerName,"listBoxFilter");
|
||||
listBoxFilter.init(currentColumnStart, currentLine, 200);
|
||||
listBoxFilter.pushBackItem("Bilinear");
|
||||
listBoxFilter.pushBackItem("Trilinear");
|
||||
|
@ -168,11 +209,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//FilterMaxAnisotropy
|
||||
labelFilterMaxAnisotropy.registerGraphicComponent(containerName,"labelFilterMaxAnisotropy");
|
||||
labelFilterMaxAnisotropy.init(currentLabelStart, currentLine);
|
||||
labelFilterMaxAnisotropy.setText(lang.getString("FilterMaxAnisotropy"));
|
||||
|
||||
listBoxFilterMaxAnisotropy.registerGraphicComponent(containerName,"listBoxFilterMaxAnisotropy");
|
||||
listBoxFilterMaxAnisotropy.init(currentColumnStart, currentLine, 200);
|
||||
listBoxFilterMaxAnisotropy.pushBackItem("1");
|
||||
listBoxFilterMaxAnisotropy.pushBackItem("2");
|
||||
|
@ -183,11 +222,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//selectionType
|
||||
labelSelectionType.registerGraphicComponent(containerName,"labelSelectionType");
|
||||
labelSelectionType.init(currentLabelStart, currentLine);
|
||||
labelSelectionType.setText(lang.getString("SelectionType"));
|
||||
|
||||
listBoxSelectionType.registerGraphicComponent(containerName,"listBoxSelectionType");
|
||||
listBoxSelectionType.init(currentColumnStart, currentLine, 250);
|
||||
listBoxSelectionType.pushBackItem("SelectBuffer (nvidia)");
|
||||
listBoxSelectionType.pushBackItem("ColorPicking (default)");
|
||||
|
@ -203,11 +240,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//shadows
|
||||
labelShadows.registerGraphicComponent(containerName,"labelShadows");
|
||||
labelShadows.init(currentLabelStart, currentLine);
|
||||
labelShadows.setText(lang.getString("Shadows"));
|
||||
|
||||
listBoxShadows.registerGraphicComponent(containerName,"listBoxShadows");
|
||||
listBoxShadows.init(currentColumnStart, currentLine, 250);
|
||||
for(int i= 0; i<Renderer::sCount; ++i){
|
||||
listBoxShadows.pushBackItem(lang.getString(Renderer::shadowsToStr(static_cast<Renderer::Shadows>(i))));
|
||||
|
@ -217,11 +252,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//shadows
|
||||
labelShadowTextureSize.registerGraphicComponent(containerName,"labelShadowTextureSize");
|
||||
labelShadowTextureSize.init(currentLabelStart, currentLine);
|
||||
labelShadowTextureSize.setText(lang.getString("ShadowTextureSize"));
|
||||
|
||||
listBoxShadowTextureSize.registerGraphicComponent(containerName,"listBoxShadowTextureSize");
|
||||
listBoxShadowTextureSize.init(currentColumnStart, currentLine, 200);
|
||||
listBoxShadowTextureSize.pushBackItem("256");
|
||||
listBoxShadowTextureSize.pushBackItem("512");
|
||||
|
@ -231,11 +264,9 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//shadows
|
||||
labelShadowIntensity.registerGraphicComponent(containerName,"labelShadowIntensity");
|
||||
labelShadowIntensity.init(currentLabelStart, currentLine);
|
||||
labelShadowIntensity.setText(lang.getString("ShadowIntensity"));
|
||||
|
||||
listBoxShadowIntensity.registerGraphicComponent(containerName,"listBoxShadowIntensity");
|
||||
listBoxShadowIntensity.init(currentColumnStart, currentLine, 200);
|
||||
for (float f=0.5f;f<3.0f;f=f+0.1f) {
|
||||
listBoxShadowIntensity.pushBackItem(floatToStr(f));
|
||||
|
@ -247,21 +278,17 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//textures 3d
|
||||
labelTextures3D.registerGraphicComponent(containerName,"labelTextures3D");
|
||||
labelTextures3D.init(currentLabelStart, currentLine);
|
||||
|
||||
checkBoxTextures3D.registerGraphicComponent(containerName,"checkBoxTextures3D");
|
||||
checkBoxTextures3D.init(currentColumnStart, currentLine);
|
||||
labelTextures3D.setText(lang.getString("Textures3D"));
|
||||
checkBoxTextures3D.setValue(config.getBool("Textures3D"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
//lights
|
||||
labelLights.registerGraphicComponent(containerName,"labelLights");
|
||||
labelLights.init(currentLabelStart, currentLine);
|
||||
labelLights.setText(lang.getString("MaxLights"));
|
||||
|
||||
listBoxLights.registerGraphicComponent(containerName,"listBoxLights");
|
||||
listBoxLights.init(currentColumnStart, currentLine, 80);
|
||||
for(int i= 1; i<=8; ++i){
|
||||
listBoxLights.pushBackItem(intToStr(i));
|
||||
|
@ -270,31 +297,25 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//unit particles
|
||||
labelUnitParticles.registerGraphicComponent(containerName,"labelUnitParticles");
|
||||
labelUnitParticles.init(currentLabelStart,currentLine);
|
||||
labelUnitParticles.setText(lang.getString("ShowUnitParticles"));
|
||||
|
||||
checkBoxUnitParticles.registerGraphicComponent(containerName,"checkBoxUnitParticles");
|
||||
checkBoxUnitParticles.init(currentColumnStart,currentLine);
|
||||
checkBoxUnitParticles.setValue(config.getBool("UnitParticles","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
//tileset particles
|
||||
labelTilesetParticles.registerGraphicComponent(containerName,"labelTilesetParticles");
|
||||
labelTilesetParticles.init(currentLabelStart,currentLine);
|
||||
labelTilesetParticles.setText(lang.getString("ShowTilesetParticles"));
|
||||
|
||||
checkBoxTilesetParticles.registerGraphicComponent(containerName,"checkBoxTilesetParticles");
|
||||
checkBoxTilesetParticles.init(currentColumnStart,currentLine);
|
||||
checkBoxTilesetParticles.setValue(config.getBool("TilesetParticles","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
//animated tileset objects
|
||||
labelAnimatedTilesetObjects.registerGraphicComponent(containerName,"labelAnimatedTilesetObjects");
|
||||
labelAnimatedTilesetObjects.init(currentLabelStart,currentLine);
|
||||
labelAnimatedTilesetObjects.setText(lang.getString("AnimatedTilesetObjects"));
|
||||
|
||||
listBoxAnimatedTilesetObjects.registerGraphicComponent(containerName,"listBoxAnimatedTilesetObjects");
|
||||
listBoxAnimatedTilesetObjects.init(currentColumnStart, currentLine, 80);
|
||||
listBoxAnimatedTilesetObjects.pushBackItem("0");
|
||||
listBoxAnimatedTilesetObjects.pushBackItem("10");
|
||||
|
@ -309,70 +330,55 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
currentLine-=lineOffset;
|
||||
|
||||
//unit particles
|
||||
labelMapPreview.registerGraphicComponent(containerName,"labelMapPreview");
|
||||
labelMapPreview.init(currentLabelStart,currentLine);
|
||||
labelMapPreview.setText(lang.getString("ShowMapPreview"));
|
||||
|
||||
checkBoxMapPreview.registerGraphicComponent(containerName,"checkBoxMapPreview");
|
||||
checkBoxMapPreview.init(currentColumnStart,currentLine);
|
||||
checkBoxMapPreview.setValue(config.getBool("MapPreview","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
// Texture Compression flag
|
||||
labelEnableTextureCompression.registerGraphicComponent(containerName,"labelEnableTextureCompression");
|
||||
labelEnableTextureCompression.init(currentLabelStart ,currentLine);
|
||||
labelEnableTextureCompression.setText(lang.getString("EnableTextureCompression"));
|
||||
|
||||
checkBoxEnableTextureCompression.registerGraphicComponent(containerName,"checkBoxEnableTextureCompression");
|
||||
checkBoxEnableTextureCompression.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnableTextureCompression.setValue(config.getBool("EnableTextureCompression","false"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelRainEffect.registerGraphicComponent(containerName,"labelRainEffect");
|
||||
labelRainEffect.init(currentLabelStart ,currentLine);
|
||||
labelRainEffect.setText(lang.getString("RainEffectMenuGame"));
|
||||
|
||||
checkBoxRainEffectMenu.registerGraphicComponent(containerName,"checkBoxRainEffectMenu");
|
||||
checkBoxRainEffectMenu.init(currentColumnStart ,currentLine );
|
||||
checkBoxRainEffectMenu.setValue(config.getBool("RainEffectMenu","true"));
|
||||
|
||||
labelRainEffectSeparator.registerGraphicComponent(containerName,"labelRainEffect");
|
||||
labelRainEffectSeparator.init(currentColumnStart+30 ,currentLine);
|
||||
labelRainEffectSeparator.setText("/");
|
||||
|
||||
checkBoxRainEffect.registerGraphicComponent(containerName,"checkBoxRainEffect");
|
||||
checkBoxRainEffect.init(currentColumnStart+42 ,currentLine );
|
||||
checkBoxRainEffect.setValue(config.getBool("RainEffect","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelVideos.registerGraphicComponent(containerName,"labelVideos");
|
||||
labelVideos.init(currentLabelStart ,currentLine);
|
||||
labelVideos.setText(lang.getString("EnableVideos"));
|
||||
|
||||
checkBoxVideos.registerGraphicComponent(containerName,"checkBoxVideos");
|
||||
checkBoxVideos.init(currentColumnStart ,currentLine );
|
||||
checkBoxVideos.setValue(config.getBool("EnableVideos","true"));
|
||||
|
||||
// end
|
||||
|
||||
// external server port
|
||||
//currentLine-=lineOffset;
|
||||
|
||||
// buttons
|
||||
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonAbort");
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
buttonAutoConfig.setText(lang.getString("AutoConfig"));
|
||||
|
||||
buttonAutoConfig.registerGraphicComponent(containerName,"buttonAutoConfig");
|
||||
buttonAutoConfig.init(buttonStartPos+230, buttonRowPos, 175);
|
||||
|
||||
buttonVideoInfo.setText(lang.getString("VideoInfo"));
|
||||
buttonVideoInfo.registerGraphicComponent(containerName,"buttonVideoInfo");
|
||||
buttonVideoInfo.init(buttonStartPos+415, buttonRowPos, 175); // was 620
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
|
@ -386,23 +392,11 @@ MenuStateOptionsGraphics::MenuStateOptionsGraphics(Program *program, MainMenu *m
|
|||
void MenuStateOptionsGraphics::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
console.resetFonts();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
|
||||
buttonVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
std::vector<string> listboxData;
|
||||
|
@ -455,33 +449,21 @@ void MenuStateOptionsGraphics::reloadUI() {
|
|||
listBoxShadows.setItems(listboxData);
|
||||
|
||||
labelTextures3D.setText(lang.getString("Textures3D"));
|
||||
|
||||
labelLights.setText(lang.getString("MaxLights"));
|
||||
|
||||
labelUnitParticles.setText(lang.getString("ShowUnitParticles"));
|
||||
|
||||
labelTilesetParticles.setText(lang.getString("ShowTilesetParticles"));
|
||||
labelAnimatedTilesetObjects.setText(lang.getString("AnimatedTilesetObjects"));
|
||||
|
||||
labelMapPreview.setText(lang.getString("ShowMapPreview"));
|
||||
|
||||
labelEnableTextureCompression.setText(lang.getString("EnableTextureCompression"));
|
||||
|
||||
|
||||
labelRainEffect.setText(lang.getString("RainEffectMenuGame"));
|
||||
|
||||
labelVideos.setText(lang.getString("EnableVideos"));
|
||||
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
buttonAutoConfig.setText(lang.getString("AutoConfig"));
|
||||
|
||||
buttonVideoInfo.setText(lang.getString("VideoInfo"));
|
||||
|
||||
labelSelectionType.setText(lang.getString("SelectionType"));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -35,8 +35,46 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mainMenu, ProgramState **parentUI):
|
||||
MenuState(program, mainMenu, "config")
|
||||
MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mainMenu, ProgramState **parentUI) :
|
||||
MenuState(program, mainMenu, "config"),
|
||||
buttonOk("Options_Network","buttonOk"),
|
||||
buttonReturn("Options_Network","buttonReturn"),
|
||||
|
||||
buttonKeyboardSetup("Options_Network","buttonKeyboardSetup"),
|
||||
buttonVideoSection("Options_Network","buttonVideoSection"),
|
||||
buttonAudioSection("Options_Network","buttonAudioSection"),
|
||||
buttonMiscSection("Options_Network","buttonMiscSection"),
|
||||
buttonNetworkSettings("Options_Network","buttonNetworkSettings"),
|
||||
|
||||
mainMessageBox("Options_Network","mainMessageBox"),
|
||||
|
||||
labelExternalPort("Options_Network","labelExternalPort"),
|
||||
labelServerPortLabel("Options_Network","labelServerPortLabel"),
|
||||
|
||||
labelPublishServerExternalPort("Options_Network","labelPublishServerExternalPort"),
|
||||
listBoxServerPort("Options_Network","listBoxServerPort"),
|
||||
|
||||
labelEnableFTP("Options_Network","labelEnableFTP"),
|
||||
checkBoxEnableFTP("Options_Network","checkBoxEnableFTP"),
|
||||
|
||||
labelEnableFTPServer("Options_Network","labelEnableFTPServer"),
|
||||
checkBoxEnableFTPServer("Options_Network","checkBoxEnableFTPServer"),
|
||||
|
||||
labelFTPServerPortLabel("Options_Network","labelFTPServerPortLabel"),
|
||||
labelFTPServerPort("Options_Network","labelFTPServerPort"),
|
||||
|
||||
labelFTPServerDataPortsLabel("Options_Network","labelFTPServerDataPortsLabel"),
|
||||
labelFTPServerDataPorts("Options_Network","labelFTPServerDataPorts"),
|
||||
|
||||
labelEnableFTPServerInternetTilesetXfer("Options_Network","labelEnableFTPServerInternetTilesetXfer"),
|
||||
checkBoxEnableFTPServerInternetTilesetXfer("Options_Network","checkBoxEnableFTPServerInternetTilesetXfer"),
|
||||
|
||||
labelEnableFTPServerInternetTechtreeXfer("Options_Network","labelEnableFTPServerInternetTechtreeXfer"),
|
||||
checkBoxEnableFTPServerInternetTechtreeXfer("Options_Network","checkBoxEnableFTPServerInternetTechtreeXfer"),
|
||||
|
||||
labelEnablePrivacy("Options_Network","labelEnablePrivacy"),
|
||||
checkBoxEnablePrivacy("Options_Network","checkBoxEnablePrivacy")
|
||||
|
||||
{
|
||||
try {
|
||||
containerName = "Options_Network";
|
||||
|
@ -44,53 +82,41 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
Config &config= Config::getInstance();
|
||||
this->parentUI=parentUI;
|
||||
this->console.setOnlyChatMessagesInStoredLines(false);
|
||||
//modeinfos=list<ModeInfo> ();
|
||||
|
||||
int leftLabelStart=100;
|
||||
int leftColumnStart=leftLabelStart+300;
|
||||
//int rightLabelStart=450;
|
||||
//int rightColumnStart=rightLabelStart+280;
|
||||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
|
||||
buttonAudioSection.registerGraphicComponent(containerName,"buttonAudioSection");
|
||||
buttonAudioSection.init(0, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
// Video Section
|
||||
buttonVideoSection.registerGraphicComponent(containerName,"labelVideoSection");
|
||||
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.registerGraphicComponent(containerName,"labelMiscSection");
|
||||
buttonMiscSection.init(400, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||
buttonNetworkSettings.init(600, 700,tabButtonWidth,tabButtonHeight+20);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
||||
buttonKeyboardSetup.init(800, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
|
@ -102,7 +128,6 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
|
||||
|
||||
// external server port
|
||||
labelPublishServerExternalPort.registerGraphicComponent(containerName,"labelPublishServerExternalPort");
|
||||
labelPublishServerExternalPort.init(currentLabelStart, currentLine, 150);
|
||||
labelPublishServerExternalPort.setText(lang.getString("PublishServerExternalPort"));
|
||||
|
||||
|
@ -118,11 +143,9 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
|
||||
currentLine-=lineOffset;
|
||||
// server port
|
||||
labelServerPortLabel.registerGraphicComponent(containerName,"labelServerPortLabel");
|
||||
labelServerPortLabel.init(currentLabelStart,currentLine);
|
||||
labelServerPortLabel.setText(lang.getString("ServerPort"));
|
||||
|
||||
listBoxServerPort.registerGraphicComponent(containerName,"listBoxPublishServerExternalPort");
|
||||
listBoxServerPort.init(currentColumnStart, currentLine, 160);
|
||||
|
||||
string portListString = config.getString("PortList",intToStr(GameConstants::serverPort).c_str());
|
||||
|
@ -143,59 +166,47 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
listBoxServerPort.setSelectedItemIndex(portSelectionIndex);
|
||||
|
||||
currentLine-=lineOffset;
|
||||
labelFTPServerPortLabel.registerGraphicComponent(containerName,"labelFTPServerPortLabel");
|
||||
labelFTPServerPortLabel.init(currentLabelStart ,currentLine );
|
||||
labelFTPServerPortLabel.setText(lang.getString("FTPServerPort"));
|
||||
|
||||
int FTPPort = config.getInt("FTPServerPort",intToStr(ServerSocket::getFTPServerPort()).c_str());
|
||||
labelFTPServerPort.registerGraphicComponent(containerName,"labelFTPServerPort");
|
||||
labelFTPServerPort.init(currentColumnStart ,currentLine );
|
||||
labelFTPServerPort.setText(intToStr(FTPPort));
|
||||
currentLine-=lineOffset;
|
||||
labelFTPServerDataPortsLabel.registerGraphicComponent(containerName,"labelFTPServerDataPortsLabel");
|
||||
labelFTPServerDataPortsLabel.init(currentLabelStart ,currentLine );
|
||||
labelFTPServerDataPortsLabel.setText(lang.getString("FTPServerDataPort"));
|
||||
|
||||
char szBuf[8096]="";
|
||||
snprintf(szBuf,8096,"%d - %d",FTPPort + 1, FTPPort + GameConstants::maxPlayers);
|
||||
|
||||
labelFTPServerDataPorts.registerGraphicComponent(containerName,"labelFTPServerDataPorts");
|
||||
labelFTPServerDataPorts.init(currentColumnStart,currentLine );
|
||||
labelFTPServerDataPorts.setText(szBuf);
|
||||
currentLine-=lineOffset;
|
||||
labelEnableFTPServer.registerGraphicComponent(containerName,"labelEnableFTPServer");
|
||||
labelEnableFTPServer.init(currentLabelStart ,currentLine);
|
||||
labelEnableFTPServer.setText(lang.getString("EnableFTPServer"));
|
||||
|
||||
checkBoxEnableFTPServer.registerGraphicComponent(containerName,"checkBoxEnableFTPServer");
|
||||
checkBoxEnableFTPServer.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnableFTPServer.setValue(config.getBool("EnableFTPServer","true"));
|
||||
currentLine-=lineOffset;
|
||||
// FTP Config - start
|
||||
labelEnableFTP.registerGraphicComponent(containerName,"labelEnableFTP");
|
||||
labelEnableFTP.init(currentLabelStart ,currentLine);
|
||||
labelEnableFTP.setText(lang.getString("EnableFTP"));
|
||||
|
||||
checkBoxEnableFTP.registerGraphicComponent(containerName,"checkBoxEnableFTP");
|
||||
checkBoxEnableFTP.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnableFTP.setValue(config.getBool("EnableFTPXfer","true"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTilesetXfer");
|
||||
labelEnableFTPServerInternetTilesetXfer.init(currentLabelStart ,currentLine );
|
||||
labelEnableFTPServerInternetTilesetXfer.setText(lang.getString("EnableFTPServerInternetTilesetXfer"));
|
||||
|
||||
checkBoxEnableFTPServerInternetTilesetXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTilesetXfer");
|
||||
checkBoxEnableFTPServerInternetTilesetXfer.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnableFTPServerInternetTilesetXfer.setValue(config.getBool("EnableFTPServerInternetTilesetXfer","true"));
|
||||
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"labelEnableFTPServerInternetTechtreeXfer");
|
||||
labelEnableFTPServerInternetTechtreeXfer.init(currentLabelStart ,currentLine );
|
||||
labelEnableFTPServerInternetTechtreeXfer.setText(lang.getString("EnableFTPServerInternetTechtreeXfer"));
|
||||
|
||||
checkBoxEnableFTPServerInternetTechtreeXfer.registerGraphicComponent(containerName,"checkBoxEnableFTPServerInternetTechtreeXfer");
|
||||
checkBoxEnableFTPServerInternetTechtreeXfer.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnableFTPServerInternetTechtreeXfer.setValue(config.getBool("EnableFTPServerInternetTechtreeXfer","true"));
|
||||
|
||||
|
@ -205,23 +216,19 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
// FTP config end
|
||||
|
||||
// Privacy flag
|
||||
labelEnablePrivacy.registerGraphicComponent(containerName,"labelEnablePrivacy");
|
||||
labelEnablePrivacy.init(currentLabelStart ,currentLine);
|
||||
labelEnablePrivacy.setText(lang.getString("PrivacyPlease"));
|
||||
|
||||
checkBoxEnablePrivacy.registerGraphicComponent(containerName,"checkBoxEnablePrivacy");
|
||||
checkBoxEnablePrivacy.init(currentColumnStart ,currentLine );
|
||||
checkBoxEnablePrivacy.setValue(config.getBool("PrivacyPlease","false"));
|
||||
//currentLine-=lineOffset;
|
||||
// end
|
||||
|
||||
// buttons
|
||||
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonAbort");
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
|
@ -235,23 +242,11 @@ MenuStateOptionsNetwork::MenuStateOptionsNetwork(Program *program, MainMenu *mai
|
|||
void MenuStateOptionsNetwork::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
console.resetFonts();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
|
||||
buttonVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
std::vector<string> listboxData;
|
||||
|
@ -273,48 +268,19 @@ void MenuStateOptionsNetwork::reloadUI() {
|
|||
|
||||
|
||||
labelServerPortLabel.setText(lang.getString("ServerPort"));
|
||||
|
||||
labelPublishServerExternalPort.setText(lang.getString("PublishServerExternalPort"));
|
||||
|
||||
labelEnableFTP.setText(lang.getString("EnableFTP"));
|
||||
|
||||
labelEnableFTPServer.setText(lang.getString("EnableFTPServer"));
|
||||
|
||||
labelFTPServerPortLabel.setText(lang.getString("FTPServerPort"));
|
||||
|
||||
labelFTPServerDataPortsLabel.setText(lang.getString("FTPServerDataPort"));
|
||||
|
||||
labelEnableFTPServerInternetTilesetXfer.setText(lang.getString("EnableFTPServerInternetTilesetXfer"));
|
||||
|
||||
labelEnableFTPServerInternetTechtreeXfer.setText(lang.getString("EnableFTPServerInternetTechtreeXfer"));
|
||||
|
||||
labelEnablePrivacy.setText(lang.getString("PrivacyPlease"));
|
||||
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
//void MenuStateOptionsNetwork::showMessageBox(const string &text, const string &header, bool toggle){
|
||||
// if(!toggle){
|
||||
// mainMessageBox.setEnabled(false);
|
||||
// }
|
||||
//
|
||||
// if(!mainMessageBox.getEnabled()){
|
||||
// mainMessageBox.setText(text);
|
||||
// mainMessageBox.setHeader(header);
|
||||
// mainMessageBox.setEnabled(true);
|
||||
// }
|
||||
// else{
|
||||
// mainMessageBox.setEnabled(false);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
void MenuStateOptionsNetwork::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
||||
//Config &config= Config::getInstance();
|
||||
void MenuStateOptionsNetwork::mouseClick(int x, int y, MouseButton mouseButton) {
|
||||
CoreData &coreData= CoreData::getInstance();
|
||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||
|
||||
|
|
|
@ -35,8 +35,30 @@ namespace Glest{ namespace Game{
|
|||
// =====================================================
|
||||
// class MenuStateOptions
|
||||
// =====================================================
|
||||
MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMenu, ProgramState **parentUI):
|
||||
MenuState(program, mainMenu, "config")
|
||||
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";
|
||||
|
@ -47,50 +69,38 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
|
||||
int leftLabelStart=100;
|
||||
int leftColumnStart=leftLabelStart+300;
|
||||
//int rightLabelStart=450;
|
||||
//int rightColumnStart=rightLabelStart+280;
|
||||
int buttonRowPos=50;
|
||||
int buttonStartPos=170;
|
||||
//int captionOffset=75;
|
||||
//int currentLabelStart=leftLabelStart;
|
||||
//int currentColumnStart=leftColumnStart;
|
||||
//int currentLine=700;
|
||||
int lineOffset=30;
|
||||
int tabButtonWidth=200;
|
||||
int tabButtonHeight=30;
|
||||
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
mainMessageBoxState=0;
|
||||
|
||||
buttonAudioSection.registerGraphicComponent(containerName,"buttonAudioSection");
|
||||
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.registerGraphicComponent(containerName,"labelVideoSection");
|
||||
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.registerGraphicComponent(containerName,"labelMiscSection");
|
||||
buttonMiscSection.init(400, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
//NetworkSettings
|
||||
buttonNetworkSettings.registerGraphicComponent(containerName,"labelNetworkSettingsSection");
|
||||
buttonNetworkSettings.init(600, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
//KeyboardSetup
|
||||
buttonKeyboardSetup.registerGraphicComponent(containerName,"buttonKeyboardSetup");
|
||||
buttonKeyboardSetup.init(800, 720,tabButtonWidth,tabButtonHeight);
|
||||
buttonKeyboardSetup.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonKeyboardSetup.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
|
@ -101,11 +111,9 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
int currentColumnStart=leftColumnStart; // set to right side
|
||||
|
||||
//soundboxes
|
||||
labelSoundFactory.registerGraphicComponent(containerName,"labelSoundFactory");
|
||||
labelSoundFactory.init(currentLabelStart, currentLine);
|
||||
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
|
||||
|
||||
listBoxSoundFactory.registerGraphicComponent(containerName,"listBoxSoundFactory");
|
||||
listBoxSoundFactory.init(currentColumnStart, currentLine, 175);
|
||||
listBoxSoundFactory.pushBackItem(lang.getString("None"));
|
||||
listBoxSoundFactory.pushBackItem("OpenAL");
|
||||
|
@ -118,26 +126,20 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
listBoxSoundFactory.setSelectedItem(FSoundMode);
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelVolumeFx.registerGraphicComponent(containerName,"labelVolumeFx");
|
||||
labelVolumeFx.init(currentLabelStart, currentLine);
|
||||
labelVolumeFx.setText(lang.getString("FxVolume"));
|
||||
|
||||
listBoxVolumeFx.registerGraphicComponent(containerName,"listBoxVolumeFx");
|
||||
listBoxVolumeFx.init(currentColumnStart, currentLine, 80);
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelVolumeAmbient.registerGraphicComponent(containerName,"labelVolumeAmbient");
|
||||
labelVolumeAmbient.init(currentLabelStart, currentLine);
|
||||
|
||||
listBoxVolumeAmbient.registerGraphicComponent(containerName,"listBoxVolumeAmbient");
|
||||
listBoxVolumeAmbient.init(currentColumnStart, currentLine, 80);
|
||||
labelVolumeAmbient.setText(lang.getString("AmbientVolume"));
|
||||
currentLine-=lineOffset;
|
||||
|
||||
labelVolumeMusic.registerGraphicComponent(containerName,"labelVolumeMusic");
|
||||
labelVolumeMusic.init(currentLabelStart, currentLine);
|
||||
|
||||
listBoxVolumeMusic.registerGraphicComponent(containerName,"listBoxVolumeMusic");
|
||||
listBoxVolumeMusic.init(currentColumnStart, currentLine, 80);
|
||||
labelVolumeMusic.setText(lang.getString("MusicVolume"));
|
||||
//currentLine-=lineOffset;
|
||||
|
@ -165,12 +167,10 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
|
||||
|
||||
// buttons
|
||||
buttonOk.registerGraphicComponent(containerName,"buttonOk");
|
||||
buttonOk.init(buttonStartPos, buttonRowPos, 100);
|
||||
buttonOk.setText(lang.getString("Save"));
|
||||
buttonReturn.setText(lang.getString("Return"));
|
||||
|
||||
buttonReturn.registerGraphicComponent(containerName,"buttonAbort");
|
||||
buttonReturn.init(buttonStartPos+110, buttonRowPos, 100);
|
||||
|
||||
GraphicComponent::applyAllCustomProperties(containerName);
|
||||
|
@ -184,25 +184,12 @@ MenuStateOptionsSound::MenuStateOptionsSound(Program *program, MainMenu *mainMen
|
|||
void MenuStateOptionsSound::reloadUI() {
|
||||
Lang &lang= Lang::getInstance();
|
||||
|
||||
console.resetFonts();
|
||||
mainMessageBox.init(lang.getString("Ok"));
|
||||
|
||||
buttonAudioSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonAudioSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonAudioSection.setText(lang.getString("Audio"));
|
||||
|
||||
buttonVideoSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonVideoSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonVideoSection.setText(lang.getString("Video"));
|
||||
|
||||
buttonMiscSection.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonMiscSection.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonMiscSection.setText(lang.getString("Misc"));
|
||||
|
||||
buttonNetworkSettings.setFont(CoreData::getInstance().getMenuFontVeryBig());
|
||||
buttonNetworkSettings.setFont3D(CoreData::getInstance().getMenuFontVeryBig3D());
|
||||
buttonNetworkSettings.setText(lang.getString("Network"));
|
||||
|
||||
labelSoundFactory.setText(lang.getString("SoundAndMusic2"));
|
||||
|
||||
std::vector<string> listboxData;
|
||||
|
@ -212,37 +199,15 @@ void MenuStateOptionsSound::reloadUI() {
|
|||
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"));
|
||||
|
||||
GraphicComponent::reloadFontsForRegisterGraphicComponents(containerName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//void MenuStateOptionsSound::showMessageBox(const string &text, const string &header, bool toggle){
|
||||
// if(!toggle){
|
||||
// mainMessageBox.setEnabled(false);
|
||||
// }
|
||||
//
|
||||
// if(!mainMessageBox.getEnabled()){
|
||||
// mainMessageBox.setText(text);
|
||||
// mainMessageBox.setHeader(header);
|
||||
// mainMessageBox.setEnabled(true);
|
||||
// }
|
||||
// else{
|
||||
// mainMessageBox.setEnabled(false);
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
void MenuStateOptionsSound::mouseClick(int x, int y, MouseButton mouseButton){
|
||||
|
||||
//Config &config= Config::getInstance();
|
||||
|
|
|
@ -37,8 +37,22 @@ namespace Glest{ namespace Game{
|
|||
|
||||
bool MenuStateRoot::gameUpdateChecked = false;
|
||||
|
||||
MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
||||
MenuState(program, mainMenu, "root"), updatesHttpServerThread(NULL)
|
||||
MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu) :
|
||||
MenuState(program, mainMenu, "root"), updatesHttpServerThread(NULL),
|
||||
buttonNewGame("MainMenu","buttonNewGame"),
|
||||
buttonLoadGame("MainMenu","buttonLoadGame"),
|
||||
buttonMods("MainMenu","buttonMods"),
|
||||
buttonOptions("MainMenu","buttonOptions"),
|
||||
buttonAbout("MainMenu","buttonAbout"),
|
||||
buttonExit("MainMenu","buttonExit"),
|
||||
labelVersion("MainMenu","labelVersion"),
|
||||
|
||||
mainMessageBox("MainMenu","mainMessageBox"),
|
||||
errorMessageBox("MainMenu","errorMessageBox"),
|
||||
ftpMessageBox("MainMenu","ftpMessageBox"),
|
||||
|
||||
popupMenu("MainMenu","popupMenu")
|
||||
|
||||
{
|
||||
containerName = "MainMenu";
|
||||
|
||||
|
@ -51,7 +65,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
|||
int buttonXPosition = (1000 - buttonWidth) / 2;
|
||||
|
||||
|
||||
labelVersion.registerGraphicComponent(containerName,"labelVersion");
|
||||
//labelVersion.registerGraphicComponent(containerName,"labelVersion");
|
||||
if(EndsWith(glestVersionString, "-dev") == false){
|
||||
labelVersion.init(525, yPos);
|
||||
labelVersion.setText(glestVersionString);
|
||||
|
@ -63,22 +77,22 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
|||
}
|
||||
|
||||
yPos-=55;
|
||||
buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame");
|
||||
//buttonNewGame.registerGraphicComponent(containerName,"buttonNewGame");
|
||||
buttonNewGame.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonLoadGame.registerGraphicComponent(containerName,"buttonLoadGame");
|
||||
//buttonLoadGame.registerGraphicComponent(containerName,"buttonLoadGame");
|
||||
buttonLoadGame.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonMods.registerGraphicComponent(containerName,"buttonMods");
|
||||
//buttonMods.registerGraphicComponent(containerName,"buttonMods");
|
||||
buttonMods.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonOptions.registerGraphicComponent(containerName,"buttonOptions");
|
||||
//buttonOptions.registerGraphicComponent(containerName,"buttonOptions");
|
||||
buttonOptions.init(buttonXPosition, yPos, buttonWidth);
|
||||
yPos-=40;
|
||||
buttonAbout.registerGraphicComponent(containerName,"buttonAbout");
|
||||
//buttonAbout.registerGraphicComponent(containerName,"buttonAbout");
|
||||
buttonAbout.init(buttonXPosition, yPos , buttonWidth);
|
||||
yPos-=40;
|
||||
buttonExit.registerGraphicComponent(containerName,"buttonExit");
|
||||
//buttonExit.registerGraphicComponent(containerName,"buttonExit");
|
||||
buttonExit.init(buttonXPosition, yPos, buttonWidth);
|
||||
|
||||
buttonNewGame.setText(lang.getString("NewGame"));
|
||||
|
@ -89,15 +103,15 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
|||
buttonExit.setText(lang.getString("Exit"));
|
||||
|
||||
//mesage box
|
||||
mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
//mainMessageBox.registerGraphicComponent(containerName,"mainMessageBox");
|
||||
mainMessageBox.init(lang.getString("Yes"), lang.getString("No"));
|
||||
mainMessageBox.setEnabled(false);
|
||||
|
||||
errorMessageBox.registerGraphicComponent(containerName,"errorMessageBox");
|
||||
//errorMessageBox.registerGraphicComponent(containerName,"errorMessageBox");
|
||||
errorMessageBox.init(lang.getString("Ok"));
|
||||
errorMessageBox.setEnabled(false);
|
||||
|
||||
ftpMessageBox.registerGraphicComponent(containerName,"ftpMessageBox");
|
||||
//ftpMessageBox.registerGraphicComponent(containerName,"ftpMessageBox");
|
||||
ftpMessageBox.init(lang.getString("Yes"), lang.getString("No"));
|
||||
ftpMessageBox.setEnabled(false);
|
||||
|
||||
|
@ -106,7 +120,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
|||
menuItems.push_back("1");
|
||||
menuItems.push_back("2");
|
||||
menuItems.push_back("3");
|
||||
popupMenu.registerGraphicComponentOnlyFontCallbacks(containerName, "popupMenu");
|
||||
//popupMenu.registerGraphicComponentOnlyFontCallbacks(containerName, "popupMenu");
|
||||
popupMenu.setW(100);
|
||||
popupMenu.setH(100);
|
||||
popupMenu.init("Test Menu",menuItems);
|
||||
|
|
|
@ -1227,7 +1227,9 @@ void ClientInterface::updateFrame(int *checkFrame) {
|
|||
return;
|
||||
}
|
||||
|
||||
throw megaglest_runtime_error("error retrieving nmtQuit returned false!");
|
||||
//throw megaglest_runtime_error("error retrieving nmtQuit returned false!");
|
||||
setQuit(true);
|
||||
done = true;
|
||||
}
|
||||
setQuit(true);
|
||||
done = true;
|
||||
|
|
|
@ -203,7 +203,7 @@ void SoundRenderer::playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPo
|
|||
}
|
||||
}
|
||||
|
||||
void SoundRenderer::playFx(StaticSound *staticSound) {
|
||||
void SoundRenderer::playFx(StaticSound *staticSound, bool force) {
|
||||
if(staticSound!=NULL){
|
||||
staticSound->setVolume(fxVolume);
|
||||
if(soundPlayer != NULL) {
|
||||
|
@ -213,7 +213,7 @@ void SoundRenderer::playFx(StaticSound *staticSound) {
|
|||
}
|
||||
|
||||
if(soundPlayer) {
|
||||
soundPlayer->play(staticSound);
|
||||
soundPlayer->play(staticSound, force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@ public:
|
|||
|
||||
//fx
|
||||
void playFx(StaticSound *staticSound, Vec3f soundPos, Vec3f camPos);
|
||||
void playFx(StaticSound *staticSound);
|
||||
void playFx(StaticSound *staticSound, bool force=false);
|
||||
|
||||
//ambient
|
||||
void playAmbient(StrSound *strSound);
|
||||
|
|
|
@ -368,6 +368,9 @@ void UnitUpdater::spawnAttack(Unit *unit,string spawnUnit,int spawnUnitcount,int
|
|||
&& unit->getRandom()->randRange(1, 100) <= probability) {
|
||||
continue;
|
||||
}
|
||||
if(targetPos==Vec2i(-10,-10)) {
|
||||
targetPos=unit->getTargetPos();
|
||||
}
|
||||
Unit* spawned=this->spawnUnit(unit,spawnUnit,spawnUnitAtTarget?targetPos:unit->getCenteredPos());
|
||||
if(spawned!=NULL){
|
||||
if(healthMin>0 && healthMin<100 && healthMax>=healthMin && healthMax<=100){
|
||||
|
@ -3124,7 +3127,7 @@ bool UnitUpdater::unitOnRange(Unit *unit, int range, Unit **rangedPtr,
|
|||
|
||||
if(world->getAttackWarningsEnabled() == true) {
|
||||
|
||||
SoundRenderer::getInstance().playFx(CoreData::getInstance().getAttentionSound());
|
||||
SoundRenderer::getInstance().playFx(CoreData::getInstance().getAttentionSound(),true);
|
||||
world->addAttackEffects(enemyUnit);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,39 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
|
|||
link_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/xerces-c-src_2_8_0/lib)
|
||||
ENDIF()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(STREFLOP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#########################################################################################
|
||||
# megaglest map editor
|
||||
|
||||
|
@ -88,7 +121,7 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
|
|||
${GLEST_LIB_INCLUDE_ROOT}xml/rapidxml
|
||||
${GLEST_MAIN_INCLUDE_ROOT}global)
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
${GLEST_LIB_INCLUDE_DIRS}
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop)
|
||||
|
@ -147,7 +180,7 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
|
|||
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 ${SDL_VERSION_NAME} ${SDL_VERSION_NAME}main lua5.1 ${MG_STREFLOP} libmegaglest stdc++ moldname mingwex msvcrt user32 kernel32)
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${MG_STREFLOP})
|
||||
ENDIF()
|
||||
|
||||
|
|
|
@ -1028,7 +1028,7 @@ void MainWindow::onMenuEditRandomizeHeights(wxCommandEvent &event) {
|
|||
program->setUndoPoint(ctAll);//randomizeHeights(-300,400,30,3);
|
||||
|
||||
SimpleDialog simpleDialog;
|
||||
simpleDialog.addValue("Initial Reset", boolToStr(randomWithReset),"If set to '0' no height reset is done before calculating");
|
||||
simpleDialog.addValue("Initial Reset", boolToStr(randomWithReset),"(1 = true, 0 = false) If set to '0' no height reset is done before calculating");
|
||||
simpleDialog.addValue("Min Height", intToStr(randomMinimumHeight),"Lowest random height. example: -300 or below if you want water , 0 if you don't want water.");
|
||||
simpleDialog.addValue("Max Height", intToStr(randomMaximumHeight),"Max random height. A good value is 400");
|
||||
simpleDialog.addValue("Chance Devider", intToStr(randomChanceDevider),"Defines how often you get a hill or hole default is 30. Bigger number, less hills/holes.");
|
||||
|
@ -1036,7 +1036,13 @@ void MainWindow::onMenuEditRandomizeHeights(wxCommandEvent &event) {
|
|||
if (!simpleDialog.show("Randomize Height")) return;
|
||||
|
||||
try {
|
||||
randomWithReset=strToBool(simpleDialog.getValue("Initial Reset"));
|
||||
string checkValue = simpleDialog.getValue("Initial Reset");
|
||||
if(checkValue != "" && strToInt(checkValue) > 1) {
|
||||
randomWithReset = true;
|
||||
}
|
||||
else {
|
||||
randomWithReset = strToBool(simpleDialog.getValue("Initial Reset"));
|
||||
}
|
||||
randomMinimumHeight=strToInt(simpleDialog.getValue("Min Height"));
|
||||
randomMaximumHeight=strToInt(simpleDialog.getValue("Max Height"));
|
||||
randomChanceDevider=strToInt(simpleDialog.getValue("Chance Devider"));
|
||||
|
|
|
@ -1,9 +1,42 @@
|
|||
#########################################################################################
|
||||
# streflop
|
||||
|
||||
OPTION(FORCE_EMBEDDED_LIBS "Force use of embedded libraries' code." OFF)
|
||||
|
||||
# IMPORTANT: should come BEFORE finding packages
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
ADD_SUBDIRECTORY(sources/streflop)
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
ADD_SUBDIRECTORY(sources/streflop)
|
||||
ELSE()
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#########################################################################################
|
||||
|
@ -228,7 +261,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
# megaglest lib
|
||||
|
||||
SET(DIRS_WITH_SRC
|
||||
compression
|
||||
compression
|
||||
feathery_ftp
|
||||
glew
|
||||
graphics
|
||||
|
@ -241,15 +274,14 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
util
|
||||
xml)
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
SET(DIRS_WITH_SRC
|
||||
${DIRS_WITH_SRC}
|
||||
${DIRS_WITH_SRC}
|
||||
streflop
|
||||
streflop/libm_flt32_source
|
||||
streflop/softfloat)
|
||||
streflop/softfloat)
|
||||
ENDIF()
|
||||
|
||||
OPTION(FORCE_EMBEDDED_LIBS "Force use of embedded libraries' code." OFF)
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(FORCE_USE_EMBEDDED_Miniupnpc ON)
|
||||
ELSE()
|
||||
|
@ -452,9 +484,6 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
MESSAGE(STATUS "Building shared game library as a SHARED library and saving to [${LIBRARY_OUTPUT_PATH}]")
|
||||
ENDIF()
|
||||
|
||||
# ADD_LIBRARY(libmegaglest SHARED ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
# ADD_LIBRARY(libmegaglest STATIC ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
|
||||
MESSAGE(STATUS "EXTERNAL_LIBS = [${EXTERNAL_LIBS}]")
|
||||
|
||||
OPTION(MINIUPNP_DEBUG_BUILD "Build MegaGlest with UPNP DEBUG enabled" OFF)
|
||||
|
@ -468,7 +497,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 ${SDL_VERSION_NAME} ${SDL_VERSION_NAME}main lua5.1 stdc++ moldname mingwex msvcrt user32 kernel32)
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${EXTERNAL_LIBS})
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#define STREFLOP_COND_H
|
||||
|
||||
#if defined(STREFLOP_X87) || defined(STREFLOP_SSE) || defined(STREFLOP_SOFT)
|
||||
#include "streflop.h"
|
||||
#include <streflop.h>
|
||||
using namespace streflop;
|
||||
|
||||
namespace math {
|
|
@ -97,7 +97,7 @@ public:
|
|||
virtual ~SoundPlayerOpenAL();
|
||||
virtual bool init(const SoundPlayerParams *params);
|
||||
virtual void end();
|
||||
virtual void play(StaticSound *staticSound);
|
||||
virtual void play(StaticSound *staticSound, bool force=false);
|
||||
virtual void play(StrSound *strSound, int64 fadeOn=0);
|
||||
virtual void stop(StrSound *strSound, int64 fadeOff=0);
|
||||
virtual void stopAllSounds(int64 fadeOff=0);
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
};
|
||||
virtual bool init(const SoundPlayerParams *params)= 0;
|
||||
virtual void end()= 0;
|
||||
virtual void play(StaticSound *staticSound)= 0;
|
||||
virtual void play(StaticSound *staticSound, bool force=false)= 0;
|
||||
virtual void play(StrSound *strSound, int64 fadeOn=0)= 0; //delay and fade in miliseconds
|
||||
virtual void stop(StrSound *strSound, int64 fadeOff=0)= 0;
|
||||
virtual void stopAllSounds(int64 fadeOff=0)= 0;
|
||||
|
|
|
@ -1,15 +1,50 @@
|
|||
AUX_SOURCE_DIRECTORY(libm/flt-32 libm_flt32_source)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
SET(cxxflags "-w -O3 -I${CMAKE_CURRENT_SOURCE_DIR}/libm/headers")
|
||||
if (NOT $ENV{CXX} MATCHES "icpc")
|
||||
SET(cxxflags "${cxxflags} -mfpmath=sse -msse")
|
||||
endif (NOT $ENV{CXX} MATCHES "icpc")
|
||||
SET_SOURCE_FILES_PROPERTIES(${libm_flt32_source} PROPERTIES COMPILE_FLAGS "-DLIBM_COMPILING_FLT32 ${cxxflags}")
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
ADD_LIBRARY(streflop STATIC EXCLUDE_FROM_ALL
|
||||
SMath.cpp
|
||||
Random.cpp
|
||||
streflopC.cpp
|
||||
${libm_flt32_source}
|
||||
)
|
||||
set_target_properties(streflop PROPERTIES COMPILE_FLAGS "${PIC_FLAG}")
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(STREFLOP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
AUX_SOURCE_DIRECTORY(libm/flt-32 libm_flt32_source)
|
||||
|
||||
SET(cxxflags "-w -O3 -I${CMAKE_CURRENT_SOURCE_DIR}/libm/headers")
|
||||
if (NOT $ENV{CXX} MATCHES "icpc")
|
||||
SET(cxxflags "${cxxflags} -mfpmath=sse -msse")
|
||||
endif (NOT $ENV{CXX} MATCHES "icpc")
|
||||
SET_SOURCE_FILES_PROPERTIES(${libm_flt32_source} PROPERTIES COMPILE_FLAGS "-DLIBM_COMPILING_FLT32 ${cxxflags}")
|
||||
|
||||
ADD_LIBRARY(streflop STATIC EXCLUDE_FROM_ALL
|
||||
SMath.cpp
|
||||
Random.cpp
|
||||
streflopC.cpp
|
||||
${libm_flt32_source}
|
||||
)
|
||||
set_target_properties(streflop PROPERTIES COMPILE_FLAGS "${PIC_FLAG}")
|
||||
ENDIF()
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
//#include "LogOutput.h"
|
||||
#include "util.h"
|
||||
#include "streflop_cond.h"
|
||||
#include "../../include/platform/common/streflop_cond.h"
|
||||
|
||||
/**
|
||||
@brief checks FPU control registers.
|
||||
|
|
|
@ -1093,7 +1093,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
glob_t globbuf;
|
||||
|
||||
int res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#2 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1127,13 +1127,13 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
globfree(&globbuf);
|
||||
|
||||
// Look recursively for sub-folders
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||
#else
|
||||
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#3 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1142,10 +1142,10 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
|||
#endif
|
||||
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
struct stat statStruct;
|
||||
// only process if dir..
|
||||
int actStat = lstat( globbuf.gl_pathv[i], &statStruct);
|
||||
lstat( globbuf.gl_pathv[i], &statStruct);
|
||||
if( S_ISDIR(statStruct.st_mode) == 0)
|
||||
continue;
|
||||
#endif
|
||||
|
@ -1274,7 +1274,7 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
}
|
||||
|
||||
int res = glob(mypath.c_str(), globFlags, 0, &globbuf);
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#4 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1307,14 +1307,14 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
globfree(&globbuf);
|
||||
|
||||
// Look recursively for sub-folders
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||
#else //APPLE doesn't have the GLOB_ONLYDIR definition..
|
||||
globFlags |= GLOB_ONLYDIR;
|
||||
res = glob(mypath.c_str(), globFlags, 0, &globbuf);
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#5 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1323,10 +1323,10 @@ vector<string> getFolderTreeContentsListRecursively(const string &path, const st
|
|||
#endif
|
||||
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
struct stat statStruct;
|
||||
// only get if dir..
|
||||
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
|
||||
lstat( globbuf.gl_pathv[ i], &statStruct);
|
||||
if( S_ISDIR(statStruct.st_mode) == 0)
|
||||
continue;
|
||||
#endif
|
||||
|
@ -1415,7 +1415,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
|||
|
||||
int res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#6 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1447,13 +1447,13 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
|||
globfree(&globbuf);
|
||||
|
||||
// Look recursively for sub-folders
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
res = glob(mypath.c_str(), 0, 0, &globbuf);
|
||||
#else //APPLE doesn't have the GLOB_ONLYDIR definition..
|
||||
res = glob(mypath.c_str(), GLOB_ONLYDIR, 0, &globbuf);
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||
#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
|
||||
if(res < 0) {
|
||||
std::stringstream msg;
|
||||
msg << "#7 Couldn't scan directory '" << mypath << "': " << strerror(errno);
|
||||
|
@ -1462,10 +1462,10 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
|||
#endif
|
||||
|
||||
for(int i = 0; i < (int)globbuf.gl_pathc; ++i) {
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
||||
struct stat statStruct;
|
||||
// only get if dir..
|
||||
int actStat = lstat( globbuf.gl_pathv[ i], &statStruct);
|
||||
lstat( globbuf.gl_pathv[ i], &statStruct);
|
||||
if( S_ISDIR(statStruct.st_mode) == 0)
|
||||
continue;
|
||||
#endif
|
||||
|
|
|
@ -319,7 +319,7 @@ string Ip::getString() const{
|
|||
// class Socket
|
||||
// ===============================================
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__) || defined(__linux__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(BSD) || defined(__APPLE__) || defined(__linux__)
|
||||
# define USE_GETIFADDRS 1
|
||||
# include <ifaddrs.h>
|
||||
#endif
|
||||
|
@ -738,6 +738,9 @@ std::vector<std::string> Socket::getLocalIPAddressList() {
|
|||
/* I want IP address attached to "eth0" */
|
||||
char szBuf[100]="";
|
||||
snprintf(szBuf,100,"%s%d",intfName.c_str(),idx);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Trying NIC named [%s]\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
//printf("In [%s::%s Line: %d] Trying NIC named [%s]\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
int maxIfNameLength = std::min((int)strlen(szBuf),IFNAMSIZ-1);
|
||||
|
||||
strncpy(ifr.ifr_name, szBuf, maxIfNameLength);
|
||||
|
|
|
@ -516,7 +516,7 @@ void SoundPlayerOpenAL::end() {
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
void SoundPlayerOpenAL::play(StaticSound* staticSound) {
|
||||
void SoundPlayerOpenAL::play(StaticSound* staticSound, bool force ) {
|
||||
assert(staticSound != 0);
|
||||
|
||||
if(initOk == false) return;
|
||||
|
@ -524,8 +524,14 @@ void SoundPlayerOpenAL::play(StaticSound* staticSound) {
|
|||
try {
|
||||
StaticSoundSource* source = findStaticSoundSource();
|
||||
|
||||
if(source == 0) {
|
||||
return;
|
||||
if(source == 0 ) {
|
||||
if( force == false )
|
||||
return;
|
||||
else {
|
||||
// force usage of first StaticSoundSource
|
||||
source = staticSources.front();
|
||||
source->stop();
|
||||
}
|
||||
}
|
||||
source->play(staticSound);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include "streflopC.h"
|
||||
|
||||
#include "streflop_cond.h"
|
||||
#include "../../include/platform/common/streflop_cond.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
@ -33,15 +33,53 @@ IF(BUILD_MEGAGLEST_TESTS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
IF(FORCE_STREFLOP_SOFTWRAPPER)
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ELSE()
|
||||
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
|
||||
pkg_search_module(STREFLOP streflop-sse)
|
||||
ELSE()
|
||||
IF(HAS_X87_SUPPORT)
|
||||
pkg_search_module(STREFLOP streflop-x87)
|
||||
ELSE()
|
||||
pkg_search_module(STREFLOP streflop-soft)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
pkg_search_module(STREFLOP streflop)
|
||||
ENDIF()
|
||||
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
|
||||
|
||||
IF(FORCE_EMBEDDED_LIBS)
|
||||
SET(STREFLOP_FOUND OFF)
|
||||
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(STREFLOP_FOUND)
|
||||
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
|
||||
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
#########################################################################################
|
||||
# megaglest test code
|
||||
|
||||
SET(DIRS_WITH_SRC
|
||||
./
|
||||
shared_lib/graphics
|
||||
shared_lib/streflop
|
||||
shared_lib/util
|
||||
./
|
||||
shared_lib/graphics
|
||||
shared_lib/util
|
||||
shared_lib/xml)
|
||||
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
SET(DIRS_WITH_SRC
|
||||
${DIRS_WITH_SRC}
|
||||
shared_lib/streflop)
|
||||
ENDIF()
|
||||
|
||||
SET(MG_INCLUDES_ROOT "./")
|
||||
SET(MG_SOURCES_ROOT "./")
|
||||
|
@ -72,10 +110,12 @@ IF(BUILD_MEGAGLEST_TESTS)
|
|||
)
|
||||
|
||||
IF(WANT_USE_STREFLOP)
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
${GLEST_LIB_INCLUDE_DIRS}
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop/libm_flt32_source)
|
||||
IF(NOT STREFLOP_FOUND)
|
||||
SET(GLEST_LIB_INCLUDE_DIRS
|
||||
${GLEST_LIB_INCLUDE_DIRS}
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop
|
||||
${GLEST_LIB_INCLUDE_ROOT}streflop/libm_flt32_source)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES( ${GLEST_LIB_INCLUDE_DIRS} )
|
||||
|
@ -153,7 +193,7 @@ IF(BUILD_MEGAGLEST_TESTS)
|
|||
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
|
||||
|
||||
IF(NOT WIN32)
|
||||
IF(WANT_USE_STREFLOP)
|
||||
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${MG_STREFLOP})
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
|
||||
|
|
Loading…
Reference in New Issue