Applied Coz's bugfix for crashes on windows/macs when
the resolution is changed. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1616 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
5b32e58b83
commit
0f05001944
@ -38,6 +38,7 @@
|
|||||||
#include "projectile_manager.hpp"
|
#include "projectile_manager.hpp"
|
||||||
#include "file_manager.hpp"
|
#include "file_manager.hpp"
|
||||||
#include "gui/menu_manager.hpp"
|
#include "gui/menu_manager.hpp"
|
||||||
|
#include "widget_manager.hpp"
|
||||||
#include "player.hpp"
|
#include "player.hpp"
|
||||||
#include "gui/font.hpp"
|
#include "gui/font.hpp"
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
@ -205,6 +206,10 @@ void setVideoMode(bool resetTextures)
|
|||||||
//Reinit fonts
|
//Reinit fonts
|
||||||
delete_fonts();
|
delete_fonts();
|
||||||
init_fonts();
|
init_fonts();
|
||||||
|
|
||||||
|
//TODO: this function probably will get deleted in the future; if
|
||||||
|
//so, the widget_manager.hpp include has no other reason to be here.
|
||||||
|
widget_manager->reloadFonts();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -501,6 +501,10 @@ void Widget::setFont( const WidgetFont FONT )
|
|||||||
m_font = font_race;
|
m_font = font_race;
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//TODO: the curr_widget_font variable exists only for a bug around; after
|
||||||
|
//some restructuration, it should be fine to remove this.
|
||||||
|
m_curr_widget_font = FONT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize a display list containing a rectangle that can have rounded
|
/** Initialize a display list containing a rectangle that can have rounded
|
||||||
|
@ -149,6 +149,10 @@ class Widget
|
|||||||
std::string m_text;
|
std::string m_text;
|
||||||
WidgetFontSize m_text_size;
|
WidgetFontSize m_text_size;
|
||||||
|
|
||||||
|
//TODO: This variable exists only to go around a bug; should be removed
|
||||||
|
//after better restructuration.
|
||||||
|
WidgetFont m_curr_widget_font;
|
||||||
|
|
||||||
static const int MAX_SCROLL;
|
static const int MAX_SCROLL;
|
||||||
bool m_enable_scroll;
|
bool m_enable_scroll;
|
||||||
float m_scroll_pos_x;
|
float m_scroll_pos_x;
|
||||||
|
@ -1658,3 +1658,19 @@ int WidgetManager::findBottomWidget(const int START_WGT) const
|
|||||||
return closest_wgt;
|
return closest_wgt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** reloadFonts() sets the pointers to the fonts of the guis
|
||||||
|
* to their choosen fonts; it's useful in cases where you
|
||||||
|
* free the font's memory (which makes the pointers invalid),
|
||||||
|
* then reload the fonts, like it happens when you change resolution
|
||||||
|
* on the Macs or Windows.
|
||||||
|
*/
|
||||||
|
void WidgetManager::reloadFonts()
|
||||||
|
{
|
||||||
|
const int NUM_WIDGETS = (int)m_widgets.size();
|
||||||
|
for( int i = 0; i < NUM_WIDGETS; ++i )
|
||||||
|
{
|
||||||
|
m_widgets[i].widget->setFont(
|
||||||
|
m_widgets[i].widget->m_curr_widget_font );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -232,6 +232,7 @@ public:
|
|||||||
void setWgtFont( const int TOKEN, const WidgetFont FONT);
|
void setWgtFont( const int TOKEN, const WidgetFont FONT);
|
||||||
void showWgtText( const int TOKEN );
|
void showWgtText( const int TOKEN );
|
||||||
void hideWgtText( const int TOKEN );
|
void hideWgtText( const int TOKEN );
|
||||||
|
void reloadFonts();
|
||||||
|
|
||||||
//FIXME: change to enableWgtScrolling, since it enables or disables
|
//FIXME: change to enableWgtScrolling, since it enables or disables
|
||||||
//FIXME: maybe all that enabling the scrolling should do, is to allow
|
//FIXME: maybe all that enabling the scrolling should do, is to allow
|
||||||
|
Loading…
Reference in New Issue
Block a user