mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-27 00:41:08 +02:00
move logic to tick
This commit is contained in:
@ -183,7 +183,7 @@ void CSoundHandler::ambientStopSound(const AudioPath & soundId)
|
|||||||
setChannelVolume(ambientChannels[soundId], volume);
|
setChannelVolume(ambientChannels[soundId], volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
double CSoundHandler::getSoundDuration(const AudioPath & sound)
|
uint32_t CSoundHandler::getSoundDurationMilliseconds(const AudioPath & sound)
|
||||||
{
|
{
|
||||||
if (!initialized || sound.empty())
|
if (!initialized || sound.empty())
|
||||||
return 0.0;
|
return 0.0;
|
||||||
|
@ -49,13 +49,6 @@ CPrologEpilogVideo::CPrologEpilogVideo(CampaignScenarioPrologEpilog _spe, std::f
|
|||||||
void CPrologEpilogVideo::tick(uint32_t msPassed)
|
void CPrologEpilogVideo::tick(uint32_t msPassed)
|
||||||
{
|
{
|
||||||
elapsedTimeMilliseconds += msPassed;
|
elapsedTimeMilliseconds += msPassed;
|
||||||
}
|
|
||||||
|
|
||||||
void CPrologEpilogVideo::show(Canvas & to)
|
|
||||||
{
|
|
||||||
to.drawColor(pos, Colors::BLACK);
|
|
||||||
//some videos are 800x600 in size while some are 800x400
|
|
||||||
CCS->videoh->update(pos.x, pos.y + (CCS->videoh->size().y == 400 ? 100 : 0), to.getInternalSurface(), true, false);
|
|
||||||
|
|
||||||
const uint32_t speed = (voiceDurationMilliseconds == 0) ? 100 : (voiceDurationMilliseconds / (text->textSize.y));
|
const uint32_t speed = (voiceDurationMilliseconds == 0) ? 100 : (voiceDurationMilliseconds / (text->textSize.y));
|
||||||
|
|
||||||
@ -65,13 +58,17 @@ void CPrologEpilogVideo::show(Canvas & to)
|
|||||||
elapsedTimeMilliseconds -= speed;
|
elapsedTimeMilliseconds -= speed;
|
||||||
++positionCounter;
|
++positionCounter;
|
||||||
}
|
}
|
||||||
else
|
else if(elapsedTimeMilliseconds > (voiceDurationMilliseconds == 0.0 ? 6000 : 3000) && voiceStopped) // pause after completed scrolling (longer for intros missing voice)
|
||||||
{
|
|
||||||
text->showAll(to); // blit text over video, if needed
|
|
||||||
|
|
||||||
if(elapsedTimeMilliseconds > (voiceDurationMilliseconds == 0.0 ? 6000 : 3000) && voiceStopped) // pause after completed scrolling (longer for intros missing voice)
|
|
||||||
clickPressed(GH.getCursorPosition());
|
clickPressed(GH.getCursorPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPrologEpilogVideo::show(Canvas & to)
|
||||||
|
{
|
||||||
|
to.drawColor(pos, Colors::BLACK);
|
||||||
|
//some videos are 800x600 in size while some are 800x400
|
||||||
|
CCS->videoh->update(pos.x, pos.y + (CCS->videoh->size().y == 400 ? 100 : 0), to.getInternalSurface(), true, false);
|
||||||
|
|
||||||
|
text->showAll(to); // blit text over video, if needed
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
|
void CPrologEpilogVideo::clickPressed(const Point & cursorPosition)
|
||||||
|
Reference in New Issue
Block a user