Merge branch 'save_ext' into jgrpp
# Conflicts: # config.lib # src/misc_gui.cpp # src/network/network_gui.cpp # src/settings_type.h # src/smallmap_gui.cpp # src/smallmap_gui.h # src/station_cmd.cpp # src/toolbar_gui.cpp # src/vehicle_gui.cpp # src/window.cpp
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "zoom_func.h"
|
||||
#include "tunnelbridge_map.h"
|
||||
#include "viewport_type.h"
|
||||
#include "guitimer_func.h"
|
||||
|
||||
#include "widgets/misc_widget.h"
|
||||
|
||||
@@ -486,16 +487,18 @@ static const char * const _credits[] = {
|
||||
|
||||
struct AboutWindow : public Window {
|
||||
int text_position; ///< The top of the scrolling text
|
||||
byte counter; ///< Used to scroll the text every 5 ticks
|
||||
int line_height; ///< The height of a single line
|
||||
static const int num_visible_lines = 19; ///< The number of lines visible simultaneously
|
||||
|
||||
static const uint TIMER_INTERVAL = 150; ///< Scrolling interval in ms
|
||||
GUITimer timer;
|
||||
|
||||
AboutWindow() : Window(&_about_desc)
|
||||
{
|
||||
this->InitNested(WN_GAME_OPTIONS_ABOUT);
|
||||
|
||||
this->counter = 5;
|
||||
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
|
||||
this->timer.SetInterval(TIMER_INTERVAL);
|
||||
}
|
||||
|
||||
virtual void SetStringParameters(int widget) const
|
||||
@@ -536,11 +539,11 @@ struct AboutWindow : public Window {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnTick()
|
||||
virtual void OnRealtimeTick(uint delta_ms)
|
||||
{
|
||||
if (--this->counter == 0) {
|
||||
this->counter = 5;
|
||||
this->text_position--;
|
||||
uint count = this->timer.CountElapsed(delta_ms);
|
||||
if (count > 0) {
|
||||
this->text_position -= count;
|
||||
/* If the last text has scrolled start a new from the start */
|
||||
if (this->text_position < (int)(this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y - lengthof(_credits) * this->line_height)) {
|
||||
this->text_position = this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->pos_y + this->GetWidget<NWidgetBase>(WID_A_SCROLLING_TEXT)->current_y;
|
||||
|
Reference in New Issue
Block a user