mirror of
https://github.com/glest/glest-source.git
synced 2025-08-28 18:29:48 +02:00
- fixed TOM's game loading screen mouse click problem
This commit is contained in:
@@ -242,6 +242,8 @@ void Game::load(){
|
|||||||
|
|
||||||
//throw runtime_error("Test!");
|
//throw runtime_error("Test!");
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
//tileset
|
//tileset
|
||||||
@@ -249,7 +251,7 @@ void Game::load(){
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -265,7 +267,7 @@ void Game::load(){
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -274,7 +276,7 @@ void Game::load(){
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
@@ -286,7 +288,7 @@ void Game::load(){
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
//good_fpu_control_registers(NULL,__FILE__,__FUNCTION__,__LINE__);
|
//good_fpu_control_registers(NULL,__FILE__,__FUNCTION__,__LINE__);
|
||||||
@@ -315,13 +317,13 @@ void Game::init()
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
world.init(this, gameSettings.getDefaultUnits());
|
world.init(this, gameSettings.getDefaultUnits());
|
||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
gui.init(this);
|
gui.init(this);
|
||||||
|
|
||||||
@@ -338,7 +340,7 @@ void Game::init()
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
scriptManager.init(&world, &gameCamera);
|
scriptManager.init(&world, &gameCamera);
|
||||||
|
|
||||||
@@ -361,7 +363,7 @@ void Game::init()
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
//wheather particle systems
|
//wheather particle systems
|
||||||
if(world.getTileset()->getWeather() == wRainy){
|
if(world.getTileset()->getWeather() == wRainy){
|
||||||
@@ -389,7 +391,7 @@ void Game::init()
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
//sounds
|
//sounds
|
||||||
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
|
||||||
|
@@ -264,18 +264,36 @@ void Program::resize(SizeState sizeState){
|
|||||||
|
|
||||||
// ==================== misc ====================
|
// ==================== misc ====================
|
||||||
|
|
||||||
|
//Your filter function should look something like:
|
||||||
|
int SDLEventFilter(const SDL_Event* filterEvent) {
|
||||||
|
if(filterEvent->type == SDL_KEYDOWN || /**< Keys pressed */
|
||||||
|
filterEvent->type == SDL_KEYUP || /**< Keys released */
|
||||||
|
filterEvent->type == SDL_MOUSEMOTION || /**< Mouse moved */
|
||||||
|
filterEvent->type == SDL_MOUSEBUTTONDOWN || /**< Mouse button pressed */
|
||||||
|
filterEvent->type == SDL_MOUSEBUTTONUP) /**< Mouse button released */
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void Program::setState(ProgramState *programState, bool cleanupOldState)
|
void Program::setState(ProgramState *programState, bool cleanupOldState)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
if(dynamic_cast<Game *>(programState) != NULL) {
|
||||||
int X = 0;
|
int X = 0;
|
||||||
int Y = 0;
|
int Y = 0;
|
||||||
SDL_GetMouseState(&X,&Y);
|
SDL_GetMouseState(&X,&Y);
|
||||||
programState->setStartXY(X,Y);
|
programState->setStartXY(X,Y);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
|
|
||||||
showCursor(true);
|
showCursor(true);
|
||||||
|
SDL_PumpEvents();
|
||||||
sleep(0);
|
sleep(0);
|
||||||
|
}
|
||||||
|
|
||||||
if(cleanupOldState == true) {
|
if(cleanupOldState == true) {
|
||||||
if(this->programState != programState) {
|
if(this->programState != programState) {
|
||||||
|
@@ -51,6 +51,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
for(int i=0; i<unitTypes.size(); ++i){
|
for(int i=0; i<unitTypes.size(); ++i){
|
||||||
string str= dir + "/units/" + unitFilenames[i];
|
string str= dir + "/units/" + unitFilenames[i];
|
||||||
unitTypes[i].preLoad(str);
|
unitTypes[i].preLoad(str);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// a2) preload upgrades
|
// a2) preload upgrades
|
||||||
@@ -61,6 +63,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
for(int i=0; i<upgradeTypes.size(); ++i){
|
for(int i=0; i<upgradeTypes.size(); ++i){
|
||||||
string str= dir + "/upgrades/" + upgradeFilenames[i];
|
string str= dir + "/upgrades/" + upgradeFilenames[i];
|
||||||
upgradeTypes[i].preLoad(str);
|
upgradeTypes[i].preLoad(str);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// b1) load units
|
// b1) load units
|
||||||
@@ -68,6 +72,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
for(int i=0; i<unitTypes.size(); ++i){
|
for(int i=0; i<unitTypes.size(); ++i){
|
||||||
string str= dir + "/units/" + unitTypes[i].getName();
|
string str= dir + "/units/" + unitTypes[i].getName();
|
||||||
unitTypes[i].load(i, str, techTree, this, checksum);
|
unitTypes[i].load(i, str, techTree, this, checksum);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &e){
|
catch(const exception &e){
|
||||||
@@ -79,6 +85,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
for(int i=0; i<upgradeTypes.size(); ++i){
|
for(int i=0; i<upgradeTypes.size(); ++i){
|
||||||
string str= dir + "/upgrades/" + upgradeTypes[i].getName();
|
string str= dir + "/upgrades/" + upgradeTypes[i].getName();
|
||||||
upgradeTypes[i].load(str, techTree, this, checksum);
|
upgradeTypes[i].load(str, techTree, this, checksum);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &e){
|
catch(const exception &e){
|
||||||
@@ -102,6 +110,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
string name= resourceNode->getAttribute("name")->getRestrictedValue();
|
||||||
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
int amount= resourceNode->getAttribute("amount")->getIntValue();
|
||||||
startingResources[i].init(techTree->getResourceType(name), amount);
|
startingResources[i].init(techTree->getResourceType(name), amount);
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
//read starting units
|
//read starting units
|
||||||
@@ -111,6 +121,8 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
string name= unitNode->getAttribute("name")->getRestrictedValue();
|
||||||
int amount= unitNode->getAttribute("amount")->getIntValue();
|
int amount= unitNode->getAttribute("amount")->getIntValue();
|
||||||
startingUnits.push_back(PairPUnitTypeInt(getUnitType(name), amount));
|
startingUnits.push_back(PairPUnitTypeInt(getUnitType(name), amount));
|
||||||
|
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
//read music
|
//read music
|
||||||
|
@@ -60,6 +60,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
for(int i=0; i<filenames.size(); ++i){
|
for(int i=0; i<filenames.size(); ++i){
|
||||||
str=dir+"/resources/"+filenames[i];
|
str=dir+"/resources/"+filenames[i];
|
||||||
resourceTypes[i].load(str, checksum);
|
resourceTypes[i].load(str, checksum);
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &e){
|
catch(const exception &e){
|
||||||
@@ -68,7 +69,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
//load tech tree xml info
|
//load tech tree xml info
|
||||||
try{
|
try{
|
||||||
@@ -87,6 +88,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
const XmlNode *attackTypeNode= attackTypesNode->getChild("attack-type", i);
|
const XmlNode *attackTypeNode= attackTypesNode->getChild("attack-type", i);
|
||||||
attackTypes[i].setName(attackTypeNode->getAttribute("name")->getRestrictedValue());
|
attackTypes[i].setName(attackTypeNode->getAttribute("name")->getRestrictedValue());
|
||||||
attackTypes[i].setId(i);
|
attackTypes[i].setId(i);
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
@@ -100,6 +102,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
const XmlNode *armorTypeNode= armorTypesNode->getChild("armor-type", i);
|
const XmlNode *armorTypeNode= armorTypesNode->getChild("armor-type", i);
|
||||||
armorTypes[i].setName(armorTypeNode->getAttribute("name")->getRestrictedValue());
|
armorTypes[i].setName(armorTypeNode->getAttribute("name")->getRestrictedValue());
|
||||||
armorTypes[i].setId(i);
|
armorTypes[i].setId(i);
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
//damage multipliers
|
//damage multipliers
|
||||||
@@ -111,6 +114,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
const ArmorType *armorType= getArmorType(damageMultiplierNode->getAttribute("armor")->getRestrictedValue());
|
const ArmorType *armorType= getArmorType(damageMultiplierNode->getAttribute("armor")->getRestrictedValue());
|
||||||
float multiplier= damageMultiplierNode->getAttribute("value")->getFloatValue();
|
float multiplier= damageMultiplierNode->getAttribute("value")->getFloatValue();
|
||||||
damageMultiplierTable.setDamageMultiplier(attackType, armorType, multiplier);
|
damageMultiplierTable.setDamageMultiplier(attackType, armorType, multiplier);
|
||||||
|
SDL_PumpEvents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(const exception &e){
|
catch(const exception &e){
|
||||||
@@ -139,7 +143,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
|
|
||||||
// give CPU time to update other things to avoid apperance of hanging
|
// give CPU time to update other things to avoid apperance of hanging
|
||||||
sleep(0);
|
sleep(0);
|
||||||
//SDL_PumpEvents();
|
SDL_PumpEvents();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user