mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-18 15:46:49 +00:00
End Credits: added some (as yet) unused code for scroll speed control and increased said speed to a more reasonable level
This commit is contained in:
parent
b789d8db1f
commit
d2f31787dd
@ -25,6 +25,8 @@
|
|||||||
#include "formatter.hpp"
|
#include "formatter.hpp"
|
||||||
#include "marked-up_text.hpp"
|
#include "marked-up_text.hpp"
|
||||||
|
|
||||||
|
#include "utils/functional.hpp"
|
||||||
|
|
||||||
namespace gui2
|
namespace gui2
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -35,6 +37,7 @@ tend_credits::tend_credits(const std::vector<std::string>& text, const std::vect
|
|||||||
, backgrounds_(backgrounds)
|
, backgrounds_(backgrounds)
|
||||||
, timer_id_()
|
, timer_id_()
|
||||||
, text_widget_(nullptr)
|
, text_widget_(nullptr)
|
||||||
|
, scroll_speed_(4)
|
||||||
{
|
{
|
||||||
if(backgrounds_.empty()) {
|
if(backgrounds_.empty()) {
|
||||||
backgrounds_.push_back(game_config::images::game_title_background);
|
backgrounds_.push_back(game_config::images::game_title_background);
|
||||||
@ -51,7 +54,11 @@ tend_credits::~tend_credits()
|
|||||||
|
|
||||||
void tend_credits::pre_show(twindow& window)
|
void tend_credits::pre_show(twindow& window)
|
||||||
{
|
{
|
||||||
timer_id_ = add_timer(50, std::bind(&tend_credits::timer_callback, this, std::ref(window)), true);
|
timer_id_ = add_timer(10, std::bind(&tend_credits::timer_callback, this, std::ref(window)), true);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
connect_signal_pre_key_press(window, std::bind(&tend_credits::key_press_callback, this, _3, _4, _5));
|
||||||
|
#endif
|
||||||
|
|
||||||
// TODO: apparently, multiple images are supported... need to implement along with scrolling
|
// TODO: apparently, multiple images are supported... need to implement along with scrolling
|
||||||
window.canvas()[0].set_variable("background_image", variant(backgrounds_[0]));
|
window.canvas()[0].set_variable("background_image", variant(backgrounds_[0]));
|
||||||
@ -78,4 +85,17 @@ void tend_credits::timer_callback(twindow&)
|
|||||||
text_widget_->scroll_vertical_scrollbar(tscrollbar_::ITEM_FORWARD);
|
text_widget_->scroll_vertical_scrollbar(tscrollbar_::ITEM_FORWARD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void tend_credits::key_press_callback(bool&, bool&, const SDLKey key)
|
||||||
|
{
|
||||||
|
if(key == SDLK_UP && scroll_speed_ < 20) {
|
||||||
|
++scroll_speed_;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(key == SDLK_DOWN && scroll_speed_ > 0) {
|
||||||
|
--scroll_speed_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
} // namespace gui2
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
#include "gui/dialogs/dialog.hpp"
|
#include "gui/dialogs/dialog.hpp"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "sdl/utils.hpp"
|
||||||
|
|
||||||
class display;
|
class display;
|
||||||
|
|
||||||
namespace gui2
|
namespace gui2
|
||||||
@ -47,6 +47,9 @@ private:
|
|||||||
void pre_show(twindow& window);
|
void pre_show(twindow& window);
|
||||||
|
|
||||||
void timer_callback(twindow&);
|
void timer_callback(twindow&);
|
||||||
|
#if 0
|
||||||
|
void key_press_callback(bool&, bool&, const SDLKey key);
|
||||||
|
#endif
|
||||||
|
|
||||||
const std::vector<std::string>& text_;
|
const std::vector<std::string>& text_;
|
||||||
|
|
||||||
@ -55,6 +58,8 @@ private:
|
|||||||
size_t timer_id_;
|
size_t timer_id_;
|
||||||
|
|
||||||
tscroll_label* text_widget_;
|
tscroll_label* text_widget_;
|
||||||
|
|
||||||
|
int scroll_speed_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace gui2
|
} // namespace gui2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user