- ported bugfixes for 3.6.0.3 release:
- CMake build system fixes applied during debian testing (like checking for compiler SSE support etc) - Windows client fix for headless server operation - Crash for some systems when trying to use VBO's - Fixed AZERTY keyboard support - Enhanced support for screenshots in g3d viewer - Updated particle code from titi - Bugfix for custom data path override causing compiler error - Bugfix for fontconfig to properly find fonts on systems that support and have fontconfig installed (fixes numerous non debian based systems that reported null font errors) - Minor UI fix on battle end screen when playing 8 players (last player was sometimes chopped off)
This commit is contained in:
parent
2224d75d10
commit
f40c37f5e8
|
@ -1,7 +1,7 @@
|
|||
CMAKE_MINIMUM_REQUIRED( VERSION 2.6.2 )
|
||||
PROJECT( MegaGlest )
|
||||
|
||||
#SET(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
# SET(CMAKE_VERBOSE_MAKEFILE ON)
|
||||
|
||||
#
|
||||
# *NOTE: For now we assume some variation of GCC Compiler (or MingW for Windows binaries)
|
||||
|
@ -55,6 +55,7 @@ if (NOT ${XVFB_RUN} MATCHES "XVFB_RUN-NOTFOUND")
|
|||
message(STATUS "Using xvfb-run to run man2help.")
|
||||
endif()
|
||||
|
||||
include(${CMAKE_SOURCE_DIR}/mk/cmake/Modules/SpecialMacros.cmake)
|
||||
|
||||
## Compiler flags
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||
|
@ -74,11 +75,42 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
|||
# For gcc warning options see: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
|
||||
IF(NOT MINGW)
|
||||
# For tons of verbose warnings add: -Wall
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic")
|
||||
# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -rdynamic")
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -rdynamic")
|
||||
ELSE()
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE")
|
||||
# ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -mfpmath=sse -msse -DUNICODE")
|
||||
ADD_DEFINITIONS("-Wreturn-type -fno-strict-aliasing -frounding-math -fsignaling-nans -DUNICODE")
|
||||
ENDIF()
|
||||
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
|
||||
|
||||
IF(NOT MAX_SSE_LEVEL_DESIRED)
|
||||
SET(MAX_SSE_LEVEL_DESIRED "1" CACHE STRING "Set the max SSE level to use if supported (0-3)" FORCE)
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "*NOTE: Checking for max SSE LEVEL [${MAX_SSE_LEVEL_DESIRED}]")
|
||||
special_check_for_sse( ${MAX_SSE_LEVEL_DESIRED} )
|
||||
|
||||
OPTION(WANT_STREFLOP "use the library streflop" ON)
|
||||
IF(WANT_STREFLOP)
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32")
|
||||
|
||||
IF(HAS_SSE_EXTENSIONS)
|
||||
ADD_DEFINITIONS("-DSTREFLOP_SSE")
|
||||
MESSAGE(STATUS "*NOTE: using SSE for STREFLOP.")
|
||||
ELSE()
|
||||
special_check_for_x87()
|
||||
|
||||
IF(HAS_X87_SUPPORT)
|
||||
ADD_DEFINITIONS("-DSTREFLOP_X87")
|
||||
MESSAGE(STATUS "*NOTE: using X87 for STREFLOP.")
|
||||
ELSE()
|
||||
ADD_DEFINITIONS("-DSTREFLOP_SOFT")
|
||||
MESSAGE(STATUS "*NOTE: using SOFT emulation for STREFLOP.")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE()
|
||||
MESSAGE(STATUS "*WARNING: Disabled use of STREFLOP! Out of synchs may occur")
|
||||
ENDIF()
|
||||
|
||||
# Debug compiler flags
|
||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g3")
|
||||
|
@ -169,21 +201,12 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
|||
|
||||
ENDIF()
|
||||
|
||||
OPTION(WANT_STREFLOP "use the library streflop" ON)
|
||||
|
||||
# Win32 specific Compiler Flags
|
||||
IF(WIN32)
|
||||
ADD_DEFINITIONS("-D_WINDOWS -D_WIN32 -D_STDCALL_SUPPORTED -D_M_IX86 -DXML_LIBRARY -D_LIB -DCURL_STATICLIB")
|
||||
ELSE()
|
||||
ADD_DEFINITIONS("-DCURL_STATICLIB")
|
||||
ENDIF()
|
||||
|
||||
IF(WANT_STREFLOP)
|
||||
ADD_DEFINITIONS("-DUSE_STREFLOP -DSTREFLOP_SSE -DSTREFLOP_RANDOM_GEN_SIZE=32 -DLIBM_COMPILING_FLT32")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "*WARNING: Disabled use of STREFLOP! Out of synchs may occur")
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
|
@ -240,6 +263,13 @@ IF(EXISTS "${PROJECT_SOURCE_DIR}/data/glest_game/")
|
|||
ADD_SUBDIRECTORY( ${PROJECT_SOURCE_DIR}/data/glest_game )
|
||||
ENDIF()
|
||||
|
||||
get_directory_property( DirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS )
|
||||
foreach( d ${DirDefs} )
|
||||
message( STATUS "=====> Found Define: " ${d} )
|
||||
endforeach()
|
||||
message( STATUS "=====> DirDefs: " ${DirDefs} )
|
||||
#MESSAGE(STATUS "*** Compiler definitions are [${COMPILE_DEFINITIONS}]")
|
||||
|
||||
MARK_AS_ADVANCED(SDLMAIN_LIBRARY)
|
||||
MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(SDL_LIBRARY)
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
#
|
||||
# FTGL_FOUND - system has ftgl
|
||||
# FTGL_INCLUDE_DIR - path to FTGL/FTGL.h
|
||||
# FTGL_LIBRARY - the library that must be included
|
||||
# FTGL_LIBRARY - the library that must be included
|
||||
# FTGL_LIBRARY_PATH - the library path
|
||||
#
|
||||
#
|
||||
|
||||
|
@ -14,17 +15,34 @@ IF(WANT_STATIC_LIBS)
|
|||
OPTION(FTGL_STATIC "Set to ON to link your project with static library (instead of DLL)." ON)
|
||||
ENDIF()
|
||||
|
||||
#message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! #1 Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]")
|
||||
|
||||
IF (FTGL_LIBRARY AND FTGL_INCLUDE_DIR)
|
||||
SET(FTGL_FOUND "YES")
|
||||
message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! FTGL lib ALREADY FOUND in: [${FTGL_LIBRARY}]")
|
||||
ELSE (FTGL_LIBRARY AND FTGL_INCLUDE_DIR)
|
||||
|
||||
FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h PATHS /usr/local/include /usr/include)
|
||||
IF(FTGL_LIBRARY_PATH)
|
||||
message(STATUS "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Searching for FTGL lib in custom path: [${FTGL_LIBRARY_PATH}]")
|
||||
ENDIF()
|
||||
|
||||
IF (FTGL_STATIC AND NOT FTGL_LIBRARY)
|
||||
FIND_LIBRARY(FTGL_LIBRARY NAMES libftgl.a ftgl PATHS /usr/local/lib /usr/lib)
|
||||
ELSE()
|
||||
FIND_LIBRARY(FTGL_LIBRARY NAMES ftgl PATHS /usr/local/lib /usr/lib)
|
||||
ENDIF()
|
||||
FIND_PATH(FTGL_INCLUDE_DIR FTGL/ftgl.h
|
||||
PATHS /usr/local/include
|
||||
/usr/include)
|
||||
|
||||
IF (FTGL_STATIC AND NOT FTGL_LIBRARY)
|
||||
FIND_LIBRARY(FTGL_LIBRARY
|
||||
NAMES libftgl.a ftgl libftgl libftgl.dll
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
${FTGL_LIBRARY_PATH})
|
||||
ELSE()
|
||||
FIND_LIBRARY(FTGL_LIBRARY
|
||||
NAMES ftgl libftgl libftgl.dll libftgl.a
|
||||
PATHS /usr/local/lib
|
||||
/usr/lib
|
||||
${FTGL_LIBRARY_PATH})
|
||||
ENDIF()
|
||||
|
||||
IF (FTGL_INCLUDE_DIR AND FTGL_LIBRARY)
|
||||
SET(FTGL_FOUND "YES")
|
||||
|
|
|
@ -2,12 +2,23 @@
|
|||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# which compilers to use for C and C++
|
||||
SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
|
||||
SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
|
||||
SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
|
||||
#SET(CMAKE_C_COMPILER i586-mingw32msvc-gcc)
|
||||
#SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
|
||||
#SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
|
||||
SET(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||
SET(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||
SET(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||
|
||||
# here is the target environment located
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
|
||||
#SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32 ${PROJECT_SOURCE_DIR}/source/win32_deps/lib)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/freetype-2.4.8/include)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/glew-1.7.0/include)
|
||||
include_directories(${PROJECT_SOURCE_DIR}/source/win32_deps/ftgl-2.1.3~rc5/src)
|
||||
#add_definitions(-std=c++0x)
|
||||
add_definitions( -std=gnu++0x )
|
||||
add_definitions( -DTA3D_PLATFORM_MSVC=1 )
|
||||
add_definitions( -DTA3D_PLATFORM_WINDOWS=1 )
|
||||
|
||||
# adjust the default behaviour of the FIND_XXX() commands:
|
||||
# search headers and libraries in the target environment, search
|
||||
|
|
|
@ -3,7 +3,7 @@ set -e
|
|||
# Use this script to copy shared (libs) files to specified location
|
||||
# ----------------------------------------------------------------------------
|
||||
# Written by Vivek Gite <http://www.cyberciti.biz/>
|
||||
# (c) 2006 nixCraft under GNU GPL v2.0+
|
||||
# Copyright (c) 2006 nixCraft under GNU GPL v2.0+
|
||||
# Last updated on: Apr/06/2010 by Vivek Gite
|
||||
# ----------------------------------------------------------------------------
|
||||
# + Modified for megaglest deployment - Softcoder
|
||||
|
|
|
@ -19,4 +19,4 @@ cd $GAMEDIR
|
|||
# export game library directory
|
||||
test -n "${LIBDIR}" && export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${GAMEDIR}/${LIBDIR}"
|
||||
|
||||
./megaglest_configurator
|
||||
./megaglest_configurator $@
|
||||
|
|
|
@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTF
|
|||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"
|
||||
|
||||
"$GAMEDIR/megaglest_g3dviewer" "$1"
|
||||
"$GAMEDIR/megaglest_g3dviewer" $@
|
||||
|
|
|
@ -120,4 +120,4 @@ findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECTFB_LINKEDLIBNAME}" "$DIRECTF
|
|||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${FUSION_LINKEDLIBNAME}" "$FUSION_LIBLOOKUP1" "$FUSION_LIBLOOKUP2"
|
||||
findMissingSO "$LDCONFIG" "$GAMEDIR/$LIBDIR/${DIRECT_LINKEDLIBNAME}" "$DIRECT_LIBLOOKUP1" "$DIRECT_LIBLOOKUP2"
|
||||
|
||||
"$GAMEDIR/megaglest_editor" "$1"
|
||||
"$GAMEDIR/megaglest_editor" $@
|
||||
|
|
Binary file not shown.
|
@ -16,6 +16,7 @@
|
|||
#include "xml_parser.h"
|
||||
#include "util.h"
|
||||
#include "conversion.h"
|
||||
#include <memory>
|
||||
#include"platform_util.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "util.h"
|
||||
#include <wx/stdpaths.h>
|
||||
#include <platform_util.h>
|
||||
#include <memory>
|
||||
|
||||
using namespace std;
|
||||
using namespace Shared::PlatformCommon;
|
||||
|
|
|
@ -105,6 +105,7 @@ const wxChar *GAME_ARGS[] = {
|
|||
wxT("--rotate-x-value"),
|
||||
wxT("--rotate-y-value"),
|
||||
wxT("--screenshot-format"),
|
||||
wxT("--verbose"),
|
||||
};
|
||||
|
||||
enum GAME_ARG_TYPE {
|
||||
|
@ -121,6 +122,7 @@ enum GAME_ARG_TYPE {
|
|||
GAME_ARG_ROTATE_X_VALUE,
|
||||
GAME_ARG_ROTATE_Y_VALUE,
|
||||
GAME_ARG_SCREENSHOT_FORMAT,
|
||||
GAME_ARG_VERBOSE,
|
||||
};
|
||||
|
||||
bool hasCommandArgument(int argc, wxChar** argv,const string argName,
|
||||
|
@ -197,9 +199,9 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
|||
printf("\n \t\t of the optional settings:");
|
||||
printf("\n \t\ttransparent, enable_grid, enable_wireframe,");
|
||||
printf("\n \t\tenable_normals, disable_grid, disable_wireframe,");
|
||||
printf("\n \t\tdisable_normals, saveas-<filename>");
|
||||
printf("\n \t\tdisable_normals, saveas-<filename>, resize-wxh");
|
||||
printf("\n \t\texample:");
|
||||
printf("\n %s %s=transparent,disable_grid,saveas-test.png %s=techs/megapack/factions/tech/units/battle_machine/models/battle_machine_dying.g3d",extractFileFromDirectoryPath(argv0).c_str(),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT]),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]));
|
||||
printf("\n %s %s=transparent,disable_grid,saveas-test.png,resize-800x600 %s=techs/megapack/factions/tech/units/battle_machine/models/battle_machine_dying.g3d",extractFileFromDirectoryPath(argv0).c_str(),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT]),(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_MODEL]));
|
||||
|
||||
// "================================================================================"
|
||||
printf("\n%s=x",(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_LOAD_PARTICLE]));
|
||||
|
@ -258,6 +260,7 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
|||
|
||||
bool autoScreenShotAndExit = false;
|
||||
vector<string> autoScreenShotParams;
|
||||
std::pair<int,int> overrideSize(0,0);
|
||||
|
||||
// ===============================================
|
||||
// class MainWindow
|
||||
|
@ -291,6 +294,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
|
|||
//getGlPlatformExtensions();
|
||||
|
||||
int args[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_MIN_ALPHA, 8 }; // to prevent flicker
|
||||
//int args[] = { WX_GL_RGBA, WX_GL_MIN_ALPHA, 0 }; // to prevent flicker
|
||||
glCanvas = new GlCanvas(this, args);
|
||||
|
||||
#if wxCHECK_VERSION(2, 9, 1)
|
||||
|
@ -567,31 +571,25 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
setupStartupSettings();
|
||||
}
|
||||
|
||||
//wxClientDC &dc = event.GetDC();
|
||||
// wxPaintDC dc(this);
|
||||
// if(overrideSize.first > 0 && overrideSize.second > 0) {
|
||||
// wxRect r(0,0,100,100);
|
||||
// dc.SetDeviceClippingRegion(r);
|
||||
// // Then I destroy the clipping region
|
||||
// dc.DestroyClippingRegion();
|
||||
// }
|
||||
|
||||
// notice that we use GetSize() here and not GetClientSize() because
|
||||
// the latter doesn't return correct results for the minimized windows
|
||||
// (at least not under Windows)
|
||||
#if defined(WIN32)
|
||||
/*
|
||||
//Seems like windows cannot handle this consistently
|
||||
int viewportW = GetClientSize().x;
|
||||
int viewportH = GetClientSize().y;
|
||||
|
||||
if(autoScreenShotAndExit == true) {
|
||||
printf("\n\n$$$ GetSize() x = %d y = %d, Renderer::windowW = %d H = %d\n",GetSize().x,GetSize().y,Renderer::windowW,Renderer::windowH);
|
||||
//renderer->reset(GetSize().x, GetSize().y-10, playerColor);
|
||||
//renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor);
|
||||
//this->Iconize(false);
|
||||
|
||||
//this->Refresh();
|
||||
//renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
||||
renderer->reset(Renderer::windowW, Renderer::windowH-20, playerColor);
|
||||
}
|
||||
else {
|
||||
printf("\n\n### GetClientSize() x = %d y = %d\n",GetClientSize().x,GetClientSize().y);
|
||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
||||
}
|
||||
*/
|
||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
||||
#if defined(WIN32)
|
||||
renderer->reset(viewportW, viewportH, playerColor);
|
||||
#else
|
||||
renderer->reset(GetClientSize().x, GetClientSize().y, playerColor);
|
||||
renderer->reset(viewportW, viewportH, playerColor);
|
||||
#endif
|
||||
|
||||
renderer->transform(rotX, rotY, zoom);
|
||||
|
@ -616,8 +614,7 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
}
|
||||
|
||||
renderer->renderParticleManager();
|
||||
glCanvas->SwapBuffers();
|
||||
|
||||
|
||||
bool haveLoadedParticles = (particleProjectilePathList.empty() == false || particleSplashPathList.empty() == false);
|
||||
|
||||
if(autoScreenShotAndExit == true) {
|
||||
|
@ -629,7 +626,10 @@ void MainWindow::onPaint(wxPaintEvent &event) {
|
|||
Close();
|
||||
return;
|
||||
}
|
||||
else if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) {
|
||||
|
||||
glCanvas->SwapBuffers();
|
||||
|
||||
if((modelPathList.empty() == false) && resetAnimation && haveLoadedParticles) {
|
||||
if(anim >= resetAnim && resetAnim > 0) {
|
||||
printf("RESETTING EVERYTHING [%f][%f]...\n",anim,resetAnim);
|
||||
fflush(stdout);
|
||||
|
@ -963,7 +963,7 @@ void MainWindow::saveScreenshot() {
|
|||
FILE *f= fopen(saveAsFilename.c_str(), "rb");
|
||||
#endif
|
||||
if(f == NULL) {
|
||||
renderer->saveScreen(saveAsFilename.c_str());
|
||||
renderer->saveScreen(saveAsFilename.c_str(),&overrideSize);
|
||||
}
|
||||
else {
|
||||
if(f) {
|
||||
|
@ -998,7 +998,7 @@ void MainWindow::saveScreenshot() {
|
|||
FILE *f= fopen(path.c_str(), "rb");
|
||||
#endif
|
||||
if(f == NULL) {
|
||||
renderer->saveScreen(path);
|
||||
renderer->saveScreen(path,&overrideSize);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
|
@ -1095,10 +1095,11 @@ void MainWindow::loadUnit(string path, string skillName) {
|
|||
string skillParticleFile = "";
|
||||
string skillParticleProjectileFile = "";
|
||||
string skillParticleSplashFile = "";
|
||||
bool fileFound = fileExists(unitXML);
|
||||
|
||||
printf("Loading unit from file [%s]\n",unitXML.c_str());
|
||||
printf("Loading unit from file [%s] fileFound = %d\n",unitXML.c_str(),fileFound);
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
if(fileFound == true) {
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||
|
@ -1270,15 +1271,19 @@ void MainWindow::loadParticle(string path) {
|
|||
//int height = -1;
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
|
||||
int size = 0;
|
||||
int height= 0;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||
const XmlNode *parametersNode= unitNode->getChild("parameters");
|
||||
//size
|
||||
int size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||
size= parametersNode->getChild("size")->getAttribute("value")->getIntValue();
|
||||
//height
|
||||
int height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
|
||||
height= parametersNode->getChild("height")->getAttribute("value")->getIntValue();
|
||||
}
|
||||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
|
@ -1323,6 +1328,8 @@ void MainWindow::loadParticle(string path) {
|
|||
}
|
||||
|
||||
void MainWindow::loadProjectileParticle(string path) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleProjectilePathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleProjectilePathList.size());
|
||||
|
||||
if(timer) timer->Stop();
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
|
@ -1342,7 +1349,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
|
||||
try {
|
||||
if(this->particleProjectilePathList.empty() == false) {
|
||||
printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("this->particleProjectilePathList.size() = %lu\n",this->particleProjectilePathList.size());
|
||||
|
||||
string titlestring=winHeader;
|
||||
for(unsigned int idx = 0; idx < this->particleProjectilePathList.size(); idx++) {
|
||||
|
@ -1363,6 +1370,8 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
int height = -1;
|
||||
|
||||
if(fileExists(unitXML) == true) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitXML.c_str(),idx);
|
||||
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(unitXML,Properties::getTagReplacementValues());
|
||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||
|
@ -1375,18 +1384,21 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
string particleFile = dir + folderDelimiter + particlePath;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(particleFile,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loading [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
|
||||
projectileParticleSystemType->load(NULL, dir, //### we don't know if there are overrides in the unit XML
|
||||
dir + folderDelimiter + particlePath,renderer, loadedFileList,
|
||||
particleFile,renderer, loadedFileList,
|
||||
"g3dviewer","");
|
||||
|
||||
// std::cout << "Values loaded, about to read..." << std::endl;
|
||||
|
@ -1412,6 +1424,8 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
ps->setVisible(true);
|
||||
renderer->manageParticleSystem(ps);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] loaded [%s] idx = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,particleFile.c_str(),idx);
|
||||
}
|
||||
SetTitle(ToUnicode(titlestring));
|
||||
|
||||
|
@ -1428,9 +1442,12 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
if(timer) timer->Start(100);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str());
|
||||
}
|
||||
|
||||
void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSplash::load (and own list...)
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size());
|
||||
|
||||
if(timer) timer->Stop();
|
||||
if(path != "" && fileExists(path) == true) {
|
||||
renderer->end();
|
||||
|
@ -1481,11 +1498,12 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||
|
||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
{
|
||||
XmlTree xmlTree;
|
||||
xmlTree.load(dir + folderDelimiter + particlePath,Properties::getTagReplacementValues());
|
||||
//const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||
}
|
||||
|
||||
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||
ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash();
|
||||
|
@ -1531,6 +1549,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||
wxMessageDialog(NULL, ToUnicode(e.what()), ToUnicode("Not a Mega-Glest projectile particle XML file, or broken"), wxOK | wxICON_ERROR).ShowModal();
|
||||
}
|
||||
if(timer) timer->Start(100);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] after load [%s] particleSplashPathList.size() = %lu\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),this->particleSplashPathList.size());
|
||||
}
|
||||
|
||||
void MainWindow::onMenuModeNormals(wxCommandEvent &event){
|
||||
|
@ -1980,6 +1999,10 @@ END_EVENT_TABLE()
|
|||
|
||||
bool App::OnInit() {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = false;
|
||||
//Renderer::windowW = 1920;
|
||||
//Renderer::windowH = 1440;
|
||||
//Renderer::windowX= 0;
|
||||
//Renderer::windowY= 0;
|
||||
|
||||
string modelPath="";
|
||||
string particlePath="";
|
||||
|
@ -2005,6 +2028,10 @@ bool App::OnInit() {
|
|||
return false;
|
||||
}
|
||||
|
||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_VERBOSE])) == true) {
|
||||
SystemFlags::VERBOSE_MODE_ENABLED = true;
|
||||
}
|
||||
|
||||
if(hasCommandArgument(argc, argv,(const char *)wxConvCurrent->cWX2MB(GAME_ARGS[GAME_ARG_AUTO_SCREENSHOT])) == true) {
|
||||
autoScreenShotAndExit = true;
|
||||
|
||||
|
@ -2026,13 +2053,29 @@ bool App::OnInit() {
|
|||
autoScreenShotParams.clear();
|
||||
Tokenize(optionsValue,autoScreenShotParams,",");
|
||||
|
||||
#ifdef WIN32
|
||||
for(unsigned int i = 0; i < autoScreenShotParams.size(); ++i) {
|
||||
|
||||
#ifdef WIN32
|
||||
std::auto_ptr<wchar_t> wstr(Ansi2WideString(autoScreenShotParams[i].c_str()));
|
||||
autoScreenShotParams[i] = utf8_encode(wstr.get());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(_strnicmp(autoScreenShotParams[i].c_str(),"resize-",7) == 0) {
|
||||
printf("Screenshot option [%s]\n",autoScreenShotParams[i].c_str());
|
||||
|
||||
string resize = autoScreenShotParams[i];
|
||||
resize = resize.erase(0,7);
|
||||
vector<string> values;
|
||||
Tokenize(resize,values,"x");
|
||||
overrideSize.first = strToInt(values[0]);
|
||||
overrideSize.second = strToInt(values[1]);
|
||||
|
||||
Renderer::windowX= 0;
|
||||
Renderer::windowY= 0;
|
||||
Renderer::windowW = overrideSize.first;
|
||||
Renderer::windowH = overrideSize.second + 25;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,11 @@ using namespace Shared::Graphics::Gl;
|
|||
|
||||
namespace Shared{ namespace G3dViewer{
|
||||
|
||||
int Renderer::windowX= 100;
|
||||
int Renderer::windowY= 100;
|
||||
int Renderer::windowW= 640;
|
||||
int Renderer::windowH= 480;
|
||||
|
||||
// ===============================================
|
||||
// class MeshCallbackTeamColor
|
||||
// ===============================================
|
||||
|
@ -483,16 +488,21 @@ void Renderer::setAlphaColor(float alpha) {
|
|||
//printf("#3.1 The framebuffer uses %d bit(s) per the alpha component\n", alpha_bits);
|
||||
}
|
||||
|
||||
void Renderer::saveScreen(const string &path) {
|
||||
void Renderer::saveScreen(const string &path,std::pair<int,int> *overrideSize) {
|
||||
Pixmap2D *pixmapScreenShot = new Pixmap2D(width, height, 4);
|
||||
glFinish();
|
||||
//glFinish();
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels());
|
||||
glReadPixels(0, 0, pixmapScreenShot->getW(), pixmapScreenShot->getH(),
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, pixmapScreenShot->getPixels());
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
//if(overrideSize != NULL && overrideSize->first > 0 && overrideSize->second > 0) {
|
||||
// pixmapScreenShot->Scale(GL_RGBA,overrideSize->first,overrideSize->second);
|
||||
//}
|
||||
|
||||
pixmapScreenShot->save(path);
|
||||
delete pixmapScreenShot;
|
||||
}
|
||||
|
|
|
@ -68,10 +68,10 @@ public:
|
|||
|
||||
class Renderer : public RendererInterface {
|
||||
public:
|
||||
static const int windowX= 100;
|
||||
static const int windowY= 100;
|
||||
static const int windowW= 640;
|
||||
static const int windowH= 480;
|
||||
static int windowX;
|
||||
static int windowY;
|
||||
static int windowW;
|
||||
static int windowH;
|
||||
|
||||
public:
|
||||
enum PlayerColor{
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
|
||||
void setBackgroundColor(float red, float green, float blue);
|
||||
void setAlphaColor(float alpha);
|
||||
void saveScreen(const string &path);
|
||||
void saveScreen(const string &path,std::pair<int,int> *overrideSize);
|
||||
bool hasActiveParticleSystem(ParticleSystem::ParticleSystemType typeName) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ using namespace Shared::Platform;
|
|||
namespace Glest { namespace Game {
|
||||
|
||||
const char *mailString = " http://bugs.megaglest.org";
|
||||
const string glestVersionString = "v3.6.0.2";
|
||||
const string glestVersionString = "v3.6.0.3";
|
||||
#if defined(SVNVERSION)
|
||||
const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
|
||||
#elif defined(SVNVERSIONHEADER)
|
||||
|
|
|
@ -147,7 +147,7 @@ Config::Config(std::pair<ConfigType,ConfigType> type, std::pair<string,string> f
|
|||
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
if(foundPath == false) {
|
||||
foundPath = tryCustomPath(cfgType, fileName, CUSTOM_DATA_INSTALL_PATH);
|
||||
foundPath = tryCustomPath(cfgType, fileName, TOSTRING(CUSTOM_DATA_INSTALL_PATH));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -350,7 +350,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
displayFont= renderer.newFont(rsGlobal);
|
||||
if(displayFont) {
|
||||
displayFont->setType(displayFontName,config.getString("FontDisplay",""));
|
||||
displayFont->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
|
||||
displayFont->setSize(displayFontSize);
|
||||
//displayFont->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
displayFont3D= renderer.newFont3D(rsGlobal);
|
||||
if(displayFont3D) {
|
||||
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""));
|
||||
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
|
||||
displayFont3D->setSize(displayFontSize);
|
||||
//displayFont3D->setYOffsetFactor(config.getFloat("FontDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
displayFontSmall= renderer.newFont(rsGlobal);
|
||||
if(displayFontSmall) {
|
||||
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
||||
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
|
||||
displayFontSmall->setSize(displayFontNameSmallSize);
|
||||
//displayFontSmall->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
displayFontSmall3D= renderer.newFont3D(rsGlobal);
|
||||
if(displayFontSmall3D) {
|
||||
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""));
|
||||
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
|
||||
displayFontSmall3D->setSize(displayFontNameSmallSize);
|
||||
//displayFontSmall3D->setYOffsetFactor(config.getFloat("FontSmallDisplayYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontNormal= renderer.newFont(rsGlobal);
|
||||
if(menuFontNormal) {
|
||||
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
||||
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
|
||||
menuFontNormal->setSize(menuFontNameNormalSize);
|
||||
menuFontNormal->setWidth(Font::wBold);
|
||||
//menuFontNormal->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
|
@ -453,7 +453,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontNormal3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontNormal3D) {
|
||||
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""));
|
||||
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
|
||||
menuFontNormal3D->setSize(menuFontNameNormalSize);
|
||||
menuFontNormal3D->setWidth(Font::wBold);
|
||||
//menuFontNormal3D->setYOffsetFactor(config.getFloat("FontMenuNormalYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
|
@ -485,7 +485,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontBig= renderer.newFont(rsGlobal);
|
||||
if(menuFontBig) {
|
||||
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
||||
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
|
||||
menuFontBig->setSize(menuFontNameBigSize);
|
||||
//menuFontBig->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontBig3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontBig3D) {
|
||||
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""));
|
||||
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
|
||||
menuFontBig3D->setSize(menuFontNameBigSize);
|
||||
//menuFontBig3D->setYOffsetFactor(config.getFloat("FontMenuBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -529,7 +529,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
menuFontVeryBig= renderer.newFont(rsGlobal);
|
||||
if(menuFontVeryBig) {
|
||||
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
||||
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
|
||||
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
|
||||
//menuFontVeryBig->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
|
||||
if(menuFontVeryBig3D) {
|
||||
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""));
|
||||
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
|
||||
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
|
||||
//menuFontVeryBig3D->setYOffsetFactor(config.getFloat("FontMenuVeryBigYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -576,7 +576,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == false) {
|
||||
consoleFont= renderer.newFont(rsGlobal);
|
||||
if(consoleFont) {
|
||||
consoleFont->setType(consoleFontName,config.getString("FontConsole",""));
|
||||
consoleFont->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
|
||||
consoleFont->setSize(consoleFontNameSize);
|
||||
//consoleFont->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ void CoreData::loadFonts() {
|
|||
if(Renderer::renderText3DEnabled == true) {
|
||||
consoleFont3D= renderer.newFont3D(rsGlobal);
|
||||
if(consoleFont3D) {
|
||||
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""));
|
||||
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
|
||||
consoleFont3D->setSize(consoleFontNameSize);
|
||||
//consoleFont3D->setYOffsetFactor(config.getFloat("FontConsoleYOffsetFactor",floatToStr(FontMetrics::DEFAULT_Y_OFFSET_FACTOR).c_str()));
|
||||
}
|
||||
|
|
|
@ -107,6 +107,15 @@ void Lang::loadStrings(string uselanguage, bool loadFonts,
|
|||
#endif
|
||||
}
|
||||
|
||||
if( lang.hasString("MEGAGLEST_FONT_FAMILY")) {
|
||||
#if defined(WIN32)
|
||||
string newEnvValue = "MEGAGLEST_FONT_FAMILY=" + lang.get("MEGAGLEST_FONT_FAMILY");
|
||||
_putenv(newEnvValue.c_str());
|
||||
#else
|
||||
setenv("MEGAGLEST_FONT_FAMILY",lang.get("MEGAGLEST_FONT_FAMILY").c_str(),0);
|
||||
#endif
|
||||
}
|
||||
|
||||
// if( lang.hasString("FONT_YOFFSET_FACTOR")) {
|
||||
// FontMetrics::DEFAULT_Y_OFFSET_FACTOR = strToFloat(lang.get("FONT_YOFFSET_FACTOR"));
|
||||
// }
|
||||
|
|
|
@ -43,7 +43,8 @@ ParticleSystemType::ParticleSystemType() {
|
|||
|
||||
teamcolorNoEnergy=false;
|
||||
teamcolorEnergy=false;
|
||||
alternations=false;
|
||||
alternations=0;
|
||||
particleSystemStartDelay=0;
|
||||
texture=NULL;
|
||||
model=NULL;
|
||||
minmaxEnabled=false;
|
||||
|
@ -101,6 +102,7 @@ void ParticleSystemType::copyAll(const ParticleSystemType &src) {
|
|||
this->teamcolorNoEnergy = src.teamcolorNoEnergy;
|
||||
this->teamcolorEnergy = src.teamcolorEnergy;
|
||||
this->alternations = src.alternations;
|
||||
this->particleSystemStartDelay= src.particleSystemStartDelay;
|
||||
for(Children::iterator it = children.begin(); it != children.end(); ++it) {
|
||||
UnitParticleSystemType *child = *it;
|
||||
|
||||
|
@ -239,6 +241,11 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
|||
const XmlNode *alternatingNode= particleSystemNode->getChild("alternations");
|
||||
alternations= alternatingNode->getAttribute("value")->getIntValue();
|
||||
}
|
||||
//particleSystemStartDelay
|
||||
if(particleSystemNode->hasChild("particleSystemStartDelay")){
|
||||
const XmlNode *node= particleSystemNode->getChild("particleSystemStartDelay");
|
||||
particleSystemStartDelay= node->getAttribute("value")->getIntValue();
|
||||
}
|
||||
//mode
|
||||
if(particleSystemNode->hasChild("mode")) {
|
||||
const XmlNode *modeNode= particleSystemNode->getChild("mode");
|
||||
|
@ -293,6 +300,7 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
|
|||
ats->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||
ats->setTeamcolorEnergy(teamcolorEnergy);
|
||||
ats->setAlternations(alternations);
|
||||
ats->setParticleSystemStartDelay(particleSystemStartDelay);
|
||||
ats->setBlendMode(ParticleSystem::strToBlendMode(mode));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ protected:
|
|||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
int alternations;
|
||||
int particleSystemStartDelay;
|
||||
typedef std::list<UnitParticleSystemType*> Children;
|
||||
Children children;
|
||||
|
||||
|
|
|
@ -839,7 +839,7 @@ void Renderer::setupLighting() {
|
|||
assertGl();
|
||||
|
||||
//sun/moon light
|
||||
Vec3f lightColor= computeLightColor(time);
|
||||
Vec3f lightColor= timeFlow->computeLightColor();
|
||||
Vec3f fogColor= world->getTileset()->getFogColor();
|
||||
Vec4f lightPos= timeFlow->isDay()? computeSunPos(time): computeMoonPos(time);
|
||||
nearestLightPos= lightPos;
|
||||
|
@ -3260,7 +3260,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
|
|||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOVertices ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, vertices, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
assertGl();
|
||||
// Generate And Bind The Texture Coordinate Buffer
|
||||
|
@ -3268,7 +3268,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
|
|||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOFowTexCoords ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoords, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
assertGl();
|
||||
// Generate And Bind The Texture Coordinate Buffer
|
||||
|
@ -3276,7 +3276,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
|
|||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBOSurfaceTexCoords ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f) * cellData->bufferCount, texCoordsSurface, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
assertGl();
|
||||
// Generate And Bind The Normal Buffer
|
||||
|
@ -3284,7 +3284,7 @@ VisibleQuadContainerVBOCache * Renderer::GetSurfaceVBOs(SurfaceData *cellData) {
|
|||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, vboCache.m_nVBONormals ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f) * cellData->bufferCount, normals, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
vboCache.hasBuiltVBOs = true;
|
||||
|
||||
|
@ -3333,7 +3333,7 @@ template<typename T> void _loadVBO(GLuint &vbo,std::vector<T> buf,int target=GL_
|
|||
assert(vbo);
|
||||
glBindBufferARB(target,vbo);
|
||||
glBufferDataARB(target,sizeof(T)*buf.size(),&buf[0],GL_STATIC_DRAW_ARB);
|
||||
glBindBuffer(target,0);
|
||||
glBindBufferARB(target,0);
|
||||
assertGl();
|
||||
buf.clear();
|
||||
}
|
||||
|
@ -4183,7 +4183,7 @@ void Renderer::renderObjects(const int renderFps) {
|
|||
|
||||
const Texture2D *fowTex = world->getMinimap()->getFowTexture();
|
||||
const Pixmap2D *fowTexPixmap = fowTex->getPixmapConst();
|
||||
Vec3f baseFogColor = world->getTileset()->getFogColor() * computeLightColor(world->getTimeFlow()->getTime());
|
||||
Vec3f baseFogColor = world->getTileset()->getFogColor() * world->getTimeFlow()->computeLightColor();
|
||||
|
||||
bool modelRenderStarted = false;
|
||||
|
||||
|
@ -6395,7 +6395,7 @@ void Renderer::saveScreen(const string &path) {
|
|||
Pixmap2D *pixmapScreenShot = new Pixmap2D(sm.getScreenW(), sm.getScreenH(), 3);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
glFinish();
|
||||
//glFinish();
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
|
||||
|
@ -6461,35 +6461,6 @@ Vec4f Renderer::computeMoonPos(float time) {
|
|||
#endif
|
||||
}
|
||||
|
||||
Vec3f Renderer::computeLightColor(float time) {
|
||||
const Tileset *tileset= game->getWorld()->getTileset();
|
||||
Vec3f color;
|
||||
|
||||
const float transition= 2;
|
||||
const float dayStart= TimeFlow::dawn;
|
||||
const float dayEnd= TimeFlow::dusk-transition;
|
||||
const float nightStart= TimeFlow::dusk;
|
||||
const float nightEnd= TimeFlow::dawn-transition;
|
||||
|
||||
if(time>dayStart && time<dayEnd) {
|
||||
color= tileset->getSunLightColor();
|
||||
}
|
||||
else if(time>nightStart || time<nightEnd) {
|
||||
color= tileset->getMoonLightColor();
|
||||
}
|
||||
else if(time>=dayEnd && time<=nightStart) {
|
||||
color= tileset->getSunLightColor().lerp((time-dayEnd)/transition, tileset->getMoonLightColor());
|
||||
}
|
||||
else if(time>=nightEnd && time<=dayStart) {
|
||||
color= tileset->getMoonLightColor().lerp((time-nightEnd)/transition, tileset->getSunLightColor());
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
color= tileset->getSunLightColor();
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
Vec4f Renderer::computeWaterColor(float waterLevel, float cellHeight) {
|
||||
const float waterFactor= 1.5f;
|
||||
return Vec4f(1.f, 1.f, 1.f, clamp((waterLevel-cellHeight)*waterFactor, 0.f, 1.f));
|
||||
|
|
|
@ -581,7 +581,6 @@ private:
|
|||
float computeMoonAngle(float time);
|
||||
Vec4f computeSunPos(float time);
|
||||
Vec4f computeMoonPos(float time);
|
||||
Vec3f computeLightColor(float time);
|
||||
Vec4f computeWaterColor(float waterLevel, float cellHeight);
|
||||
void checkExtension(const string &extension, const string &msg);
|
||||
|
||||
|
|
|
@ -40,8 +40,9 @@ UnitParticleSystemType::UnitParticleSystemType() : ParticleSystemType() {
|
|||
relativeDirection = false;
|
||||
fixed = false;
|
||||
staticParticleCount = 0;
|
||||
isVisibleAtNight = false;
|
||||
isVisibleAtDay = false;
|
||||
isVisibleAtNight = true;
|
||||
isVisibleAtDay = true;
|
||||
isDaylightAffected = false;
|
||||
radiusBasedStartenergy = false;
|
||||
delay = 0;
|
||||
lifetime = 0;
|
||||
|
@ -146,6 +147,15 @@ void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const strin
|
|||
isVisibleAtDay=true;
|
||||
}
|
||||
|
||||
//isDaylightAffected
|
||||
if(particleSystemNode->hasChild("isDaylightAffected")){
|
||||
const XmlNode *node= particleSystemNode->getChild("isDaylightAffected");
|
||||
isDaylightAffected= node->getAttribute("value")->getBoolValue();
|
||||
}
|
||||
else {
|
||||
isDaylightAffected=false;
|
||||
}
|
||||
|
||||
//radiusBasedStartenergy
|
||||
if(particleSystemNode->hasChild("radiusBasedStartenergy")){
|
||||
const XmlNode *isVisibleAtDayNode= particleSystemNode->getChild("radiusBasedStartenergy");
|
||||
|
@ -217,9 +227,11 @@ const void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
|
|||
ups->setTeamcolorNoEnergy(teamcolorNoEnergy);
|
||||
ups->setTeamcolorEnergy(teamcolorEnergy);
|
||||
ups->setAlternations(alternations);
|
||||
ups->setParticleSystemStartDelay(particleSystemStartDelay);
|
||||
|
||||
ups->setIsVisibleAtNight(isVisibleAtNight);
|
||||
ups->setIsVisibleAtDay(isVisibleAtDay);
|
||||
ups->setIsDaylightAffected(isDaylightAffected);
|
||||
ups->setStaticParticleCount(staticParticleCount);
|
||||
ups->setRadius(radius);
|
||||
ups->setMinRadius(minRadius);
|
||||
|
|
|
@ -58,6 +58,7 @@ protected:
|
|||
int staticParticleCount;
|
||||
bool isVisibleAtNight;
|
||||
bool isVisibleAtDay;
|
||||
bool isDaylightAffected;
|
||||
bool radiusBasedStartenergy;
|
||||
int delay;
|
||||
int lifetime;
|
||||
|
|
|
@ -237,7 +237,7 @@ void BattleEnd::render() {
|
|||
}
|
||||
|
||||
realPlayerCount++;
|
||||
int textX= lm + 60 + (realPlayerCount*110);
|
||||
int textX= lm + 60 + (realPlayerCount*100);
|
||||
int team= stats.getTeam(i) + 1;
|
||||
int kills= stats.getKills(i);
|
||||
int enemykills= stats.getEnemyKills(i);
|
||||
|
@ -292,7 +292,7 @@ void BattleEnd::render() {
|
|||
}
|
||||
|
||||
if(stats.getControl(i) != ctHuman && stats.getControl(i) != ctNetwork ) {
|
||||
controlString += " x " + floatToStr(stats.getResourceMultiplier(i),1);
|
||||
controlString += "\nx " + floatToStr(stats.getResourceMultiplier(i),1);
|
||||
}
|
||||
|
||||
if(score == bestScore && stats.getVictory(i)) {
|
||||
|
@ -408,7 +408,7 @@ void BattleEnd::render() {
|
|||
//GameConstants::updateFps
|
||||
//string header2 = lang.get("GameDuration") + " " + floatToStr(stats.getWorldTimeElapsed() / 24.0,2);
|
||||
|
||||
string header2 = lang.get("GameDuration") + ": " + intToStr(stats.getFramesToCalculatePlaytime()/GameConstants::updateFps/60);
|
||||
string header2 = lang.get("GameDuration") + ": " + floatToStr((float)stats.getFramesToCalculatePlaytime() / (float)GameConstants::updateFps / 60.0,2);
|
||||
textRenderer->render(header2, lm+250, bm+530);
|
||||
|
||||
header2 = lang.get("GameMaxConcurrentUnitCount") + ": " + intToStr(stats.getMaxConcurrentUnitCount());
|
||||
|
|
|
@ -2459,7 +2459,7 @@ int glestMain(int argc, char** argv) {
|
|||
|
||||
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",CUSTOM_DATA_INSTALL_PATH);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("\n\nCUSTOM_DATA_INSTALL_PATH = [%s]\n\n",TOSTRING(CUSTOM_DATA_INSTALL_PATH));
|
||||
#endif
|
||||
|
||||
const int knownArgCount = sizeof(GAME_ARGS) / sizeof(GAME_ARGS[0]);
|
||||
|
@ -3543,6 +3543,10 @@ int glestMain(int argc, char** argv) {
|
|||
cinfd[0].events = POLLIN;
|
||||
#else
|
||||
h = GetStdHandle(STD_INPUT_HANDLE);
|
||||
//DWORD dwMode;
|
||||
//GetConsoleMode(h, &dwMode);
|
||||
//SetConsoleMode(h, dwMode & ~ENABLE_MOUSE_INPUT);
|
||||
FlushConsoleInputBuffer(h);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -3568,36 +3572,72 @@ int glestMain(int argc, char** argv) {
|
|||
// line buffer input. This does work okay as long as the user doesn't enter characters
|
||||
// without pressing enter, and then try to end the server another way (say a remote
|
||||
// console command), in which case we'll still be waiting for the stdin EOL and hang.
|
||||
if (WaitForSingleObject(h, 0) == WAIT_OBJECT_0)
|
||||
|
||||
DWORD saveMode;
|
||||
GetConsoleMode(h, &saveMode);
|
||||
DWORD dwMode = saveMode;
|
||||
dwMode &= ~ENABLE_MOUSE_INPUT;
|
||||
dwMode &= ~ENABLE_WINDOW_INPUT;
|
||||
SetConsoleMode(h, dwMode);
|
||||
|
||||
bool gotData = (WaitForSingleObject(h, 0) == WAIT_OBJECT_0);
|
||||
SetConsoleMode(h, saveMode);
|
||||
if(gotData == true)
|
||||
#endif
|
||||
{
|
||||
|
||||
getline(cin, command);
|
||||
cin.clear();
|
||||
|
||||
printf("server command [%s]\n",command.c_str());
|
||||
if(command == "quit") {
|
||||
break;
|
||||
bool skip = true;
|
||||
#ifdef WIN32
|
||||
DWORD nNumberOfCharsToRead = 1024;
|
||||
DWORD nRead = 0;
|
||||
INPUT_RECORD irInRec[1025];
|
||||
|
||||
PeekConsoleInput(h,&irInRec[0],nNumberOfCharsToRead,&nRead);
|
||||
for(int i = 0; i < nRead; ++i) {
|
||||
INPUT_RECORD &inr = irInRec[i];
|
||||
|
||||
//printf("inr.EventType = %d\n",inr.EventType);
|
||||
if(inr.EventType == KEY_EVENT) {
|
||||
if(inr.Event.KeyEvent.bKeyDown) {
|
||||
char cHoldKey = inr.Event.KeyEvent.uChar.AsciiChar;
|
||||
if(cHoldKey == '\r') {
|
||||
skip = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
skip = false;
|
||||
#endif
|
||||
if(skip == false) {
|
||||
getline(cin, command);
|
||||
cin.clear();
|
||||
|
||||
printf("server command [%s]\n",command.c_str());
|
||||
if(command == "quit") {
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
if (cinfd[0].revents & POLLNVAL) {
|
||||
printf("invalid file descriptor\n");
|
||||
}
|
||||
if (cinfd[0].revents & POLLERR) {
|
||||
printf("error in file descriptor\n");
|
||||
}
|
||||
if (cinfd[0].revents & POLLHUP) {
|
||||
printf("hang up in file descriptor\n");
|
||||
}
|
||||
if (cinfd[0].revents & POLLNVAL) {
|
||||
printf("invalid file descriptor\n");
|
||||
}
|
||||
if (cinfd[0].revents & POLLERR) {
|
||||
printf("error in file descriptor\n");
|
||||
}
|
||||
if (cinfd[0].revents & POLLHUP) {
|
||||
printf("hang up in file descriptor\n");
|
||||
}
|
||||
|
||||
if(pollresult < 0) {
|
||||
printf("pollresult = %d errno = %d [%s]\n",pollresult,pollerror,strerror(pollerror));
|
||||
if(pollresult < 0) {
|
||||
printf("pollresult = %d errno = %d [%s]\n",pollresult,pollerror,strerror(pollerror));
|
||||
|
||||
cinfd[0].fd = fileno(stdin);
|
||||
cinfd[0].events = POLLIN;
|
||||
}
|
||||
cinfd[0].fd = fileno(stdin);
|
||||
cinfd[0].events = POLLIN;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
//printf("looping\n");
|
||||
|
|
|
@ -385,9 +385,9 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] about to accept new client connection playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||
|
||||
Socket *newSocket = serverInterface->getServerSocket()->accept();
|
||||
Socket *newSocket = serverInterface->getServerSocket()->accept(false);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] called accept new client connection playerIndex = %d\n",__FILE__,__FUNCTION__,__LINE__,playerIndex);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] called accept new client connection playerIndex = %d newSocket = %p\n",__FILE__,__FUNCTION__,__LINE__,playerIndex,newSocket);
|
||||
if(newSocket != NULL) {
|
||||
// Set Socket as non-blocking
|
||||
newSocket->setBlock(false);
|
||||
|
@ -436,14 +436,19 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
}
|
||||
else {
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
}
|
||||
//}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
//send intro message when connected
|
||||
if(hasData == true && this->isConnected() == true) {
|
||||
//if(hasData == true && this->isConnected() == true) {
|
||||
if(this->isConnected() == true) {
|
||||
//RandomGen random;
|
||||
//sessionKey = random.randRange(-100000, 100000);
|
||||
srand(time(NULL) / (this->playerIndex + 1));
|
||||
|
@ -473,6 +478,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
@ -707,14 +713,14 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
throw runtime_error(szBuf);
|
||||
}
|
||||
|
||||
GameSettings gameSettings;
|
||||
networkMessageLaunch.buildGameSettings(&gameSettings);
|
||||
GameSettings gameSettingsBuffer;
|
||||
networkMessageLaunch.buildGameSettings(&gameSettingsBuffer);
|
||||
|
||||
//printf("Connection slot got networkMessageLaunch.getMessageType() = %d, got map [%s]\n",networkMessageLaunch.getMessageType(),gameSettings.getMap().c_str());
|
||||
//printf("\n\n\n\n=====Connection slot got settings:\n%s\n",gameSettings.toString().c_str());
|
||||
|
||||
this->serverInterface->setGameSettings(&gameSettings,false);
|
||||
this->serverInterface->broadcastGameSetup(&gameSettings);
|
||||
//this->serverInterface->setGameSettings(&gameSettingsBuffer,false);
|
||||
this->serverInterface->broadcastGameSetup(&gameSettingsBuffer, true);
|
||||
|
||||
if(networkMessageLaunch.getMessageType() == nmtLaunch) {
|
||||
this->serverInterface->setMasterserverAdminRequestLaunch(true);
|
||||
|
@ -1031,7 +1037,8 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
|||
}
|
||||
|
||||
void ConnectionSlot::validateConnection() {
|
||||
if(gotIntro == false && connectedTime > 0 &&
|
||||
if(this->isConnected() == true &&
|
||||
gotIntro == false && connectedTime > 0 &&
|
||||
difftime(time(NULL),connectedTime) > GameConstants::maxClientConnectHandshakeSecs) {
|
||||
close();
|
||||
}
|
||||
|
@ -1063,6 +1070,7 @@ void ConnectionSlot::close() {
|
|||
|
||||
ready = false;
|
||||
gotIntro = false;
|
||||
connectedTime = 0;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] END\n",__FILE__,__FUNCTION__);
|
||||
}
|
||||
|
|
|
@ -1708,10 +1708,17 @@ bool ServerInterface::launchGame(const GameSettings *gameSettings) {
|
|||
return bOkToStart;
|
||||
}
|
||||
|
||||
void ServerInterface::broadcastGameSetup(const GameSettings *gameSettings) {
|
||||
void ServerInterface::broadcastGameSetup(GameSettings *gameSettingsBuffer, bool setGameSettingsBuffer) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(setGameSettingsBuffer == true) {
|
||||
validateGameSettings(gameSettingsBuffer);
|
||||
//setGameSettings(gameSettingsBuffer,false);
|
||||
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);
|
||||
gameSettings = *gameSettingsBuffer;
|
||||
gameSettingsUpdateCount++;
|
||||
}
|
||||
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);
|
||||
NetworkMessageLaunch networkMessageLaunch(gameSettings, nmtBroadCastSetup);
|
||||
NetworkMessageLaunch networkMessageLaunch(gameSettingsBuffer, nmtBroadCastSetup);
|
||||
broadcastMessage(&networkMessageLaunch);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
@ -1833,17 +1840,47 @@ int ServerInterface::getOpenSlotCount() {
|
|||
}
|
||||
|
||||
int ServerInterface::getGameSettingsUpdateCount() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount);
|
||||
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount);
|
||||
|
||||
int result = gameSettingsUpdateCount;
|
||||
safeMutex.ReleaseLock();
|
||||
return result;
|
||||
}
|
||||
|
||||
void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d, waitForClientAck = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount,waitForClientAck);
|
||||
void ServerInterface::validateGameSettings(GameSettings *serverGameSettings) {
|
||||
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s]\n",__FILE__,__FUNCTION__);
|
||||
|
||||
string mapFile = serverGameSettings->getMap();
|
||||
if(find(mapFiles.begin(),mapFiles.end(),mapFile) == mapFiles.end()) {
|
||||
printf("Reverting map from [%s] to [%s]\n",serverGameSettings->getMap().c_str(),gameSettings.getMap().c_str());
|
||||
|
||||
serverGameSettings->setMapFilterIndex(gameSettings.getMapFilterIndex());
|
||||
serverGameSettings->setMap(gameSettings.getMap());
|
||||
serverGameSettings->setMapCRC(gameSettings.getMapCRC());
|
||||
}
|
||||
|
||||
string tilesetFile = serverGameSettings->getTileset();
|
||||
if(find(tilesetFiles.begin(),tilesetFiles.end(),tilesetFile) == tilesetFiles.end()) {
|
||||
printf("Reverting tileset from [%s] to [%s]\n",serverGameSettings->getTileset().c_str(),gameSettings.getTileset().c_str());
|
||||
|
||||
serverGameSettings->setTileset(gameSettings.getTileset());
|
||||
serverGameSettings->setTilesetCRC(gameSettings.getTilesetCRC());
|
||||
}
|
||||
|
||||
string techtreeFile = serverGameSettings->getTech();
|
||||
if(find(techTreeFiles.begin(),techTreeFiles.end(),techtreeFile) == techTreeFiles.end()) {
|
||||
printf("Reverting tech from [%s] to [%s]\n",serverGameSettings->getTech().c_str(),gameSettings.getTech().c_str());
|
||||
|
||||
serverGameSettings->setTech(gameSettings.getTech());
|
||||
serverGameSettings->setTechCRC(gameSettings.getTechCRC());
|
||||
}
|
||||
}
|
||||
|
||||
void ServerInterface::setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck) {
|
||||
MutexSafeWrapper safeMutex(serverSynchAccessor,CODE_AT_LINE);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] START gameSettingsUpdateCount = %d, waitForClientAck = %d\n",__FILE__,__FUNCTION__,gameSettingsUpdateCount,waitForClientAck);
|
||||
|
||||
string mapFile = serverGameSettings->getMap();
|
||||
if(find(mapFiles.begin(),mapFiles.end(),mapFile) == mapFiles.end()) {
|
||||
|
|
|
@ -124,8 +124,9 @@ public:
|
|||
int getConnectedSlotCount();
|
||||
int getOpenSlotCount();
|
||||
bool launchGame(const GameSettings *gameSettings);
|
||||
void validateGameSettings(GameSettings *serverGameSettings);
|
||||
void setGameSettings(GameSettings *serverGameSettings, bool waitForClientAck);
|
||||
void broadcastGameSetup(const GameSettings *gameSettings);
|
||||
void broadcastGameSetup(GameSettings *gameSettingsBuffer, bool setGameSettingsBuffer=false);
|
||||
|
||||
int getGameSettingsUpdateCount();
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ void TimeFlow::update() {
|
|||
soundRenderer.stopAmbient(ambientSounds->getNight());
|
||||
UnitParticleSystem::isNight=false;
|
||||
}
|
||||
UnitParticleSystem::lightColor=computeLightColor();
|
||||
|
||||
if((lastTime<dawn && time>=dawn) || firstTime){
|
||||
|
||||
|
@ -94,4 +95,35 @@ void TimeFlow::update() {
|
|||
// return (this->time>=time) && (this->time<time+timeInc);
|
||||
//}
|
||||
|
||||
Vec3f TimeFlow::computeLightColor() const {
|
||||
Vec3f color;
|
||||
|
||||
float time=getTime();
|
||||
|
||||
const float transition= 2;
|
||||
const float dayStart= TimeFlow::dawn;
|
||||
const float dayEnd= TimeFlow::dusk-transition;
|
||||
const float nightStart= TimeFlow::dusk;
|
||||
const float nightEnd= TimeFlow::dawn-transition;
|
||||
|
||||
if(time>dayStart && time<dayEnd) {
|
||||
color= tileset->getSunLightColor();
|
||||
}
|
||||
else if(time>nightStart || time<nightEnd) {
|
||||
color= tileset->getMoonLightColor();
|
||||
}
|
||||
else if(time>=dayEnd && time<=nightStart) {
|
||||
color= tileset->getSunLightColor().lerp((time-dayEnd)/transition, tileset->getMoonLightColor());
|
||||
}
|
||||
else if(time>=nightEnd && time<=dayStart) {
|
||||
color= tileset->getMoonLightColor().lerp((time-nightEnd)/transition, tileset->getSunLightColor());
|
||||
}
|
||||
else {
|
||||
assert(false);
|
||||
color= tileset->getSunLightColor();
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
}}//end namespace
|
||||
|
|
|
@ -57,6 +57,7 @@ public:
|
|||
bool isTotalNight() const {return time<dawn+1.f || time>dusk-1.f;}
|
||||
float getTimeInc() const {return timeInc;}
|
||||
|
||||
Vec3f computeLightColor() const;
|
||||
void update();
|
||||
private:
|
||||
//bool isAproxTime(float time) const;
|
||||
|
|
|
@ -17,12 +17,6 @@ IF(BUILD_MEGAGLEST_MAP_EDITOR)
|
|||
|
||||
IF(NOT WIN32)
|
||||
# It was noticed that when using MinGW gcc it is essential that 'core' is mentioned before 'base'.
|
||||
|
||||
IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
||||
SET(wxWidgets_CONFIG_OPTIONS --prefix=/usr/local)
|
||||
MESSAGE(STATUS "Detected FreeBSD.....")
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(wxWidgets COMPONENTS core base gl REQUIRED)
|
||||
|
||||
# wxWidgets include (this will do all the magic to configure everything)
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef WIN32
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <memory>
|
||||
|
||||
using namespace Shared::Util;
|
||||
using namespace Shared::PlatformCommon;
|
||||
|
|
|
@ -138,7 +138,10 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
|
||||
FIND_PACKAGE(FontConfig)
|
||||
IF(FONTCONFIG_FOUND)
|
||||
MESSAGE(STATUS "**NOTE: FontConfig support was detected and enabled.")
|
||||
SET(HAVE_FONTCONFIG 1)
|
||||
ADD_DEFINITIONS(-DHAVE_FONTCONFIG)
|
||||
|
||||
INCLUDE_DIRECTORIES( ${FONTCONFIG_INCLUDE_DIR} )
|
||||
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${FONTCONFIG_LIBRARIES} )
|
||||
ENDIF(FONTCONFIG_FOUND)
|
||||
|
@ -348,9 +351,9 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER OR BUILD_MEGAGLEST_MAP_EDITOR OR BUILD_MEGAGLEST
|
|||
ENDIF()
|
||||
|
||||
# FIXME: hackish...
|
||||
IF(WANT_STREFLOP)
|
||||
SET(STREFLOP_PROPERTIES "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32")
|
||||
ENDIF()
|
||||
# IF(WANT_STREFLOP)
|
||||
# SET(STREFLOP_PROPERTIES "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32")
|
||||
# ENDIF()
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(${MG_SOURCE_FILES} PROPERTIES COMPILE_FLAGS
|
||||
"${PLATFORM_SPECIFIC_DEFINES} ${STREFLOP_PROPERTIES} ${CXXFLAGS}")
|
||||
|
|
|
@ -101,7 +101,7 @@ public:
|
|||
string getType() const;
|
||||
|
||||
//set
|
||||
void setType(string typeX11, string typeGeneric);
|
||||
void setType(string typeX11, string typeGeneric, string typeGenericFamily);
|
||||
void setWidth(int width);
|
||||
|
||||
int getSize() const;
|
||||
|
@ -139,7 +139,7 @@ public:
|
|||
|
||||
Font3D *ConvertFont2DTo3D(Font2D *font);
|
||||
|
||||
const char* findFont(const char *firstFontToTry=NULL);
|
||||
const char* findFont(const char *firstFontToTry=NULL,const char *firstFontFamilyToTry=NULL);
|
||||
|
||||
}}//end namespace
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
Text(FontTextHandlerType type);
|
||||
virtual ~Text();
|
||||
|
||||
virtual void init(string fontName, int fontSize);
|
||||
virtual void init(string fontName, string fontFamilyName, int fontSize);
|
||||
virtual void SetFaceSize(int);
|
||||
virtual int GetFaceSize();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
|
||||
TextFTGL(FontTextHandlerType type);
|
||||
virtual ~TextFTGL();
|
||||
virtual void init(string fontName, int fontSize);
|
||||
virtual void init(string fontName, string fontFamilyName, int fontSize);
|
||||
|
||||
virtual void SetFaceSize(int);
|
||||
virtual int GetFaceSize();
|
||||
|
|
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
TextFreetypeGL(FontTextHandlerType type);
|
||||
virtual ~TextFreetypeGL();
|
||||
virtual void init(string fontName, int fontSize);
|
||||
virtual void init(string fontName, string fontFamilyName, int fontSize);
|
||||
|
||||
virtual void SetFaceSize(int);
|
||||
virtual int GetFaceSize();
|
||||
|
@ -66,6 +66,7 @@ private:
|
|||
int fontFaceSize;
|
||||
|
||||
string fontName;
|
||||
string fontFamilyName;
|
||||
const char* fontFile;
|
||||
|
||||
void cleanupFont();
|
||||
|
|
|
@ -43,10 +43,11 @@
|
|||
#endif // _WIN32
|
||||
|
||||
#include <GL/glew.h>
|
||||
#ifndef _WIN32
|
||||
//#include <boost/shared_ptr.hpp>
|
||||
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
#include <tr1/memory>
|
||||
#endif
|
||||
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
@ -61,7 +62,7 @@ using std::cout;
|
|||
using std::endl;
|
||||
using std::string;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
using std::tr1::shared_ptr;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -48,7 +48,11 @@
|
|||
#include <map>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
//#include <tr1/memory>
|
||||
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
#include <tr1/memory>
|
||||
#endif
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
#include "Mathlib.h"
|
||||
|
@ -60,7 +64,7 @@ using std::string;
|
|||
using std::vector;
|
||||
using std::map;
|
||||
|
||||
#ifdef _WIN32
|
||||
#if defined(_WIN32)
|
||||
using std::tr1::shared_ptr;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -132,6 +132,7 @@ protected:
|
|||
bool teamcolorNoEnergy;
|
||||
bool teamcolorEnergy;
|
||||
int alternations;
|
||||
int particleSystemStartDelay;
|
||||
ParticleObserver *particleObserver;
|
||||
|
||||
public:
|
||||
|
@ -173,6 +174,7 @@ public:
|
|||
void setTeamcolorNoEnergy(bool teamcolorNoEnergy) {this->teamcolorNoEnergy= teamcolorNoEnergy;}
|
||||
void setTeamcolorEnergy(bool teamcolorEnergy) {this->teamcolorEnergy= teamcolorEnergy;}
|
||||
void setAlternations(int alternations) {this->alternations= alternations;}
|
||||
void setParticleSystemStartDelay(int delay) {this->particleSystemStartDelay= delay;}
|
||||
virtual void setFactionColor(Vec3f factionColor);
|
||||
|
||||
static BlendMode strToBlendMode(const string &str);
|
||||
|
@ -269,6 +271,7 @@ protected:
|
|||
class UnitParticleSystem: public GameParticleSystem{
|
||||
public:
|
||||
static bool isNight;
|
||||
static Vec3f lightColor;
|
||||
private:
|
||||
float radius;
|
||||
float minRadius;
|
||||
|
@ -296,6 +299,7 @@ public:
|
|||
float rotation;
|
||||
bool isVisibleAtNight;
|
||||
bool isVisibleAtDay;
|
||||
bool isDaylightAffected;
|
||||
bool radiusBasedStartenergy;
|
||||
int staticParticleCount;
|
||||
int delay;
|
||||
|
@ -339,6 +343,7 @@ public:
|
|||
void setPrimitive(Primitive primitive) {this->primitive= primitive;}
|
||||
void setStaticParticleCount(int staticParticleCount){this->staticParticleCount= staticParticleCount;}
|
||||
void setIsVisibleAtNight(bool value) {this->isVisibleAtNight= value;}
|
||||
void setIsDaylightAffected(bool value) {this->isDaylightAffected= value;}
|
||||
void setIsVisibleAtDay(bool value) {this->isVisibleAtDay= value;}
|
||||
void setRadiusBasedStartenergy(bool value) {this->radiusBasedStartenergy= value;}
|
||||
void setShape(Shape shape) {this->shape= shape;}
|
||||
|
|
|
@ -253,7 +253,7 @@ public:
|
|||
virtual ~ServerSocket();
|
||||
void bind(int port);
|
||||
void listen(int connectionQueueSize= SOMAXCONN);
|
||||
Socket *accept();
|
||||
Socket *accept(bool errorOnFail=true);
|
||||
void stopBroadCastThread();
|
||||
void pauseBroadcast();
|
||||
|
||||
|
|
|
@ -388,7 +388,8 @@ int mainSetup(int argc, char **argv) {
|
|||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_VERSION])) == true ||
|
||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_SHOW_INI_SETTINGS])) == true ||
|
||||
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_MASTERSERVER_MODE])) == true) {
|
||||
if(SDL_Init(SDL_INIT_TIMER | SDL_INIT_JOYSTICK) < 0) {
|
||||
// Use this for masterserver mode for timers like Chrono
|
||||
if(SDL_Init(SDL_INIT_TIMER) < 0) {
|
||||
std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n";
|
||||
return 1;
|
||||
}
|
||||
|
@ -398,9 +399,9 @@ int mainSetup(int argc, char **argv) {
|
|||
std::cerr << "Couldn't initialize SDL: " << SDL_GetError() << "\n";
|
||||
return 1;
|
||||
}
|
||||
SDL_EnableUNICODE(1);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
}
|
||||
SDL_EnableUNICODE(1);
|
||||
SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,10 +33,9 @@ typedef unsigned int uint32;
|
|||
typedef long long int64;
|
||||
typedef unsigned long long uint64;
|
||||
|
||||
//typedef uint8 byte;
|
||||
|
||||
}}//end namespace
|
||||
|
||||
#ifndef __MINGW32__
|
||||
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
|
@ -287,3 +286,5 @@ typedef uint64_t uintmax_t;
|
|||
#endif // _MSC_STDINT_H_ ]
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
# include <string>
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __MINGW32__
|
||||
typedef unsigned char byte;
|
||||
#endif
|
||||
|
||||
//! \name Macros for Shared::Util::String
|
||||
//@{
|
||||
|
||||
|
|
|
@ -84,8 +84,11 @@ void Font::resetToDefaults() {
|
|||
#if defined(WIN32)
|
||||
string newEnvValue = "MEGAGLEST_FONT=";
|
||||
_putenv(newEnvValue.c_str());
|
||||
newEnvValue = "MEGAGLEST_FONT_FAMILY=";
|
||||
_putenv(newEnvValue.c_str());
|
||||
#else
|
||||
unsetenv("MEGAGLEST_FONT");
|
||||
unsetenv("MEGAGLEST_FONT_FAMILY");
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -212,11 +215,11 @@ string Font::getType() const {
|
|||
return this->type;
|
||||
}
|
||||
|
||||
void Font::setType(string typeX11, string typeGeneric) {
|
||||
void Font::setType(string typeX11, string typeGeneric, string typeGenericFamily) {
|
||||
if(textHandler) {
|
||||
try {
|
||||
this->type= typeGeneric;
|
||||
textHandler->init(typeGeneric,textHandler->GetFaceSize());
|
||||
textHandler->init(typeGeneric,typeGenericFamily,textHandler->GetFaceSize());
|
||||
metrics.setTextHandler(this->textHandler);
|
||||
}
|
||||
catch(exception &ex) {
|
||||
|
@ -269,54 +272,11 @@ Font3D::Font3D(FontTextHandlerType type) : Font(type) {
|
|||
depth= 10.f;
|
||||
}
|
||||
|
||||
const char* findFont(const char *firstFontToTry) {
|
||||
const char* font = NULL;
|
||||
const char* path = NULL;
|
||||
|
||||
#define CHECK_FONT_PATH(filename) \
|
||||
{ \
|
||||
path = filename; \
|
||||
if( !font && path && fileExists(path) == true ) \
|
||||
font = strdup(path); \
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Found font file [%s]\n",font); \
|
||||
}
|
||||
|
||||
string tryFont = "";
|
||||
if(firstFontToTry) {
|
||||
tryFont = firstFontToTry;
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
|
||||
CHECK_FONT_PATH(tryFont.c_str())
|
||||
}
|
||||
|
||||
// Get user-specified font path
|
||||
if(getenv("MEGAGLEST_FONT") != NULL) {
|
||||
tryFont = getenv("MEGAGLEST_FONT");
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
|
||||
CHECK_FONT_PATH(tryFont.c_str())
|
||||
}
|
||||
|
||||
string data_path = Text::DEFAULT_FONT_PATH;
|
||||
string defaultFont = data_path + "data/core/fonts/LinBiolinum_RB.ttf";//LinBiolinum_Re-0.6.4.ttf
|
||||
tryFont = defaultFont;
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
CHECK_FONT_PATH(tryFont.c_str())
|
||||
|
||||
#ifdef FONT_PATH
|
||||
// Get distro-specified font path
|
||||
CHECK_FONT_PATH(FONT_PATH)
|
||||
#endif
|
||||
|
||||
string findFontFamily(const char* font, const char *fontFamily) {
|
||||
string resultFile = "";
|
||||
#ifdef HAVE_FONTCONFIG
|
||||
// Get default font via fontconfig
|
||||
if( !font && FcInit() ) {
|
||||
if( !font && FcInit() && fontFamily) {
|
||||
FcResult result;
|
||||
FcFontSet *fs;
|
||||
FcPattern* pat;
|
||||
|
@ -327,30 +287,107 @@ const char* findFont(const char *firstFontToTry) {
|
|||
name of a font that contains all the Unicode characters in use in
|
||||
your translation.
|
||||
*/
|
||||
pat = FcNameParse((FcChar8 *)"Gothic Uralic");
|
||||
//pat = FcNameParse((FcChar8 *)"Gothic Uralic");
|
||||
pat = FcNameParse((FcChar8 *)fontFamily);
|
||||
FcConfigSubstitute(0, pat, FcMatchPattern);
|
||||
|
||||
FcPatternDel(pat, FC_WEIGHT);
|
||||
FcPatternAddInteger(pat, FC_WEIGHT, FC_WEIGHT_BOLD);
|
||||
//FcPatternDel(pat, FC_WEIGHT);
|
||||
//FcPatternAddInteger(pat, FC_WEIGHT, FC_WEIGHT_BOLD);
|
||||
|
||||
FcDefaultSubstitute(pat);
|
||||
fs = FcFontSetCreate();
|
||||
match = FcFontMatch(0, pat, &result);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Trying fontconfig for fontfamily [%s]\n",fontFamily);
|
||||
|
||||
if (match) FcFontSetAdd(fs, match);
|
||||
if (pat) FcPatternDestroy(pat);
|
||||
if(fs) {
|
||||
FcChar8* file;
|
||||
if( FcPatternGetString (fs->fonts[0], FC_FILE, 0, &file) == FcResultMatch ) {
|
||||
CHECK_FONT_PATH((const char*)file)
|
||||
//CHECK_FONT_PATH((const char*)file,NULL)
|
||||
resultFile = (const char*)file;
|
||||
}
|
||||
FcFontSetDestroy(fs);
|
||||
}
|
||||
FcFini();
|
||||
}
|
||||
#else
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("******************* NO FONT CONFIG ENABLED!\n");
|
||||
#endif
|
||||
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf")
|
||||
return resultFile;
|
||||
}
|
||||
|
||||
const char* findFont(const char *firstFontToTry,const char *firstFontFamilyToTry) {
|
||||
const char* font = NULL;
|
||||
const char* path = NULL;
|
||||
|
||||
#define CHECK_FONT_PATH(filename,fontFamily) \
|
||||
{ \
|
||||
path = filename; \
|
||||
if( !font && path && strlen(path) > 0 && fileExists(path) == true ) { \
|
||||
font = strdup(path); \
|
||||
} \
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#1 Searching for font file [%s] result [%s]\n",path,font); \
|
||||
if( !font && fontFamily && strlen(fontFamily) > 0) { \
|
||||
string fileFound = findFontFamily(font, fontFamily); \
|
||||
if(fileFound != "") { \
|
||||
path = fileFound.c_str(); \
|
||||
if( !font && path && strlen(path) > 0 && fileExists(path) == true ) { \
|
||||
font = strdup(path); \
|
||||
} \
|
||||
} \
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("#2 Searching for font family [%s] result [%s]\n",fontFamily,font); \
|
||||
} \
|
||||
}
|
||||
|
||||
string tryFont = "";
|
||||
if(firstFontToTry || firstFontFamilyToTry) {
|
||||
if(firstFontToTry && strlen(firstFontToTry) > 0) {
|
||||
tryFont = firstFontToTry;
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
|
||||
|
||||
CHECK_FONT_PATH(tryFont.c_str(),firstFontFamilyToTry)
|
||||
}
|
||||
else {
|
||||
CHECK_FONT_PATH(NULL,firstFontFamilyToTry)
|
||||
}
|
||||
}
|
||||
|
||||
// Get user-specified font path
|
||||
if(getenv("MEGAGLEST_FONT") != NULL || getenv("MEGAGLEST_FONT_FAMILY") != NULL) {
|
||||
|
||||
if(getenv("MEGAGLEST_FONT") != NULL) {
|
||||
tryFont = getenv("MEGAGLEST_FONT");
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
|
||||
CHECK_FONT_PATH(tryFont.c_str(),getenv("MEGAGLEST_FONT_FAMILY"))
|
||||
}
|
||||
else {
|
||||
CHECK_FONT_PATH(NULL,getenv("MEGAGLEST_FONT_FAMILY"))
|
||||
}
|
||||
}
|
||||
|
||||
string data_path = Text::DEFAULT_FONT_PATH;
|
||||
string defaultFont = data_path + "data/core/fonts/LinBiolinum_RB.ttf";//LinBiolinum_Re-0.6.4.ttf
|
||||
tryFont = defaultFont;
|
||||
#ifdef WIN32
|
||||
replaceAll(tryFont, "/", "\\");
|
||||
#endif
|
||||
CHECK_FONT_PATH(tryFont.c_str(),"Linux Biolinum O:style=Bold")
|
||||
|
||||
#ifdef FONT_PATH
|
||||
// Get distro-specified font path
|
||||
CHECK_FONT_PATH(FONT_PATH)
|
||||
#endif
|
||||
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular")
|
||||
|
||||
// Check a couple of common paths for Gothic Uralic/bold as a last resort
|
||||
// Debian
|
||||
|
@ -359,44 +396,44 @@ const char* findFont(const char *firstFontToTry) {
|
|||
font that contains all the Unicode characters in use in your translation.
|
||||
If the font is available in Debian it should be the Debian path.
|
||||
*/
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular")
|
||||
/*
|
||||
TRANSLATORS: If using the FTGL backend, this should be the path of a
|
||||
font that contains all the Unicode characters in use in your translation.
|
||||
If the font is available in Debian it should be the Debian path.
|
||||
*/
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf","Gothic Uralic:style=Regular")
|
||||
// Mandrake
|
||||
/*
|
||||
TRANSLATORS: If using the FTGL backend, this should be the path of a bold
|
||||
font that contains all the Unicode characters in use in your translation.
|
||||
If the font is available in Mandrake it should be the Mandrake path.
|
||||
*/
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF","Gothic Uralic:style=Bold")
|
||||
/*
|
||||
TRANSLATORS: If using the FTGL backend, this should be the path of a
|
||||
font that contains all the Unicode characters in use in your translation.
|
||||
If the font is available in Mandrake it should be the Mandrake path.
|
||||
*/
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF","Gothic Uralic:style=Regular")
|
||||
|
||||
// Check the non-translated versions of the above
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothub__.ttf","Gothic Uralic:style=Regular")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/uralic/gothu___.ttf","Gothic Uralic:style=Regular")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHUB__.TTF","Gothic Uralic:style=Regular")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/TTF/uralic/GOTHU___.TTF","Gothic Uralic:style=Regular")
|
||||
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/linux-libertine/LinLibertine_Re.ttf","Linux Libertine O:style=Regular")
|
||||
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSerif.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSans.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeMono.ttf")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSerif.ttf","FreeSerif")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeSans.ttf","FreeSans")
|
||||
CHECK_FONT_PATH("/usr/share/fonts/truetype/freefont/FreeMono.ttf","FreeMono")
|
||||
|
||||
#ifdef _WIN32
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\verdana.ttf")
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\tahoma.ttf")
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\arial.ttf")
|
||||
CHECK_FONT_PATH("\\windows\\fonts\\arial.ttf")
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\verdana.ttf",NULL)
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\tahoma.ttf",NULL)
|
||||
CHECK_FONT_PATH("c:\\windows\\fonts\\arial.ttf",NULL)
|
||||
CHECK_FONT_PATH("\\windows\\fonts\\arial.ttf",NULL)
|
||||
#endif
|
||||
|
||||
return font;
|
||||
|
|
|
@ -19,7 +19,7 @@ Text::Text(FontTextHandlerType type) {
|
|||
this->type = type;
|
||||
}
|
||||
Text::~Text() {}
|
||||
void Text::init(string fontName, int fontSize) {}
|
||||
void Text::init(string fontName, string fontFamilyName, int fontSize) {}
|
||||
void Text::Render(const char*, const int) {}
|
||||
float Text::Advance(const char*, const int) {return 0;}
|
||||
float Text::LineHeight(const char*, const int) {return 0;}
|
||||
|
|
|
@ -84,17 +84,16 @@ void Font3DGl::end() {
|
|||
|
||||
}}}//end namespace
|
||||
|
||||
namespace Shared { namespace Graphics {
|
||||
|
||||
using namespace Gl;
|
||||
Font3D * ConvertFont2DTo3D(Font2D *font) {
|
||||
|
||||
Font3D *result = new Font3DGl();
|
||||
result->setSize(font->getSize());
|
||||
result->setType("",font->getType());
|
||||
result->setWidth(font->getWidth());
|
||||
result->init();
|
||||
return result;
|
||||
}
|
||||
|
||||
}}
|
||||
//namespace Shared { namespace Graphics {
|
||||
//
|
||||
// using namespace Gl;
|
||||
//Font3D * ConvertFont2DTo3D(Font2D *font) {
|
||||
//
|
||||
// Font3D *result = new Font3DGl();
|
||||
// result->setSize(font->getSize());
|
||||
// result->setType("",font->getType());
|
||||
// result->setWidth(font->getWidth());
|
||||
// result->init();
|
||||
// return result;
|
||||
//}
|
||||
//}}
|
||||
|
|
|
@ -78,7 +78,7 @@ TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) {
|
|||
delete ftFont; ftFont = NULL;
|
||||
free((void*)fontFile);
|
||||
fontFile = NULL;
|
||||
throw runtime_error("FTGL: error loading font");
|
||||
throw runtime_error(string("FTGL: error loading font: ") + string(fontFile));
|
||||
}
|
||||
free((void*)fontFile);
|
||||
fontFile = NULL;
|
||||
|
@ -123,9 +123,9 @@ void TextFTGL::cleanupFont() {
|
|||
fontFile = NULL;
|
||||
}
|
||||
|
||||
void TextFTGL::init(string fontName, int fontSize) {
|
||||
void TextFTGL::init(string fontName, string fontFamilyName, int fontSize) {
|
||||
cleanupFont();
|
||||
fontFile = findFont(fontName.c_str());
|
||||
fontFile = findFont(fontName.c_str(),fontFamilyName.c_str());
|
||||
|
||||
//ftFont = new FTBufferFont(fontFile);
|
||||
//ftFont = new FTGLPixmapFont(fontFile);
|
||||
|
|
|
@ -38,7 +38,7 @@ TextFreetypeGL::TextFreetypeGL(FontTextHandlerType type) : Text(type) {
|
|||
font=NULL;
|
||||
manager=NULL;
|
||||
|
||||
init("", 24);
|
||||
init("", "", 24);
|
||||
}
|
||||
|
||||
TextFreetypeGL::~TextFreetypeGL() {
|
||||
|
@ -52,10 +52,11 @@ void TextFreetypeGL::cleanupFont() {
|
|||
}
|
||||
}
|
||||
|
||||
void TextFreetypeGL::init(string fontName, int fontSize) {
|
||||
void TextFreetypeGL::init(string fontName, string fontFamilyName, int fontSize) {
|
||||
cleanupFont();
|
||||
this->fontName = fontName;
|
||||
this->fontFile = findFont(this->fontName.c_str());
|
||||
this->fontFamilyName = fontFamilyName;
|
||||
this->fontFile = findFont(this->fontName.c_str(),this->fontFamilyName.c_str());
|
||||
this->fontFaceSize = fontSize;
|
||||
|
||||
const wchar_t *cache = L" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
||||
|
@ -77,7 +78,7 @@ void TextFreetypeGL::init(string fontName, int fontSize) {
|
|||
|
||||
void TextFreetypeGL::SetFaceSize(int value) {
|
||||
this->fontFaceSize = value;
|
||||
init(this->fontName,this->fontFaceSize);
|
||||
init(this->fontName,this->fontFamilyName,this->fontFaceSize);
|
||||
}
|
||||
|
||||
int TextFreetypeGL::GetFaceSize() {
|
||||
|
|
|
@ -141,28 +141,28 @@ void Mesh::BuildVBOs() {
|
|||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOVertices ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getVertices(), GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Generate And Bind The Texture Coordinate Buffer
|
||||
glGenBuffersARB( 1, (GLuint*)&m_nVBOTexCoords ); // Get A Valid Name
|
||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBOTexCoords ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec2f)*vertexCount, texCoords, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Generate And Bind The Normal Buffer
|
||||
glGenBuffersARB( 1, (GLuint*)&m_nVBONormals ); // Get A Valid Name
|
||||
glBindBufferARB( GL_ARRAY_BUFFER_ARB, m_nVBONormals ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ARRAY_BUFFER_ARB, sizeof(Vec3f)*frameCount*vertexCount, getInterpolationData()->getNormals(), GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Generate And Bind The Index Buffer
|
||||
glGenBuffersARB( 1, (GLuint*)&m_nVBOIndexes ); // Get A Valid Name
|
||||
glBindBufferARB( GL_ELEMENT_ARRAY_BUFFER_ARB, m_nVBOIndexes ); // Bind The Buffer
|
||||
// Load The Data
|
||||
glBufferDataARB( GL_ELEMENT_ARRAY_BUFFER_ARB, sizeof(uint32)*indexCount, indices, GL_STATIC_DRAW_ARB );
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
|
||||
|
||||
// Our Copy Of The Data Is No Longer Necessary, It Is Safe In The Graphics Card
|
||||
delete [] vertices; vertices = NULL;
|
||||
|
|
|
@ -74,6 +74,7 @@ ParticleSystem::ParticleSystem(int particleCount) {
|
|||
teamcolorNoEnergy= false;
|
||||
teamcolorEnergy= false;
|
||||
alternations= 0;
|
||||
particleSystemStartDelay= 0;
|
||||
}
|
||||
|
||||
ParticleSystem::~ParticleSystem(){
|
||||
|
@ -97,8 +98,10 @@ void ParticleSystem::update(){
|
|||
if(aliveParticleCount > (int) particles.size()){
|
||||
throw runtime_error("aliveParticleCount >= particles.size()");
|
||||
}
|
||||
|
||||
if(state != sPause){
|
||||
if(particleSystemStartDelay>0){
|
||||
particleSystemStartDelay--;
|
||||
}
|
||||
else if(state != sPause){
|
||||
for(int i= 0; i < aliveParticleCount; ++i){
|
||||
updateParticle(&particles[i]);
|
||||
|
||||
|
@ -527,6 +530,7 @@ void GameParticleSystem::setTween(float relative,float absolute) {
|
|||
// UnitParticleSystem
|
||||
// ===========================================================================
|
||||
bool UnitParticleSystem::isNight= false;
|
||||
Vec3f UnitParticleSystem::lightColor=Vec3f(1.0f,1.0f,1.0f);
|
||||
|
||||
UnitParticleSystem::UnitParticleSystem(int particleCount):
|
||||
GameParticleSystem(particleCount),
|
||||
|
@ -537,11 +541,14 @@ UnitParticleSystem::UnitParticleSystem(int particleCount):
|
|||
|
||||
setParticleSize(0.6f);
|
||||
setColorNoEnergy(Vec4f(1.0f, 0.5f, 0.0f, 1.0f));
|
||||
sizeNoEnergy=1.0f;
|
||||
|
||||
primitive= pQuad;
|
||||
gravity= 0.0f;
|
||||
|
||||
fixed= false;
|
||||
shape = UnitParticleSystem::sLinear;
|
||||
angle= 0.0f;
|
||||
rotation= 0.0f;
|
||||
relativeDirection= true;
|
||||
relative= false;
|
||||
|
@ -549,6 +556,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount):
|
|||
|
||||
isVisibleAtNight= true;
|
||||
isVisibleAtDay= true;
|
||||
isDaylightAffected= false;
|
||||
|
||||
cRotation= Vec3f(1.0f, 1.0f, 1.0f);
|
||||
fixedAddition= Vec3f(0.0f, 0.0f, 0.0f);
|
||||
|
@ -560,6 +568,7 @@ UnitParticleSystem::UnitParticleSystem(int particleCount):
|
|||
|
||||
delay = 0; // none
|
||||
lifetime = -1; // forever
|
||||
emissionRateFade=0.0f;
|
||||
|
||||
startTime = 0;
|
||||
endTime = 1;
|
||||
|
@ -736,6 +745,12 @@ void UnitParticleSystem::updateParticle(Particle *p){
|
|||
}
|
||||
p->speed+= p->accel;
|
||||
p->color= color * energyRatio + colorNoEnergy * (1.0f - energyRatio);
|
||||
if(isDaylightAffected==true)
|
||||
{
|
||||
p->color.x=p->color.x*lightColor.x;
|
||||
p->color.y=p->color.y*lightColor.y;
|
||||
p->color.z=p->color.z*lightColor.z;
|
||||
}
|
||||
p->size= particleSize * energyRatio + sizeNoEnergy * (1.0f - energyRatio);
|
||||
if(state == ParticleSystem::sFade || staticParticleCount < 1){
|
||||
p->energy--;
|
||||
|
|
|
@ -916,20 +916,30 @@ Pixmap2D::~Pixmap2D() {
|
|||
|
||||
void Pixmap2D::Scale(int format, int newW, int newH) {
|
||||
int useComponents = this->getComponents();
|
||||
int originalW = w;
|
||||
int originalH = h;
|
||||
uint8 *newpixels= new uint8[newW * newH * useComponents];
|
||||
|
||||
glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
int error = gluScaleImage( format,
|
||||
w, h, GL_UNSIGNED_BYTE, pixels,
|
||||
newW, newH, GL_UNSIGNED_BYTE, newpixels);
|
||||
if(error != GL_NO_ERROR) {
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
if(error == GL_NO_ERROR) {
|
||||
init(newW,newH,this->components);
|
||||
pixels = newpixels;
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Scaled image from [%d x %d] to [%d x %d]\n",originalW,originalH,w,h);
|
||||
}
|
||||
else {
|
||||
assertGl();
|
||||
const char *errorString= reinterpret_cast<const char*>(gluErrorString(error));
|
||||
printf("ERROR Scaling image from [%d x %d] to [%d x %d] error: %d [%s]\n",originalW,originalH,w,h,error,errorString);
|
||||
|
||||
GLenum glErr = error;
|
||||
assertGlWithErrorNumber(glErr);
|
||||
}
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
|
||||
CalculatePixelsCRC(pixels,getPixelByteCount(), crc);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,16 @@ const int Texture::defaultSize = 256;
|
|||
const int Texture::defaultComponents = 4;
|
||||
bool Texture::useTextureCompression = false;
|
||||
|
||||
/* Quick utility function for texture creation */
|
||||
static int powerOfTwo(int input) {
|
||||
int value = 1;
|
||||
|
||||
while (value < input) {
|
||||
value <<= 1;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
Texture::Texture() {
|
||||
assert(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false);
|
||||
|
||||
|
@ -86,6 +96,102 @@ SDL_Surface* Texture2D::CreateSDLSurface(bool newPixelData) const {
|
|||
delete[] surfData;
|
||||
}
|
||||
|
||||
// SDL_Surface *prepGLTexture(SDL_Surface *surface, GLfloat *texCoords = NULL, const bool
|
||||
// freeSource = false) {
|
||||
/* Use the surface width and height expanded to powers of 2 */
|
||||
//int w = powerOfTwo(surface->w);
|
||||
//int h = powerOfTwo(surface->h);
|
||||
int w = surface->w;
|
||||
int h = surface->h;
|
||||
|
||||
// if (texCoords != 0) {
|
||||
// texCoords[0] = 0.0f; /* Min
|
||||
// X */
|
||||
// texCoords[1] = 0.0f; /* Min
|
||||
// Y */
|
||||
// texCoords[2] = (GLfloat)surface->w / w; /* Max X */
|
||||
// texCoords[3] = (GLfloat)surface->h / h; /* Max Y */
|
||||
// }
|
||||
|
||||
SDL_Surface *image = SDL_CreateRGBSurface(
|
||||
SDL_SWSURFACE,
|
||||
w, h,
|
||||
32,
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
|
||||
0x000000FF,
|
||||
0x0000FF00,
|
||||
0x00FF0000,
|
||||
0xFF000000
|
||||
#else
|
||||
0xFF000000,
|
||||
0x00FF0000,
|
||||
0x0000FF00,
|
||||
0x000000FF
|
||||
#endif
|
||||
);
|
||||
if ( image == NULL ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Save the alpha blending attributes */
|
||||
Uint32 savedFlags = surface->flags&(SDL_SRCALPHA|SDL_RLEACCELOK);
|
||||
Uint8 savedAlpha = surface->format->alpha;
|
||||
if ( (savedFlags & SDL_SRCALPHA) == SDL_SRCALPHA ) {
|
||||
SDL_SetAlpha(surface, 0, 0);
|
||||
}
|
||||
|
||||
SDL_Rect srcArea, destArea;
|
||||
/* Copy the surface into the GL texture image */
|
||||
srcArea.x = 0; destArea.x = 0;
|
||||
/* Copy it in at the bottom, because we're going to flip
|
||||
this image upside-down in a moment
|
||||
*/
|
||||
srcArea.y = 0; destArea.y = h - surface->h;
|
||||
srcArea.w = surface->w;
|
||||
srcArea.h = surface->h;
|
||||
SDL_BlitSurface(surface, &srcArea, image, &destArea);
|
||||
|
||||
/* Restore the alpha blending attributes */
|
||||
if ((savedFlags & SDL_SRCALPHA) == SDL_SRCALPHA) {
|
||||
SDL_SetAlpha(surface, savedFlags, savedAlpha);
|
||||
}
|
||||
|
||||
/* Turn the image upside-down, because OpenGL textures
|
||||
start at the bottom-left, instead of the top-left
|
||||
*/
|
||||
#ifdef _MSC_VER
|
||||
Uint8 *line = new Uint8[image->pitch];
|
||||
#else
|
||||
Uint8 line[image->pitch];
|
||||
#endif
|
||||
/* These two make the following more readable */
|
||||
Uint8 *pixels = static_cast<Uint8*>(image->pixels);
|
||||
Uint16 pitch = image->pitch;
|
||||
int ybegin = 0;
|
||||
int yend = image->h - 1;
|
||||
|
||||
// TODO: consider if this lock is legal/appropriate
|
||||
if (SDL_MUSTLOCK(image)) { SDL_LockSurface(image); }
|
||||
while (ybegin < yend) {
|
||||
memcpy(line, pixels + pitch*ybegin, pitch);
|
||||
memcpy(pixels + pitch*ybegin, pixels + pitch*yend, pitch);
|
||||
memcpy(pixels + pitch*yend, line, pitch);
|
||||
ybegin++;
|
||||
yend--;
|
||||
}
|
||||
if (SDL_MUSTLOCK(image)) { SDL_UnlockSurface(image); }
|
||||
|
||||
// if (freeSource) {
|
||||
// SDL_FreeSurface(surface);
|
||||
// }
|
||||
|
||||
#ifdef _MSC_VER
|
||||
delete[] line;
|
||||
#endif
|
||||
|
||||
return image;
|
||||
// }
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ void * LuaArguments::getGenericData(int argumentIndex) const{
|
|||
|
||||
if(lua_isstring(luaState, argumentIndex)) {
|
||||
const char *result = luaL_checkstring(luaState, argumentIndex);
|
||||
printf("\nGENERIC param %d is a string, %s!\n",argumentIndex,result);
|
||||
//printf("\nGENERIC param %d is a string, %s!\n",argumentIndex,result);
|
||||
return (void *)result;
|
||||
}
|
||||
//else if(lua_isnumber(luaState, argumentIndex)) {
|
||||
|
@ -202,11 +202,11 @@ void * LuaArguments::getGenericData(int argumentIndex) const{
|
|||
//}
|
||||
else if(lua_isnumber(luaState, argumentIndex)) {
|
||||
lua_Integer result = luaL_checkinteger(luaState, argumentIndex);
|
||||
printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,(int)result);
|
||||
//printf("\nGENERIC param %d is an int, %d!\n",argumentIndex,(int)result);
|
||||
return (void *)result;
|
||||
}
|
||||
else {
|
||||
printf("\nGENERIC param %d is a NULL!\n",argumentIndex);
|
||||
//printf("\nGENERIC param %d is a NULL!\n",argumentIndex);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1587,6 +1587,11 @@ bool changeVideoMode(int resW, int resH, int colorBits, int ) {
|
|||
|
||||
void restoreVideoMode(bool exitingApp) {
|
||||
//SDL_Quit();
|
||||
if(exitingApp == true && SDL_WasInit(SDL_INIT_VIDEO)) {
|
||||
SDL_ShowCursor(1);
|
||||
SDL_WM_GrabInput(SDL_GRAB_OFF);
|
||||
//SDL_SetGamma(1, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int getScreenW() {
|
||||
|
|
|
@ -313,7 +313,7 @@ string Ip::getString() const{
|
|||
// class Socket
|
||||
// ===============================================
|
||||
|
||||
#if defined(__FreeBSD__) || defined(BSD) || defined(__APPLE__) || defined(__linux__)
|
||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(BSD) || defined(__APPLE__) || defined(__linux__)
|
||||
# define USE_GETIFADDRS 1
|
||||
# include <ifaddrs.h>
|
||||
#endif
|
||||
|
@ -768,7 +768,7 @@ bool Socket::isSocketValid() const {
|
|||
|
||||
bool Socket::isSocketValid(const PLATFORM_SOCKET *validateSocket) {
|
||||
#ifdef WIN32
|
||||
if(validateSocket == NULL) {
|
||||
if(validateSocket == NULL || (*validateSocket) == 0) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
@ -959,6 +959,8 @@ void Socket::disconnectSocket() {
|
|||
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
MutexSafeWrapper safeMutex1(dataSynchAccessorWrite,CODE_AT_LINE);
|
||||
|
||||
if(isSocketValid() == true) {
|
||||
::shutdown(sock,2);
|
||||
#ifndef WIN32
|
||||
::close(sock);
|
||||
|
@ -967,6 +969,7 @@ void Socket::disconnectSocket() {
|
|||
::closesocket(sock);
|
||||
sock = -1;
|
||||
#endif
|
||||
}
|
||||
safeMutex.ReleaseLock();
|
||||
safeMutex1.ReleaseLock();
|
||||
}
|
||||
|
@ -985,6 +988,7 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
|
|||
fd_set rfds;
|
||||
FD_ZERO(&rfds);
|
||||
|
||||
string socketDebugList = "";
|
||||
PLATFORM_SOCKET imaxsocket = 0;
|
||||
for(std::map<PLATFORM_SOCKET,bool>::iterator itermap = socketTriggeredList.begin();
|
||||
itermap != socketTriggeredList.end(); ++itermap)
|
||||
|
@ -994,6 +998,11 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
|
|||
{
|
||||
FD_SET(socket, &rfds);
|
||||
imaxsocket = max(socket,imaxsocket);
|
||||
|
||||
if(socketDebugList != "") {
|
||||
socketDebugList += ",";
|
||||
}
|
||||
socketDebugList += intToStr(socket);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1012,7 +1021,7 @@ bool Socket::hasDataToRead(std::map<PLATFORM_SOCKET,bool> &socketTriggeredList)
|
|||
}
|
||||
if(retval < 0)
|
||||
{
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] ERROR SELECTING SOCKET DATA retval = %d error = %s\n",__FILE__,__FUNCTION__,retval,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s] Line: %d, ERROR SELECTING SOCKET DATA retval = %d error = %s, socketDebugList [%s]\n",__FILE__,__FUNCTION__,__LINE__,retval,getLastSocketErrorFormattedText().c_str(),socketDebugList.c_str());
|
||||
}
|
||||
else if(retval)
|
||||
{
|
||||
|
@ -1147,7 +1156,8 @@ int Socket::getDataToRead(bool wantImmediateReply) {
|
|||
#else
|
||||
int err= ioctlsocket(sock, FIONREAD, &size);
|
||||
#endif
|
||||
if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN)
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN)
|
||||
{
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR PEEKING SOCKET DATA, err = %d %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText().c_str());
|
||||
break;
|
||||
|
@ -1201,11 +1211,13 @@ int Socket::send(const void *data, int dataSize) {
|
|||
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorWrite,CODE_AT_LINE);
|
||||
|
||||
if(isSocketValid() == true) {
|
||||
#ifdef __APPLE__
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, SO_NOSIGPIPE);
|
||||
#else
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
}
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
|
||||
|
@ -1213,15 +1225,16 @@ int Socket::send(const void *data, int dataSize) {
|
|||
//bytesSent = -1;
|
||||
// END TEST
|
||||
|
||||
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText().c_str());
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] ERROR WRITING SOCKET DATA, err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesSent,getLastSocketErrorFormattedText(&lastSocketError).c_str());
|
||||
}
|
||||
else if(bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) {
|
||||
else if(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && isConnected() == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during send, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
int attemptCount = 0;
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
while((bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
attemptCount++;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount);
|
||||
|
@ -1243,7 +1256,8 @@ int Socket::send(const void *data, int dataSize) {
|
|||
#else
|
||||
bytesSent = ::send(sock, (const char *)data, dataSize, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
lastSocketError = getLastSocketError();
|
||||
if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1264,13 +1278,16 @@ int Socket::send(const void *data, int dataSize) {
|
|||
}
|
||||
|
||||
if(isConnected() == true && bytesSent > 0 && bytesSent < dataSize) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] need to send more data, trying again getLastSocketError() = %d, bytesSent = %d, dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketError(),bytesSent,dataSize);
|
||||
lastSocketError = getLastSocketError();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] need to send more data, trying again getLastSocketError() = %d, bytesSent = %d, dataSize = %d\n",__FILE__,__FUNCTION__,__LINE__,lastSocketError,bytesSent,dataSize);
|
||||
|
||||
int totalBytesSent = bytesSent;
|
||||
int attemptCount = 0;
|
||||
|
||||
|
||||
time_t tStartTimer = time(NULL);
|
||||
while(((bytesSent > 0 && totalBytesSent < dataSize) ||
|
||||
(bytesSent < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)) &&
|
||||
(bytesSent < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN)) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_SEND_WAIT_SECONDS)) {
|
||||
attemptCount++;
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] attemptCount = %d, totalBytesSent = %d\n",__FILE__,__FUNCTION__,__LINE__,attemptCount,totalBytesSent);
|
||||
|
@ -1293,11 +1310,12 @@ int Socket::send(const void *data, int dataSize) {
|
|||
#else
|
||||
bytesSent = ::send(sock, &sendBuf[totalBytesSent], dataSize - totalBytesSent, MSG_NOSIGNAL | MSG_DONTWAIT);
|
||||
#endif
|
||||
lastSocketError = getLastSocketError();
|
||||
if(bytesSent > 0) {
|
||||
totalBytesSent += bytesSent;
|
||||
}
|
||||
|
||||
if(bytesSent < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(bytesSent < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1352,17 +1370,20 @@ int Socket::receive(void *data, int dataSize, bool tryReceiveUntilDataSizeMet) {
|
|||
// safeMutexSocketDestructorFlag.ReleaseLock();
|
||||
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
||||
if(isSocketValid() == true) {
|
||||
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
||||
}
|
||||
safeMutex.ReleaseLock();
|
||||
}
|
||||
if(bytesReceived < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived,getLastSocketErrorFormattedText().c_str());
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(bytesReceived < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR READING SOCKET DATA error while sending socket data, bytesSent = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived,getLastSocketErrorFormattedText(&lastSocketError).c_str());
|
||||
}
|
||||
else if(bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
else if(bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 EAGAIN during receive, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((bytesReceived < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
while((bytesReceived < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_RECV_WAIT_SECONDS)) {
|
||||
if(isConnected() == false) {
|
||||
int iErr = getLastSocketError();
|
||||
|
@ -1382,6 +1403,7 @@ int Socket::receive(void *data, int dataSize, bool tryReceiveUntilDataSizeMet) {
|
|||
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
bytesReceived = recv(sock, reinterpret_cast<char*>(data), dataSize, 0);
|
||||
lastSocketError = getLastSocketError();
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #2 EAGAIN during receive, trying again returned: %d\n",__FILE__,__FUNCTION__,__LINE__,bytesReceived);
|
||||
|
@ -1442,8 +1464,9 @@ int Socket::peek(void *data, int dataSize,bool mustGetData) {
|
|||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
||||
if(isSocketValid() == true) {
|
||||
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
||||
}
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
//printf("Peek #1 err = %d\n",err);
|
||||
|
@ -1452,17 +1475,18 @@ int Socket::peek(void *data, int dataSize,bool mustGetData) {
|
|||
}
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
||||
if(err < 0 && getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(err < 0 && lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] ERROR PEEKING SOCKET DATA error while sending socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText().c_str());
|
||||
disconnectSocket();
|
||||
}
|
||||
else if(err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN && mustGetData == true) {
|
||||
else if(err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN && mustGetData == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #1 ERROR EAGAIN during peek, trying again...\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//printf("Peek #2 err = %d\n",err);
|
||||
|
||||
time_t tStartTimer = time(NULL);
|
||||
while((err < 0 && getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
while((err < 0 && lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) &&
|
||||
(difftime(time(NULL),tStartTimer) <= MAX_PEEK_WAIT_SECONDS)) {
|
||||
/*
|
||||
if(isConnected() == false) {
|
||||
|
@ -1484,6 +1508,7 @@ int Socket::peek(void *data, int dataSize,bool mustGetData) {
|
|||
//MutexSafeWrapper safeMutex(&dataSynchAccessor,CODE_AT_LINE + "_" + intToStr(sock) + "_" + intToStr(dataSize));
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
err = recv(sock, reinterpret_cast<char*>(data), dataSize, MSG_PEEK);
|
||||
lastSocketError = getLastSocketError();
|
||||
safeMutex.ReleaseLock();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) if(chrono.getMillis() > 1) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
|
@ -1498,8 +1523,9 @@ int Socket::peek(void *data, int dataSize,bool mustGetData) {
|
|||
|
||||
if(err <= 0) {
|
||||
//printf("Peek #3 err = %d\n",err);
|
||||
if(mustGetData == true || getLastSocketError() != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
int iErr = getLastSocketError();
|
||||
lastSocketError = getLastSocketError();
|
||||
if(mustGetData == true || lastSocketError != PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
int iErr = lastSocketError;
|
||||
disconnectSocket();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"[%s::%s Line: %d] DISCONNECTED SOCKET error while peeking socket data, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,err,getLastSocketErrorFormattedText(&iErr).c_str());
|
||||
|
@ -1761,8 +1787,9 @@ void ClientSocket::connect(const Ip &ip, int port)
|
|||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] #2 Error connecting socket for IP: %s for Port: %d err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,ip.getString().c_str(),port,err,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #2 Error connecting socket for IP: %s for Port: %d err = %d error = %s\n",__FILE__,__FUNCTION__,__LINE__,ip.getString().c_str(),port,err,getLastSocketErrorFormattedText().c_str());
|
||||
|
||||
if (getLastSocketError() == PLATFORM_SOCKET_INPROGRESS ||
|
||||
getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
int lastSocketError = getLastSocketError();
|
||||
if (lastSocketError == PLATFORM_SOCKET_INPROGRESS ||
|
||||
lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
fd_set myset;
|
||||
struct timeval tv;
|
||||
int valopt=0;
|
||||
|
@ -1781,10 +1808,11 @@ void ClientSocket::connect(const Ip &ip, int port)
|
|||
{
|
||||
MutexSafeWrapper safeMutex(dataSynchAccessorRead,CODE_AT_LINE);
|
||||
err = select((int)sock + 1, NULL, &myset, NULL, &tv);
|
||||
lastSocketError = getLastSocketError();
|
||||
//safeMutex.ReleaseLock();
|
||||
}
|
||||
|
||||
if (err < 0 && getLastSocketError() != PLATFORM_SOCKET_INTERRUPTED) {
|
||||
if (err < 0 && lastSocketError != PLATFORM_SOCKET_INTERRUPTED) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Error connecting %s\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Error connecting %s\n",__FILE__,__FUNCTION__,__LINE__,getLastSocketErrorFormattedText().c_str());
|
||||
|
||||
|
@ -1900,7 +1928,7 @@ void BroadCastClientSocketThread::execute() {
|
|||
#else
|
||||
setsockopt(bcfd, SOL_SOCKET, SO_REUSEADDR, (char *)&val, sizeof(val));
|
||||
#endif
|
||||
if(bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) {
|
||||
if(::bind( bcfd, (struct sockaddr *)&bcaddr, sizeof(bcaddr) ) < 0 ) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"bind failed: %s\n", getLastSocketErrorFormattedText().c_str());
|
||||
}
|
||||
else {
|
||||
|
@ -2189,9 +2217,14 @@ void ServerSocket::listen(int connectionQueueSize) {
|
|||
}
|
||||
}
|
||||
|
||||
Socket *ServerSocket::accept() {
|
||||
Socket *ServerSocket::accept(bool errorOnFail) {
|
||||
if(isSocketValid() == false) {
|
||||
throwException("socket is invalid!");
|
||||
if(errorOnFail == true) {
|
||||
throwException("socket is invalid!");
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
struct sockaddr_in cli_addr;
|
||||
|
@ -2206,11 +2239,16 @@ Socket *ServerSocket::accept() {
|
|||
sprintf(szBuf, "In [%s::%s Line: %d] Error accepting socket connection sock = %d, err = %d, error = %s\n",__FILE__,__FUNCTION__,__LINE__,sock,newSock,getLastSocketErrorFormattedText().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,szBuf);
|
||||
|
||||
if(getLastSocketError() == PLATFORM_SOCKET_TRY_AGAIN)
|
||||
{
|
||||
int lastSocketError = getLastSocketError();
|
||||
if(lastSocketError == PLATFORM_SOCKET_TRY_AGAIN) {
|
||||
return NULL;
|
||||
}
|
||||
if(errorOnFail == true) {
|
||||
throwException(szBuf);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
throwException(szBuf);
|
||||
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -137,13 +137,14 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
|||
|
||||
//uint32 colorkey = SDL_MapRGB(icon->format, 255, 0, 255);
|
||||
//SDL_SetColorKey(icon, SDL_SRCCOLORKEY, colorkey);
|
||||
SDL_SetColorKey(icon, SDL_SRCCOLORKEY, SDL_MapRGB(icon->format, 255, 0, 255));
|
||||
|
||||
SDL_WM_SetIcon(icon, NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",__FILE__,__FUNCTION__,__LINE__,resW,resH,colorBits);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to set resolution: %d x %d, colorBits = %d.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,resW,resH,colorBits);
|
||||
|
||||
if(screen != NULL) {
|
||||
SDL_FreeSurface(screen);
|
||||
|
@ -159,8 +160,8 @@ void PlatformContextGl::init(int colorBits, int depthBits, int stencilBits,bool
|
|||
<< "bpp " << stencilBits << " stencil "
|
||||
<< depthBits << " depth-buffer). SDL Error is: " << SDL_GetError();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",__FILE__,__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,msg.str().c_str());
|
||||
|
||||
for(int i = 32; i >= 8; i-=8) {
|
||||
// try different color bits
|
||||
|
|
|
@ -128,7 +128,7 @@ bool Window::handleEvent() {
|
|||
case SDL_MOUSEBUTTONUP:
|
||||
case SDL_MOUSEMOTION:
|
||||
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
codeLocation = "d";
|
||||
|
||||
setLastMouseEvent(Chrono::getCurMillis());
|
||||
|
@ -140,21 +140,21 @@ bool Window::handleEvent() {
|
|||
|
||||
switch(event.type) {
|
||||
case SDL_QUIT:
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
codeLocation = "e";
|
||||
return false;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
codeLocation = "f";
|
||||
|
||||
if(global_window) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
global_window->handleMouseDown(event);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
break;
|
||||
case SDL_MOUSEBUTTONUP: {
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
codeLocation = "g";
|
||||
if(global_window) {
|
||||
MouseButton b = getMouseButton(event.button.button);
|
||||
|
@ -166,7 +166,7 @@ bool Window::handleEvent() {
|
|||
break;
|
||||
}
|
||||
case SDL_MOUSEMOTION: {
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
//MouseState ms;
|
||||
//ms.leftMouse = (event.motion.state & SDL_BUTTON_LMASK) != 0;
|
||||
//ms.rightMouse = (event.motion.state & SDL_BUTTON_RMASK) != 0;
|
||||
|
@ -183,11 +183,11 @@ bool Window::handleEvent() {
|
|||
break;
|
||||
}
|
||||
case SDL_KEYDOWN:
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
{
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
codeLocation = "i";
|
||||
Window::isKeyPressedDown = true;
|
||||
|
@ -198,20 +198,20 @@ bool Window::handleEvent() {
|
|||
keystate = event.key.keysym;
|
||||
|
||||
string keyName = SDL_GetKeyName(event.key.keysym.sym);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] unicode [%d - %c] scancode [%d] keyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d] keyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Raw SDL key [%d - %c] mod [%d] unicode [%d - %c] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d] keyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode,keyName.c_str());
|
||||
|
||||
/* handle ALT+Return */
|
||||
if((keyName == "return" || keyName == "enter")
|
||||
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] SDLK_RETURN pressed.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] SDLK_RETURN pressed.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
toggleFullscreen();
|
||||
}
|
||||
#ifdef WIN32
|
||||
/* handle ALT+f4 */
|
||||
if((keyName == "f4" || keyName == "F4")
|
||||
&& (event.key.keysym.mod & (KMOD_LALT | KMOD_RALT))) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] ALT-F4 pressed.\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] ALT-F4 pressed.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
@ -224,17 +224,17 @@ bool Window::handleEvent() {
|
|||
global_window->eventKeyDown(event.key);
|
||||
global_window->eventKeyPress(event.key);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYDOWN ================================\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYDOWN ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_KEYUP:
|
||||
//printf("In [%s::%s] Line :%d\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
//printf("In [%s::%s] Line :%d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYUP ================================\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== START OF SDL SDL_KEYUP ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
codeLocation = "j";
|
||||
|
||||
|
@ -246,7 +246,7 @@ bool Window::handleEvent() {
|
|||
|
||||
keystate = event.key.keysym;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d]\n",__FILE__,__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] KEY_UP, Raw SDL key [%d] mod [%d] unicode [%d] scancode [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.key.keysym.sym,event.key.keysym.mod,event.key.keysym.unicode,event.key.keysym.scancode);
|
||||
|
||||
if(global_window) {
|
||||
//char key = getKey(event.key.keysym,true);
|
||||
|
@ -254,15 +254,15 @@ bool Window::handleEvent() {
|
|||
global_window->eventKeyUp(event.key);
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYUP ================================\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] =================================== END OF SDL SDL_KEYUP ================================\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
{
|
||||
// codeLocation = "k";
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
//
|
||||
// // Check if the program has lost window focus
|
||||
// if ((event.active.state & SDL_APPACTIVE) == SDL_APPACTIVE) {
|
||||
|
@ -273,9 +273,9 @@ bool Window::handleEvent() {
|
|||
// Window::isActive = true;
|
||||
// }
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
//
|
||||
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
// showCursor(willShowCursor);
|
||||
|
@ -292,18 +292,18 @@ bool Window::handleEvent() {
|
|||
// Window::isActive = true;
|
||||
// }
|
||||
//
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
//
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d, event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
// bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
// showCursor(willShowCursor);
|
||||
// }
|
||||
// }
|
||||
|
||||
codeLocation = "k";
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",__FILE__,__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] SDL_ACTIVEEVENT event.active.state = %d event.active. = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,event.active.state,event.active.gain);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d event.active.state = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive,event.active.state);
|
||||
|
||||
// Check if the program has lost window focus
|
||||
if ((event.active.state & (SDL_APPACTIVE | SDL_APPINPUTFOCUS))) {
|
||||
|
@ -314,9 +314,9 @@ bool Window::handleEvent() {
|
|||
Window::isActive = true;
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] Window::isActive = %d \n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",__FILE__,__FUNCTION__,__LINE__,Window::isActive);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Window::isActive = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,Window::isActive);
|
||||
|
||||
bool willShowCursor = (!Window::isActive || (Window::lastShowMouseState == SDL_ENABLE) || Window::getUseDefaultCursorOnly());
|
||||
showCursor(willShowCursor);
|
||||
|
@ -326,22 +326,22 @@ bool Window::handleEvent() {
|
|||
}
|
||||
}
|
||||
catch(const char *e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e,codeLocation.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e,codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e,codeLocation.c_str());
|
||||
throw runtime_error(e);
|
||||
}
|
||||
catch(const std::runtime_error& e) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
throw runtime_error(e.what());
|
||||
}
|
||||
catch(const std::exception& e) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),codeLocation.c_str());
|
||||
}
|
||||
catch(...) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",__FILE__,__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] (c) Couldn't process event: [UNKNOWN ERROR] codeLocation = %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,codeLocation.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
|||
// setup LOD bias factor
|
||||
//const float lodBias = std::max(std::min( configHandler->Get("TextureLODBias", 0.0f) , 4.0f), -4.0f);
|
||||
const float lodBias = max(min(0.0f,4.0f),-4.0f);
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",__FILE__,__FUNCTION__,__LINE__,lodBias);
|
||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("\n\n\n\n\n$$$$ In [%s::%s Line: %d] lodBias = %f\n\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,lodBias);
|
||||
#ifdef USE_STREFLOP
|
||||
if (streflop::fabs(lodBias) > 0.01f) {
|
||||
#else
|
||||
|
@ -455,7 +455,7 @@ void Window::setupGraphicsScreen(int depthBits, int stencilBits, bool hardware_a
|
|||
}
|
||||
|
||||
void Window::toggleFullscreen() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
Window::isFullScreen = !Window::isFullScreen;
|
||||
#ifdef WIN32
|
||||
|
@ -486,14 +486,14 @@ void Window::toggleFullscreen() {
|
|||
if ( (!surface) || (!(*surface)) ) // don't bother if there's no surface.
|
||||
return;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
tmpflags = (*surface)->flags;
|
||||
w = (*surface)->w;
|
||||
h = (*surface)->h;
|
||||
bpp = (*surface)->format->BitsPerPixel;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",__FILE__,__FUNCTION__,__LINE__,w,h,bpp);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n w = %d, h = %d, bpp = %d",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,w,h,bpp);
|
||||
|
||||
if (flags == NULL) // use the surface's flags.
|
||||
flags = &tmpflags;
|
||||
|
@ -507,16 +507,16 @@ void Window::toggleFullscreen() {
|
|||
|
||||
SDL_GetClipRect(*surface, &clip);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
*surface = SDL_SetVideoMode(w, h, bpp, (*flags));
|
||||
|
||||
if (*surface == NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
*surface = SDL_SetVideoMode(w, h, bpp, tmpflags);
|
||||
} // if
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
SDL_SetClipRect(*surface, &clip);
|
||||
}
|
||||
|
@ -524,14 +524,14 @@ void Window::toggleFullscreen() {
|
|||
else {
|
||||
HWND handle = GetSDLWindow();
|
||||
if(Window::isFullScreen == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == true [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle);
|
||||
ShowWindow(handle, SW_MAXIMIZE);
|
||||
//if(Window::getUseDefaultCursorOnly() == false) {
|
||||
// showCursor(false);
|
||||
//}
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",__FILE__,__FUNCTION__,__LINE__,handle);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d] Window::isFullScreen == false [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,handle);
|
||||
ShowWindow(handle, SW_RESTORE);
|
||||
//showCursor(true);
|
||||
}
|
||||
|
@ -539,31 +539,31 @@ void Window::toggleFullscreen() {
|
|||
|
||||
#else
|
||||
if(Window::allowAltEnterFullscreenToggle == true) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) {
|
||||
SDL_Surface *cur_surface = SDL_GetVideoSurface();
|
||||
if(cur_surface != NULL) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
SDL_WM_ToggleFullScreen(cur_surface);
|
||||
}
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
void Window::handleMouseDown(SDL_Event event) {
|
||||
static const Uint32 DOUBLECLICKTIME = 500;
|
||||
static const int DOUBLECLICKDELTA = 5;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
MouseButton button = getMouseButton(event.button.button);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
// windows implementation uses 120 for the resolution of a standard mouse
|
||||
// wheel notch. However, newer mice have finer resolutions. I dunno if SDL
|
||||
|
@ -579,35 +579,35 @@ void Window::handleMouseDown(SDL_Event event) {
|
|||
return;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
Uint32 ticks = SDL_GetTicks();
|
||||
int n = (int) button;
|
||||
|
||||
assert(n >= 0 && n < mbCount);
|
||||
if(n >= 0 && n < mbCount) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if(ticks - lastMouseDown[n] < DOUBLECLICKTIME
|
||||
&& abs(lastMouseX[n] - event.button.x) < DOUBLECLICKDELTA
|
||||
&& abs(lastMouseY[n] - event.button.y) < DOUBLECLICKDELTA) {
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
eventMouseDown(event.button.x, event.button.y, button);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
eventMouseDoubleClick(event.button.x, event.button.y, button);
|
||||
}
|
||||
else {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
eventMouseDown(event.button.x, event.button.y, button);
|
||||
}
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
lastMouseDown[n] = ticks;
|
||||
lastMouseX[n] = event.button.x;
|
||||
lastMouseY[n] = event.button.y;
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -625,7 +625,7 @@ MouseButton Window::getMouseButton(int sdlButton) {
|
|||
return mbWheelDown;
|
||||
default:
|
||||
//throw std::runtime_error("Mouse Button > 3 not handled.");
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",__FILE__,__FUNCTION__,__LINE__,sdlButton);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] Mouse Button [%d] not handled.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,sdlButton);
|
||||
|
||||
return mbUnknown;
|
||||
}
|
||||
|
@ -637,16 +637,16 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
|||
if(input.keysym.unicode > 0) {
|
||||
string unicodeKeyName = SDL_GetKeyName((SDLKey)input.keysym.unicode);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d input.keysym.sym = %d unicodeKeyName [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod,input.keysym.sym,unicodeKeyName.c_str());
|
||||
|
||||
// When modifiers are pressed the unicode result is wrong
|
||||
// example CTRL-3 will give the ESCAPE vslue 27 in unicode
|
||||
if( !(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) &&
|
||||
!(input.keysym.mod & (KMOD_LALT | KMOD_RALT)) &&
|
||||
!(input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) ) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
//c = toupper(c);
|
||||
|
@ -674,38 +674,40 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
|||
input.keysym.unicode == SDLK_COMMA ||
|
||||
input.keysym.unicode == SDLK_MINUS ||
|
||||
input.keysym.unicode == SDLK_PERIOD ||
|
||||
input.keysym.unicode == SDLK_SLASH)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
input.keysym.unicode == SDLK_SLASH ||
|
||||
// Need to allow Shift + # key for AZERTY style keyboards
|
||||
(input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9))) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
}
|
||||
else if(input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
if( (input.keysym.unicode >= SDLK_0 && input.keysym.unicode <= SDLK_9) ||
|
||||
(input.keysym.unicode >= SDLK_KP0 && input.keysym.unicode <= SDLK_KP9)) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
}
|
||||
}
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
}
|
||||
//if(c == 0) {
|
||||
if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
c = input.keysym.sym;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
//c = (c & 0xFF);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
// SDL does NOT handle lowercase
|
||||
if(c >= 'A' && c <= 'Z') {
|
||||
|
@ -806,20 +808,20 @@ bool isKeyPressed(SDLKey compareKey, SDL_KeyboardEvent input,bool modifiersAllow
|
|||
if( input.keysym.mod & (KMOD_LCTRL | KMOD_RCTRL) ||
|
||||
input.keysym.mod & (KMOD_LALT | KMOD_RALT)) {
|
||||
//input.keysym.mod & (KMOD_LSHIFT | KMOD_RSHIFT)) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] result *WOULD HAVE BEEN TRUE* but is false due to: modifiersAllowed = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,modifiersAllowed,input.keysym.mod);
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
string compareKeyName = SDL_GetKeyName(compareKey);
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
|
||||
//printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
//printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
//printf ("ISPRESS compareKey [%d - %s] pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d result = %d\n",
|
||||
// compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod,result);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] compareKey [%d - %s] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,compareKey,compareKeyName.c_str(),c,pressKeyName.c_str(),result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -828,7 +830,7 @@ wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) {
|
|||
wchar_t c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(input.keysym.unicode > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
|
||||
c = input.keysym.unicode;
|
||||
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
|
@ -837,18 +839,18 @@ wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) {
|
|||
|
||||
//c = toupper(c);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c);
|
||||
}
|
||||
if(c == SDLK_UNKNOWN) {
|
||||
c = input.keysym.sym;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
//c = (SDLKey)(c & 0xFF);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
|
@ -856,8 +858,8 @@ wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) {
|
|||
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -866,7 +868,7 @@ SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
|||
SDLKey c = SDLK_UNKNOWN;
|
||||
//if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) {
|
||||
if(input.keysym.unicode > 0) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",__FILE__,__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.unicode = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.unicode,input.keysym.mod);
|
||||
|
||||
c = (SDLKey)input.keysym.unicode;
|
||||
// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
|
@ -875,18 +877,18 @@ SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
|||
|
||||
//c = toupper(c);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",__FILE__,__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF));
|
||||
}
|
||||
if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) {
|
||||
c = input.keysym.sym;
|
||||
}
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
//c = (SDLKey)(c & 0xFF);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",__FILE__,__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c);
|
||||
|
||||
string pressKeyName = SDL_GetKeyName((SDLKey)c);
|
||||
string inputKeyName = SDL_GetKeyName(input.keysym.sym);
|
||||
|
@ -894,8 +896,8 @@ SDLKey extractKeyPressed(SDL_KeyboardEvent input) {
|
|||
//printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n",
|
||||
// c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str());
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -954,8 +956,8 @@ bool isAllowedInputTextKey(wchar_t &key) {
|
|||
key != SDLK_POWER);
|
||||
|
||||
string inputKeyName = SDL_GetKeyName((SDLKey)key);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1014,8 +1016,8 @@ bool isAllowedInputTextKey(SDLKey key) {
|
|||
key != SDLK_POWER);
|
||||
|
||||
string inputKeyName = SDL_GetKeyName(key);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",__FILE__,__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -257,7 +257,15 @@ void init_win32() {
|
|||
|
||||
HWND hwnd = wminfo.window;
|
||||
|
||||
::SetClassLong(hwnd, GCL_HICON, (LONG) icon);
|
||||
#ifdef __MINGW32__
|
||||
#define GCL_HICON -14
|
||||
#endif
|
||||
|
||||
#ifndef __MINGW32__
|
||||
LONG iconPtr = (LONG)icon;
|
||||
|
||||
::SetClassLong(hwnd, GCL_HICON, iconPtr);
|
||||
#endif
|
||||
}
|
||||
void done_win32() {
|
||||
::DestroyIcon(icon);
|
||||
|
|
|
@ -13,7 +13,7 @@ INCLUDE_DIRECTORIES(
|
|||
|
||||
SET(STREFLOP_SRC ${STREFLOP_GLOBBED_CPP})
|
||||
# use SSE unconditionally (FIXME?)
|
||||
SET_SOURCE_FILES_PROPERTIES(${STREFLOP_SRC} PROPERTIES COMPILE_FLAGS "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32 -O3 ${CXXFLAGS}")
|
||||
#SET_SOURCE_FILES_PROPERTIES(${STREFLOP_SRC} PROPERTIES COMPILE_FLAGS "-DSTREFLOP_SSE -DLIBM_COMPILING_FLT32 -O3 ${CXXFLAGS}")
|
||||
|
||||
ADD_LIBRARY(streflop STATIC EXCLUDE_FROM_ALL
|
||||
${STREFLOP_SRC}
|
||||
|
|
|
@ -136,16 +136,19 @@ string doubleToStr(double d,int precsion) {
|
|||
}
|
||||
|
||||
bool IsNumeric(const char *p, bool allowNegative) {
|
||||
int index = 0;
|
||||
for ( ; *p; p++) {
|
||||
if (*p < '0' || *p > '9') {
|
||||
if(allowNegative == false || (*p != '-' && index == 0)) {
|
||||
return false;
|
||||
}
|
||||
if(p != NULL && strcmp(p,"-") == 0) {
|
||||
return false;
|
||||
}
|
||||
int index = 0;
|
||||
for ( ; *p; p++) {
|
||||
if (*p < '0' || *p > '9') {
|
||||
if(allowNegative == false || (*p != '-' && index == 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
class Comma: public numpunct<char>// own facet class
|
||||
|
|
|
@ -67,7 +67,7 @@ void Properties::load(const string &path, bool clearCurrentProperties) {
|
|||
#endif
|
||||
|
||||
if(fileStream.is_open() == false){
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",__FILE__,__FUNCTION__,__LINE__,path.c_str());
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] path = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str());
|
||||
throw runtime_error("File NOT FOUND, can't open file: [" + path + "]");
|
||||
}
|
||||
|
||||
|
@ -215,9 +215,9 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
|
|||
mapTagReplacementValues["{APPLICATIONPATH}"] = Properties::applicationPath;
|
||||
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
mapTagReplacementValues["$APPLICATIONDATAPATH"] = CUSTOM_DATA_INSTALL_PATH;
|
||||
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = CUSTOM_DATA_INSTALL_PATH;
|
||||
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = CUSTOM_DATA_INSTALL_PATH;
|
||||
mapTagReplacementValues["$APPLICATIONDATAPATH"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
|
||||
mapTagReplacementValues["%%APPLICATIONDATAPATH%%"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
|
||||
mapTagReplacementValues["{APPLICATIONDATAPATH}"] = TOSTRING(CUSTOM_DATA_INSTALL_PATH);
|
||||
|
||||
//mapTagReplacementValues["$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
|
||||
//mapTagReplacementValues["%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
|
||||
|
@ -308,9 +308,9 @@ bool Properties::applyTagsToValue(string &value, std::map<string,string> *mapTag
|
|||
replaceAll(value, "{APPLICATIONPATH}", Properties::applicationPath);
|
||||
|
||||
#if defined(CUSTOM_DATA_INSTALL_PATH)
|
||||
replaceAll(value, "$APPLICATIONDATAPATH", CUSTOM_DATA_INSTALL_PATH);
|
||||
replaceAll(value, "%%APPLICATIONDATAPATH%%", CUSTOM_DATA_INSTALL_PATH);
|
||||
replaceAll(value, "{APPLICATIONDATAPATH}", CUSTOM_DATA_INSTALL_PATH);
|
||||
replaceAll(value, "$APPLICATIONDATAPATH", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
|
||||
replaceAll(value, "%%APPLICATIONDATAPATH%%", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
|
||||
replaceAll(value, "{APPLICATIONDATAPATH}", TOSTRING(CUSTOM_DATA_INSTALL_PATH));
|
||||
|
||||
//replaceAll(value, "$COMMONDATAPATH", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
|
||||
//replaceAll(value, "%%COMMONDATAPATH%%", string(CUSTOM_DATA_INSTALL_PATH) + "/commondata/");
|
||||
|
@ -364,7 +364,7 @@ bool Properties::getBool(const string &key, const char *defaultValueIfNotFound)
|
|||
return strToBool(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ int Properties::getInt(const string &key,const char *defaultValueIfNotFound) con
|
|||
return strToInt(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ float Properties::getFloat(const string &key, const char *defaultValueIfNotFound
|
|||
return strToFloat(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -410,7 +410,7 @@ const string Properties::getString(const string &key, const char *defaultValueIf
|
|||
it= propertyMap.find(key);
|
||||
if(it==propertyMap.end()){
|
||||
if(defaultValueIfNotFound != NULL) {
|
||||
//printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",__FILE__,__FUNCTION__,__LINE__,defaultValueIfNotFound);
|
||||
//printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,defaultValueIfNotFound);
|
||||
return string(defaultValueIfNotFound);
|
||||
}
|
||||
else {
|
||||
|
@ -456,7 +456,7 @@ bool Properties::getBool(const char *key, const char *defaultValueIfNotFound) co
|
|||
return strToBool(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ int Properties::getInt(const char *key,const char *defaultValueIfNotFound) const
|
|||
return strToInt(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -476,7 +476,7 @@ float Properties::getFloat(const char *key, const char *defaultValueIfNotFound)
|
|||
return strToFloat(getString(key,defaultValueIfNotFound));
|
||||
}
|
||||
catch(exception &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what());
|
||||
throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]");
|
||||
}
|
||||
}
|
||||
|
@ -486,7 +486,7 @@ const string Properties::getString(const char *key, const char *defaultValueIfNo
|
|||
it= propertyMap.find(key);
|
||||
if(it==propertyMap.end()){
|
||||
if(defaultValueIfNotFound != NULL) {
|
||||
//printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",__FILE__,__FUNCTION__,__LINE__,defaultValueIfNotFound);
|
||||
//printf("In [%s::%s - %d]defaultValueIfNotFound = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,defaultValueIfNotFound);
|
||||
return string(defaultValueIfNotFound);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -70,7 +70,7 @@ XmlIo::XmlIo() {
|
|||
XmlIo::initialized= true;
|
||||
}
|
||||
catch(const XMLException &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",__FILE__,__FUNCTION__,__LINE__,e.getMessage());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error initializing XML system, msg %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.getMessage());
|
||||
throw runtime_error("Error initializing XML system");
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ XmlIo::XmlIo() {
|
|||
implementation = DOMImplementationRegistry::getDOMImplementation(str);
|
||||
}
|
||||
catch(const DOMException &ex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n",__FILE__,__FUNCTION__,__LINE__,ex.getMessage());
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.getMessage());
|
||||
throw runtime_error("Exception while creating XML parser");
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,7 @@ XmlNode *XmlIo::load(const string &path, std::map<string,string> mapTagReplaceme
|
|||
return rootNode;
|
||||
}
|
||||
catch(const DOMException &ex) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while loading: [%s], %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(ex.msg));
|
||||
throw runtime_error("Exception while loading: " + path + ": " + XMLString::transcode(ex.msg));
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void XmlIo::save(const string &path, const XmlNode *node){
|
|||
document->release();
|
||||
}
|
||||
catch(const DOMException &e){
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while saving: [%s], %s\n",__FILE__,__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(e.msg));
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Exception while saving: [%s], %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str(),XMLString::transcode(e.msg));
|
||||
throw runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg));
|
||||
}
|
||||
}
|
||||
|
@ -191,6 +191,8 @@ typedef std::vector<XmlTree*> LoadStack;
|
|||
static string loadStackCacheName = string(__FILE__) + string("_loadStackCacheName");
|
||||
|
||||
void XmlTree::load(const string &path, std::map<string,string> mapTagReplacementValues) {
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str());
|
||||
|
||||
//printf("XmlTree::load p [%p]\n",this);
|
||||
assert(!loadPath.size());
|
||||
|
||||
|
@ -208,6 +210,8 @@ void XmlTree::load(const string &path, std::map<string,string> mapTagReplacement
|
|||
|
||||
loadPath = path;
|
||||
this->rootNode= XmlIo::getInstance().load(path, mapTagReplacementValues);
|
||||
|
||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] about to load [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,path.c_str());
|
||||
}
|
||||
|
||||
void XmlTree::save(const string &path){
|
||||
|
|
Loading…
Reference in New Issue