File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -300,12 +300,7 @@ TextScroller::update(float dt_sec)
300300 // use start or escape keys to exit
301301 if (controller->pressed_any (Control::START, Control::ESCAPE) &&
302302 !m_fading) {
303- m_fading = true ;
304- if (!m_finish_script.empty ()) {
305- Sector::get ().run_script (m_finish_script, " finishscript" );
306- } else {
307- ScreenManager::current ()->pop_screen (std::make_unique<FadeToBlack>(FadeToBlack::FADEOUT, 0 .5f ));
308- }
303+ start_fading ();
309304 return ;
310305 }
311306 }
@@ -319,16 +314,22 @@ TextScroller::update(float dt_sec)
319314 // close when done
320315 if (m_finished && !m_fading)
321316 {
322- m_fading = true ;
323- if (!m_finish_script.empty ()) {
324- Sector::get ().run_script (m_finish_script, " finishscript" );
325- } else {
326- ScreenManager::current ()->pop_screen (std::unique_ptr<ScreenFade>(new FadeToBlack (FadeToBlack::FADEOUT, 0 .25f )));
327- }
317+ start_fading ();
328318 }
329319 }
330320}
331321
322+ void
323+ TextScroller::start_fading ()
324+ {
325+ m_fading = true ;
326+ if (!m_finish_script.empty ()) {
327+ Sector::get ().run_script (m_finish_script, " finishscript" );
328+ } else {
329+ ScreenManager::current ()->pop_screen (std::make_unique<FadeToBlack>(FadeToBlack::FADEOUT, 0 .5f ));
330+ }
331+ }
332+
332333void
333334TextScroller::scroll (float offset)
334335{
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ class TextScroller : public LayerObject
6060 void parse_file (const std::string& filename);
6161 void parse_root (const ReaderObject& root);
6262 void parse_content (const ReaderCollection& collection);
63+ void start_fading ();
6364
6465private:
6566 std::string m_filename;
You can’t perform that action at this time.
0 commit comments