int wmain(int argc, gs2d::str_type::char_t* argv[]) #endif { Platform::FileManagerPtr fileManager(new Platform::StdFileManager()); Platform::FileIOHubPtr fileIOHub = Platform::CreateFileIOHub(fileManager, GS_L("data/")); VideoPtr video; if ((video = CreateVideo(1024, 768, GS_L("temp"), true, true, fileIOHub, Texture::PF_UNKNOWN, false))) { InputPtr input = CreateInput(0, false); AudioPtr audio = CreateAudio(0); Video::APP_STATUS status; while ((status = video->HandleEvents()) != Video::APP_QUIT) { if (status == Video::APP_SKIP) continue; input->Update(); video->BeginSpriteScene(); video->EndSpriteScene(); } } return 0; }
static void DrawSplashScreen() { video->BeginSpriteScene(gs2d::constant::BLACK); if (splashSprite) { splashSprite->SetOrigin(gs2d::Sprite::EO_CENTER); const Vector2 screenSize(video->GetScreenSizeF()); const float scale = ComputeSplashScale(screenSize); splashSprite->Draw(screenSize * 0.5f, gs2d::constant::WHITE, 0.0f, Vector2(scale, scale)); } video->EndSpriteScene(); }
GS_PLAYER_INFO PlayCutscene(VideoPtr pVideo, const std::wstring& fileName, InputPtr pInput, const GS_KEY escapeKey) { if (!pVideo) { ShowMessage(L"Invalid video handler - gs2d::PlayCutscene", GSMT_ERROR); return GSPI_FAILED; } GS_PLAYER_INFO info = GSPI_FINISHED; //pVideo->TurnLoopManagerOff(); const bool rendering = pVideo->Rendering(); if (rendering) pVideo->EndSpriteScene(); PlayerPtr player = CreatePlayer(pVideo, fileName); if (!player) { ShowMessage(L"Failed while trying to load the video - gs2d::PlayCutscene", GSMT_ERROR); if (rendering) pVideo->BeginSpriteScene(); return GSPI_FAILED; } pVideo->EnableMediaPlaying(true); player->SetFullscreen(); player->Rewind(); player->Play(); while (!player->IsFinished()) { player->UpdateVideo(); const Video::APP_STATUS status = pVideo->HandleEvents(); if (status == Video::APP_QUIT) { info = GSPI_CLOSE_WINDOW; break; } else { if (status == Video::APP_SKIP) continue; } if (pInput) { pInput->Update(); if (pInput->GetKeyState(escapeKey) == GSKS_HIT) { info = GSPI_SKIPPED; break; } } } if (rendering) pVideo->BeginSpriteScene(); pVideo->EnableMediaPlaying(false); return info; }