本文整理汇总了C++中Stopwatch::GetElapsedMs方法的典型用法代码示例。如果您正苦于以下问题:C++ Stopwatch::GetElapsedMs方法的具体用法?C++ Stopwatch::GetElapsedMs怎么用?C++ Stopwatch::GetElapsedMs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stopwatch
的用法示例。
在下文中一共展示了Stopwatch::GetElapsedMs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HookedPlayMovieSlide
int __cdecl HookedPlayMovieSlide(const char* imageFile, const char* soundFile, const SubtitleLine* subtitles, int flags, int soundtrackId) {
logger->info("Play Movie Slide {} {} {} {}", imageFile, soundFile, flags, soundtrackId);
// Load img into memory using TIO
unique_ptr<vector<uint8_t>> imgData(TioReadBinaryFile(imageFile));
if (!imgData) {
logger->error("Unable to load the image file {}", imageFile);
return 1; // Can't play because we cant load the file
}
auto device = graphics->device();
gfx::ImageFileInfo info;
auto surface(gfx::LoadImageToSurface(graphics->device(), *imgData.get(), info));
movieFuncs.MovieIsPlaying = true;
device->ShowCursor(FALSE);
// Clear screen with black color and present immediately
device->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0, 0);
device->Present(nullptr, nullptr, nullptr, nullptr);
SubtitleRenderer subtitleRenderer(subtitles);
TigRect bbRect(0, 0, graphics->backBufferDesc().Width, graphics->backBufferDesc().Height);
TigRect destRect(0, 0, info.width, info.height);
destRect.FitInto(bbRect);
RECT fitDestRect = destRect.ToRect();
Stopwatch sw;
TigSoundStreamWrapper stream;
if (soundFile) {
if (!stream.Play(soundFile, TigSoundType::Voice)) {
logger->error("Unable to play sound {} during slideshow.", soundFile);
} else {
stream.SetVolume(*tigSoundAddresses.movieVolume);
}
}
bool keyPressed = false;
while (!keyPressed && (!stream.IsValid() || stream.IsPlaying() || sw.GetElapsedMs() < 3000)) {
D3DLOG(device->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0, 0, 0));
D3DLOG(device->BeginScene());
D3DLOG(device->StretchRect(surface, NULL, graphics->backBuffer(), &fitDestRect, D3DTEXF_LINEAR));
subtitleRenderer.Render();
D3DLOG(device->EndScene());
D3DLOG(device->Present(NULL, NULL, NULL, NULL));
templeFuncs.ProcessSystemEvents();
TigMsg msg;
while (!msgFuncs.Process(&msg)) {
// Flags 1 seems to disable skip via keyboard. Also seems unused.
if (!(flags & 1) && msg.type == TigMsgType::KEYSTATECHANGE && LOBYTE(msg.arg2) == 1) {
// TODO Wait for the key to be unpressed again
keyPressed = true;
break;
}
}
}
movieFuncs.MovieIsPlaying = false;
device->ShowCursor(TRUE);
return 0;
}