MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / update

Method update

src/ui/IntroduceChapterView.cpp:44–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44void UI::IntroduceChapterView::update(double dt, Engine::Input::MouseState& mstate, Render::RenderConfig& config)
45{
46 if ( m_QueueStatus == QueueStatus::Empty || /* Dialog in progess */ m_Engine.getMainWorld().get().getDialogManager().isDialogActive() )
47 return;
48
49 //Dequeue
50 if ( m_QueueStatus == QueueStatus::InQueue )
51 {
52 //Setup ImageView picture
53 {
54 m_pImageView->setImage(m_Texture);
55 }
56
57 //Setup Text
58 {
59 m_pTitleTextView->setText(m_Title);
60
61 m_pSubtitleTextView->setText(m_Subtitle);
62 }
63
64 //Setup Sound
65 World::AudioWorld& audioWorld = m_Engine.getMainWorld().get().getAudioWorld();
66 {
67 audioWorld.playSound(m_Sound);
68 }
69
70 // Pause Engine, but continue Sound
71 m_Engine.setPaused(true);
72 audioWorld.continueSounds(); //FIXME: might need to use OpenAL or AudioRewrite
73
74 m_QueueStatus = QueueStatus::Dequeued;
75 setHidden(false);
76 }
77
78 // Size tied to windowsize and default size of 640x480
79 Math::float2 fac = Math::float2(640.0f / config.state.viewWidth, 480.0f / config.state.viewHeight);
80 Math::float2 size = Math::float2(1.0f * fac.x, 1.0f * fac.y);
81 setSize(size);
82
83 // Center the view
84 Math::float2 c = Math::float2(0.5f, 0.5f) - size * 0.5f;
85 setTranslation(c);
86
87 View::update(dt, mstate, config);
88
89 m_WaitTime -= dt;
90
91 if ( m_WaitTime < 0 )
92 {
93 m_Engine.setPaused(false);
94
95 m_QueueStatus = QueueStatus::Empty;
96 setHidden(true);
97 }
98}
99
100void UI::IntroduceChapterView::enqueueChapterIntroduction(std::string title, std::string subtitle, std::string texture_name, std::string sound_name, double wait_time)
101{

Callers

nothing calls this directly

Calls 8

isDialogActiveMethod · 0.80
getMethod · 0.80
setImageMethod · 0.80
setPausedMethod · 0.80
continueSoundsMethod · 0.80
getMainWorldMethod · 0.45
setTextMethod · 0.45
playSoundMethod · 0.45

Tested by

no test coverage detected