mirror of
https://github.com/glest/glest-source.git
synced 2025-08-18 06:01:17 +02:00
- 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:
@@ -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){
|
||||
|
Reference in New Issue
Block a user