From: <au...@us...> - 2009-12-22 20:25:18
|
Revision: 4340 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=4340&view=rev Author: auria Date: 2009-12-22 20:25:08 +0000 (Tue, 22 Dec 2009) Log Message: ----------- Better documented previosu changes Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2009-12-22 20:18:22 UTC (rev 4339) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2009-12-22 20:25:08 UTC (rev 4340) @@ -44,6 +44,9 @@ void MainMenuScreen::init() { + // on most circumstances, the RaceManager will take care of foing this. + // but e.g. if the player clicks on new game then backs, this needs to happen here + StateManager::get()->resetActivePlayers(); input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); input_manager->setMasterPlayerOnly(false); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-07-01 00:35:05
|
Revision: 5602 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5602&view=rev Author: auria Date: 2010-07-01 00:34:59 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Removed the include to pthread in the main screen, it's not used. Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-07-01 00:16:09 UTC (rev 5601) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-07-01 00:34:59 UTC (rev 5602) @@ -19,9 +19,9 @@ #include <iostream> #include <string> -#ifdef ADDONS_MANAGER -# include <pthread.h> -#endif +//#ifdef ADDONS_MANAGER +//# include <pthread.h> +//#endif #include "guiengine/widgets.hpp" #include "karts/kart_properties_manager.hpp" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-07-03 23:49:01
|
Revision: 5622 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5622&view=rev Author: auria Date: 2010-07-03 23:48:54 +0000 (Sat, 03 Jul 2010) Log Message: ----------- Fixed potential crash in add-ons code Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-07-02 23:14:44 UTC (rev 5621) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-07-03 23:48:54 UTC (rev 5622) @@ -64,19 +64,23 @@ void MainMenuScreen::downloadRss() { LabelWidget* w = this->getWidget<LabelWidget>("info_addons"); - FILE* fichier = NULL; - char chaine[1000] = ""; - fichier = fopen(std::string(file_manager->getConfigDir() + "/news").c_str(), "r+"); - + FILE* newsFile = NULL; + char buffer[1024] = ""; + newsFile = fopen(std::string(file_manager->getConfigDir() + "/news").c_str(), "r+"); + if (newsFile == NULL) + { + fprintf(stderr, "Warning: cannot open new files\n"); + return; + } + std::string info = std::string(""); - while (fgets(chaine, 1000, fichier) != NULL) // On lit le fichier tant qu'on ne reçoit pas d'erreur (NULL) + while (fgets(buffer, 1024, newsFile) != NULL) { - info += std::string(chaine); + info += std::string(buffer); } - - - fclose(fichier); + fclose(newsFile); + // to remove the break line. //info.replace(info.size()-1,1, ""); std::cout << info << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-08-08 00:59:25
|
Revision: 5729 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=5729&view=rev Author: auria Date: 2010-08-08 00:59:19 +0000 (Sun, 08 Aug 2010) Log Message: ----------- Documented problem Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-07 01:59:44 UTC (rev 5728) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-08-08 00:59:19 UTC (rev 5729) @@ -215,6 +215,9 @@ // ------------------------------------------------------------------------------------------------------ void * MainMenuScreen::downloadNews( void * pthis) { + // FIXME: this code is wrong, "pt" might have been deleted by the + // time the download is done (by having switched to another screen, + // or exiting the game, etc...) MainMenuScreen * pt = (MainMenuScreen*)pthis; if(download("news")) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-19 18:21:26
|
Revision: 6064 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6064&view=rev Author: auria Date: 2010-09-19 18:21:20 +0000 (Sun, 19 Sep 2010) Log Message: ----------- Removed reference to removed kart in test screen Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-19 17:22:49 UTC (rev 6063) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-19 18:21:20 UTC (rev 6064) @@ -177,7 +177,7 @@ else if (i % 4 == 2) { GrandPrixWin* scene = GrandPrixWin::getInstance(); - const std::string winners[] = { "mriceblock", "nolok", "pidgin" }; + const std::string winners[] = { "tux", "nolok", "pidgin" }; StateManager::get()->pushScreen(scene); scene->setKarts( winners ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-25 18:09:12
|
Revision: 6144 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6144&view=rev Author: auria Date: 2010-09-25 18:09:06 +0000 (Sat, 25 Sep 2010) Log Message: ----------- Fix thread cancellation Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-25 13:48:41 UTC (rev 6143) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-25 18:09:06 UTC (rev 6144) @@ -108,11 +108,16 @@ void MainMenuScreen::init() { Screen::init(); + // reset in case we're coming back from a race StateManager::get()->resetActivePlayers(); input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); input_manager->setMasterPlayerOnly(false); + #ifdef ADDONS_MANAGER + // FIXME: this is wrong, init may be called several times in the object's + // lifespan, and the pthread docs state that initing several times the same + // mutex can cause undefined behavior pthread_mutex_init(&(this->m_mutex_news_text), NULL); pthread_create(&m_thread_news_text, NULL, &MainMenuScreen::downloadNews, this); #endif @@ -231,15 +236,25 @@ // ------------------------------------------------------------------------------------------------------ void * MainMenuScreen::downloadNews( void * pthis) { + // enable thread to be cancelled + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + // FIXME: this code is wrong, "pt" might have been deleted by the // time the download is done (by having switched to another screen, // or exiting the game, etc...) MainMenuScreen * pt = (MainMenuScreen*)pthis; - if(download("news")) + if (download("news")) + { + pthread_testcancel(); // check if thread was cancelled pt->changeNewsText("news"); + } else + { + pthread_testcancel(); // check if thread was cancelled pt->changeNewsText("offline"); + } return NULL; } #endif @@ -247,7 +262,7 @@ #ifdef ADDONS_MANAGER void MainMenuScreen::tearDown() { - fprintf(stdout, "canceling the thread"); + fprintf(stdout, "canceling the thread\n"); pthread_cancel(m_thread_news_text); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-27 01:27:12
|
Revision: 6154 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6154&view=rev Author: auria Date: 2010-09-27 01:27:06 +0000 (Mon, 27 Sep 2010) Log Message: ----------- Fix more potential crash at shutdown regarding with add-on threads Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-26 22:44:23 UTC (rev 6153) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-27 01:27:06 UTC (rev 6154) @@ -67,7 +67,10 @@ { FILE* newsFile = NULL; char buffer[1024] = ""; + + pthread_testcancel(); // check if thread was cancelled newsFile = fopen(std::string(file_manager->getConfigDir() + "/news").c_str(), "r+"); + if (newsFile == NULL) { fprintf(stderr, "Warning: cannot open news files\n"); @@ -82,6 +85,7 @@ fclose(newsFile); + pthread_testcancel(); // check if thread was cancelled // to remove the break line. //info.replace(info.size()-1,1, ""); //std::cout << info << std::endl; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-09-27 15:46:30
|
Revision: 6156 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6156&view=rev Author: auria Date: 2010-09-27 15:46:24 +0000 (Mon, 27 Sep 2010) Log Message: ----------- More minor changes to make sure crashes don't occur due to the thread in the main screen Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-27 12:15:19 UTC (rev 6155) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-09-27 15:46:24 UTC (rev 6156) @@ -95,6 +95,7 @@ } if(action == "offline") { + pthread_testcancel(); // check if thread was cancelled pthread_mutex_lock(&(this->m_mutex_news_text)); m_news_text = "offline"; pthread_mutex_unlock(&(this->m_mutex_news_text)); @@ -267,6 +268,12 @@ void MainMenuScreen::tearDown() { fprintf(stdout, "canceling the thread\n"); + + // grab the mutex before returning to make sure the screen is not deleted while the thread is + // changing the text, which would result in weird results (tearDown does not automatically mean + // the screen is going to be destroyed but let's play on the safe side) + pthread_mutex_lock(&(this->m_mutex_news_text)); pthread_cancel(m_thread_news_text); + pthread_mutex_unlock(&(this->m_mutex_news_text)); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2010-10-03 18:56:32
|
Revision: 6206 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6206&view=rev Author: auria Date: 2010-10-03 18:56:26 +0000 (Sun, 03 Oct 2010) Log Message: ----------- Possibly fixed another thread-related bug Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-10-03 18:46:08 UTC (rev 6205) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-10-03 18:56:26 UTC (rev 6206) @@ -69,6 +69,11 @@ char buffer[1024] = ""; pthread_testcancel(); // check if thread was cancelled + + // enter the mutex; this will prevent the shutdown procedure + // from continuing until this critical section is over + pthread_mutex_lock(&(this->m_mutex_news_text)); + newsFile = fopen(std::string(file_manager->getConfigDir() + "/news").c_str(), "r+"); if (newsFile == NULL) @@ -85,11 +90,6 @@ fclose(newsFile); - pthread_testcancel(); // check if thread was cancelled - // to remove the break line. - //info.replace(info.size()-1,1, ""); - //std::cout << info << std::endl; - pthread_mutex_lock(&(this->m_mutex_news_text)); m_news_text = std::string(info).c_str(); pthread_mutex_unlock(&(this->m_mutex_news_text)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2010-10-12 10:06:46
|
Revision: 6276 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=6276&view=rev Author: hikerstk Date: 2010-10-12 10:06:37 +0000 (Tue, 12 Oct 2010) Log Message: ----------- Fixed debug display of unlocked GP: beach track was removed so displaying the beach screenshot failed. Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2010-10-12 10:01:52 UTC (rev 6275) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2010-10-12 10:06:37 UTC (rev 6276) @@ -171,7 +171,7 @@ { std::vector<video::ITexture*> textures; textures.push_back(irr_driver->getTexture(track_manager->getTrack("lighthouse")->getScreenshotFile().c_str())); - textures.push_back(irr_driver->getTexture(track_manager->getTrack("beach")->getScreenshotFile().c_str())); + textures.push_back(irr_driver->getTexture(track_manager->getTrack("crescentcrossing")->getScreenshotFile().c_str())); textures.push_back(irr_driver->getTexture(track_manager->getTrack("sandtrack")->getScreenshotFile().c_str())); textures.push_back(irr_driver->getTexture(track_manager->getTrack("snowmountain")->getScreenshotFile().c_str())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-01-15 21:57:20
|
Revision: 7431 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7431&view=rev Author: auria Date: 2011-01-15 21:57:14 +0000 (Sat, 15 Jan 2011) Log Message: ----------- More improvements to lang menu, namely select the proper entry when opening Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-15 21:49:15 UTC (rev 7430) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-15 21:57:14 UTC (rev 7431) @@ -154,68 +154,53 @@ if (ribbon == NULL) { // Language selection combo - if (name == "lang_combo" && m_lang_popup == NULL) + if (name == "lang_combo") { - // When the combo is clicked, show a pop-up list with the choices - IconButtonWidget* lang_combo = this->getWidget<IconButtonWidget>("lang_combo"); - - m_lang_popup = new ListWidget(); - m_lang_popup->m_properties[PROP_ID] = "lang_popup"; - const core::dimension2d<u32> frame_size = irr_driver->getFrameSize(); - - const int width = frame_size.Width*0.4f; - - const int MARGIN_ABOVE_POPUP = 50; - const int CLEAR_BOTTOM = 15; + if (m_lang_popup == NULL) + { + // When the combo is clicked, show a pop-up list with the choices + IconButtonWidget* lang_combo = this->getWidget<IconButtonWidget>("lang_combo"); + + m_lang_popup = new ListWidget(); + m_lang_popup->m_properties[PROP_ID] = "lang_popup"; + const core::dimension2d<u32> frame_size = irr_driver->getFrameSize(); + + const int width = frame_size.Width*0.4f; + + const int MARGIN_ABOVE_POPUP = 50; + const int CLEAR_BOTTOM = 15; - const int height = lang_combo->m_y - MARGIN_ABOVE_POPUP - CLEAR_BOTTOM; - - m_lang_popup->m_x = lang_combo->m_x; - m_lang_popup->m_y = lang_combo->m_y - height - CLEAR_BOTTOM; - m_lang_popup->m_w = width; - m_lang_popup->m_h = height; - - m_lang_popup->add(); + const int height = lang_combo->m_y - MARGIN_ABOVE_POPUP - CLEAR_BOTTOM; + + m_lang_popup->m_x = lang_combo->m_x; + m_lang_popup->m_y = lang_combo->m_y - height - CLEAR_BOTTOM; + m_lang_popup->m_w = width; + m_lang_popup->m_h = height; + + m_lang_popup->add(); - m_lang_popup->m_properties[PROP_ID] = "language_popup"; - - // I18N: in the language choice, to select the same language as the OS - m_lang_popup->addItem("system", _("System Language")); + m_lang_popup->m_properties[PROP_ID] = "language_popup"; + + // I18N: in the language choice, to select the same language as the OS + m_lang_popup->addItem("system", _("System Language")); - const std::vector<std::string>* lang_list = translations->getLanguageList(); - const int amount = lang_list->size(); - for (int n=0; n<amount; n++) + const std::vector<std::string>* lang_list = translations->getLanguageList(); + const int amount = lang_list->size(); + for (int n=0; n<amount; n++) + { + // TODO: retrieve a nice name for each language instead of displaying the language code + m_lang_popup->addItem((*lang_list)[n], core::stringw((*lang_list)[n].c_str())); + } + + manualAddWidget(m_lang_popup); + + m_lang_popup->setSelectionID( m_lang_popup->getItemID(UserConfigParams::m_language) ); + m_lang_popup->setFocusForPlayer(PLAYER_ID_GAME_MASTER); + } + else { - // TODO: retrieve a nice name for each language instead of displaying the language code - m_lang_popup->addItem((*lang_list)[n], core::stringw((*lang_list)[n].c_str())); + closeLangPopup(); } - /* - m_lang_popup->addItem("en", L"English"); - m_lang_popup->addItem("zh_CN", L"Chinese"); - m_lang_popup->addItem("ru", L"Russian"); - m_lang_popup->addItem("fr", L"French"); - m_lang_popup->addItem("he", L"Hebrew"); - */ - manualAddWidget(m_lang_popup); - - m_lang_popup->setFocusForPlayer(PLAYER_ID_GAME_MASTER); - m_lang_popup->setSelectionID(0); // TODO: select current language, not first - - /* - delete translations; - static int cycle = 0; - cycle++; - if (cycle > 5) cycle = 1; - - if (cycle == 1) putenv("LANGUAGE=he"); - if (cycle == 2) putenv("LANGUAGE=zh_CN"); - if (cycle == 3) putenv("LANGUAGE=fr"); - if (cycle == 4) putenv("LANGUAGE=ru"); - if (cycle == 5) putenv("LANGUAGE=en"); - - translations = new Translations(); - GUIEngine::getStateManager()->hardResetAndGoToScreen<MainMenuScreen>(); - */ } else if (name == "language_popup") { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-01-20 03:03:53
|
Revision: 7489 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7489&view=rev Author: auria Date: 2011-01-20 03:03:47 +0000 (Thu, 20 Jan 2011) Log Message: ----------- Improve lang popup behavir, do not close when moving mouse to scrollbar Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-20 02:49:36 UTC (rev 7488) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-20 03:03:47 UTC (rev 7489) @@ -134,9 +134,16 @@ video::SColor(255,0,0,0), true /* hcenter */, true /* vcenter */); // Close popup when focus lost - if (m_lang_popup != NULL && !m_lang_popup->isFocusedForPlayer(PLAYER_ID_GAME_MASTER)) + if (m_lang_popup != NULL) { - closeLangPopup(); + Widget* focus = GUIEngine::getFocusForPlayer(PLAYER_ID_GAME_MASTER); + const core::position2d<s32> mouse = irr_driver->getDevice()->getCursorControl()->getPosition(); + if (mouse.X < m_lang_popup->m_x - 50 || mouse.X > m_lang_popup->m_x + m_lang_popup->m_w + 50 || + mouse.Y < m_lang_popup->m_y - 50 || // we don't check if mouse Y is too large because the mouse will come from the bottom + (focus != NULL && focus->getType() == WTYPE_RIBBON)) + { + closeLangPopup(); + } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-01-23 02:51:34
|
Revision: 7500 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7500&view=rev Author: auria Date: 2011-01-23 02:51:28 +0000 (Sun, 23 Jan 2011) Log Message: ----------- Work around to prevent clicking through lang popup Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-23 02:48:46 UTC (rev 7499) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-01-23 02:51:28 UTC (rev 7500) @@ -234,6 +234,14 @@ return; } + // When the lang popup is shown, ignore all other widgets + // FIXME: for some reasons, irrlicht widgets appear to be click-through, this is why + // this hack is needed + if (m_lang_popup != NULL) + { + return; + } + // ---- A ribbon icon was clicked std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2011-02-04 01:59:06
|
Revision: 7607 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7607&view=rev Author: hikerstk Date: 2011-02-04 01:59:00 +0000 (Fri, 04 Feb 2011) Log Message: ----------- Fixed language changing on linux (putenv does not copy the environment variables, so the setting got lost, so I replaced this with setenv. Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-04 00:34:33 UTC (rev 7606) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-04 01:59:00 UTC (rev 7607) @@ -217,19 +217,13 @@ delete translations; -#ifdef WIN32 - // Avoid depreciation warnings in windows. -# define putenv(a) _putenv(a) -#endif if (selection == "system") { - putenv( "LANGUAGE=" ); + setenv( "LANGUAGE=", "", 1); } else { - char buffer[1024]; - snprintf(buffer, 1024, "LANGUAGE=%s", selection.c_str()); - putenv( buffer ); + setenv("LANGUAGE", selection.c_str(), 1); } translations = new Translations(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2011-02-04 02:07:48
|
Revision: 7608 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7608&view=rev Author: hikerstk Date: 2011-02-04 02:07:39 +0000 (Fri, 04 Feb 2011) Log Message: ----------- Replaced tabs with spaces, fixed windows compilation (though live language switch still doesn't work). Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-04 01:59:00 UTC (rev 7607) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-04 02:07:39 UTC (rev 7608) @@ -82,20 +82,20 @@ input_manager->getDeviceList()->setAssignMode(NO_ASSIGN); input_manager->getDeviceList()->setSinglePlayer( NULL ); input_manager->setMasterPlayerOnly(false); - - // Avoid incorrect behaviour in certain race circumstances: - // If a multi-player game is played with two keyboards, the 2nd - // player selects his kart last, and only the keyboard is used - // to select all other settings - then if the next time the kart - // selection screen comes up, the default device will still be - // the 2nd player. So if the first player presses 'select', it - // will instead add a second player (so basically the key - // binding for the second player become the default, so pressing - // select will add a new player). See bug 3090931 - // To avoid this, we will clean the last used device, making - // the key bindings for the first player the default again. - input_manager->getDeviceList()->clearLatestUsedDevice(); + // Avoid incorrect behaviour in certain race circumstances: + // If a multi-player game is played with two keyboards, the 2nd + // player selects his kart last, and only the keyboard is used + // to select all other settings - then if the next time the kart + // selection screen comes up, the default device will still be + // the 2nd player. So if the first player presses 'select', it + // will instead add a second player (so basically the key + // binding for the second player become the default, so pressing + // select will add a new player). See bug 3090931 + // To avoid this, we will clean the last used device, making + // the key bindings for the first player the default again. + input_manager->getDeviceList()->clearLatestUsedDevice(); + #ifdef ADDONS_MANAGER if(!addons_manager->onlineReady()) { @@ -219,11 +219,19 @@ if (selection == "system") { - setenv( "LANGUAGE=", "", 1); +#ifdef WIN32 + SetEnvironmentVariableA("LANGUAGE", ""); +#else + setenv( "LANGUAGE=", "", 1); +#endif } else { - setenv("LANGUAGE", selection.c_str(), 1); +#ifdef WIN32 + SetEnvironmentVariableA("LANGUAGE", selection.c_str()); +#else + setenv("LANGUAGE", selection.c_str(), 1); +#endif } translations = new Translations(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-02-23 02:00:36
|
Revision: 7750 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=7750&view=rev Author: auria Date: 2011-02-23 02:00:30 +0000 (Wed, 23 Feb 2011) Log Message: ----------- Fixed system language Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-22 21:38:49 UTC (rev 7749) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-02-23 02:00:30 UTC (rev 7750) @@ -222,7 +222,7 @@ #ifdef WIN32 SetEnvironmentVariableA("LANGUAGE", ""); #else - setenv( "LANGUAGE=", "", 1); + setenv( "LANGUAGE", "", 1); #endif } else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-04-01 00:34:48
|
Revision: 8163 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=8163&view=rev Author: auria Date: 2011-04-01 00:34:41 +0000 (Fri, 01 Apr 2011) Log Message: ----------- Add include Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-01 00:27:58 UTC (rev 8162) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-01 00:34:41 UTC (rev 8163) @@ -20,6 +20,7 @@ #include <iostream> #include <string> +#include "graphics/irr_driver.hpp" #include "guiengine/scalable_font.hpp" #include "guiengine/widgets/label_widget.hpp" #include "guiengine/widgets/list_widget.hpp" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-04-06 23:19:16
|
Revision: 8230 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=8230&view=rev Author: auria Date: 2011-04-06 23:19:10 +0000 (Wed, 06 Apr 2011) Log Message: ----------- Language combo may now extend as needed Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-06 22:45:23 UTC (rev 8229) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-06 23:19:10 UTC (rev 8230) @@ -137,12 +137,39 @@ irr::gui::ScalableFont* font = GUIEngine::getFont(); // I18N: Enter the name of YOUR language here, do not literally translate the word "English" - font->draw(_("English"), - core::rect<s32>(lang_combo->m_x, lang_combo->m_y, - (int)(lang_combo->m_x - + lang_combo->m_w*0.9f), // multiply to not go over combo arrow + core::stringw language_name = _("English"); + + const int LEFT_MARGIN = 5; + const int arrow_width = lang_combo->m_h*0.6f; // the arrow is about half wide as the combo is high + + // Below is a not-too-pretty hack. When language name is too long to fit the space allocated by the STK + // widget, resize the irrlicht element (but don't resize the STK widget on top of it, because we don't + // want the change of size to be permanent - if we switch back to another language the combo needs + // to shrink back) + int element_width = lang_combo->getIrrlichtElement()->getRelativePosition().getWidth(); + const int text_w = (int)font->getDimension(language_name.c_str()).Width; + const int needed_additional_space = text_w - (element_width - arrow_width - LEFT_MARGIN); + if (needed_additional_space > 0) + { + // language name too long to fit + gui::IGUIElement* el = lang_combo->getIrrlichtElement(); + core::recti pos = el->getRelativePosition(); + pos.UpperLeftCorner.X -= needed_additional_space; + el->setRelativePosition( pos ); + } + + element_width = lang_combo->getIrrlichtElement()->getRelativePosition().getWidth(); + + const int elem_x = lang_combo->getIrrlichtElement()->getRelativePosition().UpperLeftCorner.X; + font->draw(language_name, + core::rect<s32>(elem_x + LEFT_MARGIN, + lang_combo->m_y, + // don't go over combo arrow + (int)(elem_x + LEFT_MARGIN + (element_width - arrow_width)), lang_combo->m_y + lang_combo->m_h), - video::SColor(255,0,0,0), true /* hcenter */, true /* vcenter */); + // center horizontally only if there is enough room, irrlicht's centering algorithm + // seems to give weird results when space is too tight + video::SColor(255,0,0,0), (element_width - text_w > 5) /* hcenter */, true /* vcenter */); // Close popup when focus lost if (m_lang_popup != NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hik...@us...> - 2011-04-07 06:43:41
|
Revision: 8240 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=8240&view=rev Author: hikerstk Date: 2011-04-07 06:43:33 +0000 (Thu, 07 Apr 2011) Log Message: ----------- Fixed compiler warning. Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-07 01:45:45 UTC (rev 8239) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-07 06:43:33 UTC (rev 8240) @@ -140,7 +140,7 @@ core::stringw language_name = _("English"); const int LEFT_MARGIN = 5; - const int arrow_width = lang_combo->m_h*0.6f; // the arrow is about half wide as the combo is high + const int arrow_width = (int)(lang_combo->m_h*0.6f); // the arrow is about half wide as the combo is high // Below is a not-too-pretty hack. When language name is too long to fit the space allocated by the STK // widget, resize the irrlicht element (but don't resize the STK widget on top of it, because we don't This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-04-07 19:15:12
|
Revision: 8246 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=8246&view=rev Author: auria Date: 2011-04-07 19:15:06 +0000 (Thu, 07 Apr 2011) Log Message: ----------- Nicer language menu (show languages names) Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-07 19:07:12 UTC (rev 8245) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-07 19:15:06 UTC (rev 8246) @@ -228,8 +228,10 @@ const int amount = lang_list->size(); for (int n=0; n<amount; n++) { - // TODO: retrieve a nice name for each language instead of displaying the language code - m_lang_popup->addItem((*lang_list)[n], core::stringw((*lang_list)[n].c_str())); + std::string code_name = (*lang_list)[n]; + std::string nice_name = tinygettext::Language::from_name(code_name.c_str()).get_name(); + m_lang_popup->addItem(code_name, core::stringw(code_name.c_str()) + " (" + + nice_name.c_str() + ")"); } manualAddWidget(m_lang_popup); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-04-22 23:40:34
|
Revision: 8420 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=8420&view=rev Author: auria Date: 2011-04-22 23:40:26 +0000 (Fri, 22 Apr 2011) Log Message: ----------- Clean a bit the code for debug menu items Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-22 23:34:48 UTC (rev 8419) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-04-22 23:40:26 UTC (rev 8420) @@ -15,6 +15,8 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#define DEBUG_MENU_ITEM 0 + #include "states_screens/main_menu_screen.hpp" #include <iostream> @@ -39,9 +41,11 @@ #include "states_screens/state_manager.hpp" #include "states_screens/tutorial_screen.hpp" -//#include "states_screens/feature_unlocked.hpp" -//#include "states_screens/grand_prix_lose.hpp" -//#include "states_screens/grand_prix_win.hpp" +#if DEBUG_MENU_ITEM +#include "states_screens/feature_unlocked.hpp" +#include "states_screens/grand_prix_lose.hpp" +#include "states_screens/grand_prix_win.hpp" +#endif #include "addons/network_http.hpp" @@ -301,8 +305,8 @@ std::string selection = ribbon->getSelectionIDString(PLAYER_ID_GAME_MASTER); -#if 0 - if (selection == "network") +#if DEBUG_MENU_ITEM + if (selection == "options") { // The DEBUG item FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-09-22 18:42:27
|
Revision: 9887 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=9887&view=rev Author: auria Date: 2011-09-22 18:42:21 +0000 (Thu, 22 Sep 2011) Log Message: ----------- Fixed another (harmless but annoying for Valgrinders) leaks in theGUI Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-09-22 18:24:28 UTC (rev 9886) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-09-22 18:42:21 UTC (rev 9887) @@ -244,7 +244,7 @@ } else if (selection == "quit") { - main_loop->abort(); + StateManager::get()->popMenu(); return; } else if (selection == "about") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2011-12-08 01:02:53
|
Revision: 10377 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=10377&view=rev Author: auria Date: 2011-12-08 01:02:47 +0000 (Thu, 08 Dec 2011) Log Message: ----------- Allow selecting who you are Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2011-12-08 00:55:50 UTC (rev 10376) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2011-12-08 01:02:47 UTC (rev 10377) @@ -177,6 +177,12 @@ void MainMenuScreen::eventCallback(Widget* widget, const std::string& name, const int playerID) { + if (name == "playername") + { + UserConfigParams::m_default_player = L""; + StateManager::get()->resetAndGoToScreen(StoryModeLobbyScreen::getInstance()); + } + // most interesting stuff is in the ribbons, so start there RibbonWidget* ribbon = dynamic_cast<RibbonWidget*>(widget); @@ -289,10 +295,6 @@ { StateManager::get()->pushScreen(ChallengesScreen::getInstance()); } - else if (selection == "story") - { - StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance()); - } else if (selection == "tutorial") { StateManager::get()->pushScreen(TutorialScreen::getInstance()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2012-02-05 00:23:37
|
Revision: 10801 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=10801&view=rev Author: auria Date: 2012-02-05 00:23:31 +0000 (Sun, 05 Feb 2012) Log Message: ----------- use the kart selected by the player in story mode Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2012-02-04 16:02:02 UTC (rev 10800) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2012-02-05 00:23:31 UTC (rev 10801) @@ -301,7 +301,13 @@ StateManager::get()->createActivePlayer( UserConfigParams::m_all_players.get(0), device ); - race_manager->setLocalKartInfo(0, "tux"); + if (kart_properties_manager->getKart(UserConfigParams::m_default_kart) == NULL) + { + fprintf(stderr, "[MainMenuScreen] WARNING: cannot find kart '%s', will revert to default\n", + UserConfigParams::m_default_kart.c_str()); + UserConfigParams::m_default_kart.revertToDefaults(); + } + race_manager->setLocalKartInfo(0, UserConfigParams::m_default_kart); // ASSIGN should make sure that only input from assigned devices // is read. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <au...@us...> - 2012-02-16 02:46:54
|
Revision: 10861 http://supertuxkart.svn.sourceforge.net/supertuxkart/?rev=10861&view=rev Author: auria Date: 2012-02-16 02:46:48 +0000 (Thu, 16 Feb 2012) Log Message: ----------- Disable accidentally committed DEBUG_MENU_ITEM macro Modified Paths: -------------- main/trunk/src/states_screens/main_menu_screen.cpp Modified: main/trunk/src/states_screens/main_menu_screen.cpp =================================================================== --- main/trunk/src/states_screens/main_menu_screen.cpp 2012-02-16 02:44:02 UTC (rev 10860) +++ main/trunk/src/states_screens/main_menu_screen.cpp 2012-02-16 02:46:48 UTC (rev 10861) @@ -15,7 +15,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#define DEBUG_MENU_ITEM 1 +#define DEBUG_MENU_ITEM 0 #include "states_screens/main_menu_screen.hpp" @@ -189,7 +189,7 @@ FeatureUnlockedCutScene* scene = FeatureUnlockedCutScene::getInstance(); - scene->addTrophy(RaceManager::RD_HARD); + scene->addTrophy(RaceManager::RD_EASY); StateManager::get()->pushScreen(scene); /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |