| 195 | } |
| 196 | |
| 197 | void AboutSection::OnUpdate(float timeMult) |
| 198 | { |
| 199 | if (_root->ActionHit(PlayerAction::Fire)) { |
| 200 | // Approximation of scroll offsets, needs to be changed when header is changed |
| 201 | if (_scrollOffset > 40.0f && _scrollOffset < 400.0f) { |
| 202 | if (theApplication().OpenUrl("https://deat.tk/jazz2/"_s)) { |
| 203 | _root->PlaySfx("MenuSelect"_s, 0.5f); |
| 204 | } |
| 205 | } |
| 206 | } else if (_root->ActionHit(PlayerAction::Menu)) { |
| 207 | _root->PlaySfx("MenuSelect"_s, 0.5f); |
| 208 | _root->LeaveSection(); |
| 209 | return; |
| 210 | } else if (_root->ActionPressed(PlayerAction::Up)) { |
| 211 | if (_scrollRate < MaxScrollRate) { |
| 212 | _scrollRate += 0.16f * timeMult; |
| 213 | } |
| 214 | _scrollOffset -= _scrollRate * timeMult; |
| 215 | _autoScroll = false; |
| 216 | } else if (_root->ActionPressed(PlayerAction::Down)) { |
| 217 | if (_scrollRate < MaxScrollRate) { |
| 218 | _scrollRate += 0.16f * timeMult; |
| 219 | } |
| 220 | _scrollOffset += _scrollRate * timeMult; |
| 221 | _autoScroll = false; |
| 222 | } else { |
| 223 | _scrollRate = 0.0f; |
| 224 | |
| 225 | if (_autoScroll) { |
| 226 | _scrollOffset += (_rewind ? (AutoScrollRate * -40.0f) : AutoScrollRate) * timeMult; |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | if (_touchSpeed > 0.0f) { |
| 231 | if (_touchStart == Vector2f::Zero) { |
| 232 | float scrollOffset = _scrollOffset + (_touchSpeed * (std::int32_t)_touchDirection * TouchKineticDivider * timeMult); |
| 233 | if (scrollOffset < 0.0f && _touchDirection < 0) { |
| 234 | scrollOffset = 0.0f; |
| 235 | _touchDirection = 1; |
| 236 | _touchSpeed *= TouchKineticDamping; |
| 237 | } else if (scrollOffset > _maxScrollOffset && _touchDirection > 0) { |
| 238 | scrollOffset = _maxScrollOffset; |
| 239 | _touchDirection = -1; |
| 240 | _touchSpeed *= TouchKineticDamping; |
| 241 | } |
| 242 | _scrollOffset = scrollOffset; |
| 243 | } |
| 244 | |
| 245 | _touchSpeed = std::max(_touchSpeed - TouchKineticFriction * TouchKineticDivider * timeMult, 0.0f); |
| 246 | } |
| 247 | |
| 248 | _touchTime += timeMult; |
| 249 | } |
| 250 | |
| 251 | void AboutSection::OnDraw(Canvas* canvas) |
| 252 | { |
nothing calls this directly
no test coverage detected