| 82 | } |
| 83 | |
| 84 | void Window_Help::UpdateScroll() { |
| 85 | if (animation == Animation::None) { |
| 86 | return; |
| 87 | } |
| 88 | |
| 89 | if (text_x_width <= contents->GetWidth()) { |
| 90 | // no need to scroll |
| 91 | return; |
| 92 | } |
| 93 | |
| 94 | if (animation == Animation::BackAndForth) { |
| 95 | text_x_scroll += text_x_scroll_dir ? 1 : -1; |
| 96 | |
| 97 | if ((!text_x_scroll_dir && (text_x_width + text_x_scroll) == contents->GetWidth()) || |
| 98 | (text_x_scroll_dir && text_x_scroll == 0)) { |
| 99 | text_x_scroll_dir = !text_x_scroll_dir; |
| 100 | } |
| 101 | |
| 102 | contents->Clear(); |
| 103 | text_x_offset = text_x_scroll; |
| 104 | AddText(text, color, align, true); |
| 105 | } else if (animation == Animation::Loop) { |
| 106 | --text_x_scroll; |
| 107 | |
| 108 | const int gap_size = 18; |
| 109 | |
| 110 | if (text_x_scroll == -text_x_width - gap_size) { |
| 111 | text_x_scroll = 0; |
| 112 | } |
| 113 | |
| 114 | contents->Clear(); |
| 115 | text_x_offset = text_x_scroll; |
| 116 | AddText(text, color, align, true); |
| 117 | text_x_offset += gap_size; |
| 118 | AddText(text, color, align, true); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void Window_Help::Update() { |
| 123 | Window_Base::Update(); |