void BannerWindow::Draw(void) { if(!ShowBanner) return; // draw a black background image first if(AnimStep >= MaxAnimSteps) DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, 0xFF}); if(changing) return; // Run window animation Animate(); // cut the unneeded crap Mtx mv1, mv2, mv3; guMtxIdentity(mv2); guMtxIdentity(mv3); guMtxScaleApply(modelview,mv1, 1.f, -1.f, 1.f); guMtxTransApply(mv1,mv1, 0.5f * ScreenProps.x, 0.5f * ScreenProps.y, 0.f); guMtxTransApply(mv2,mv2, -0.5f * fBannerWidth, 0.5f * fBannerHeight, 0.f); guMtxTransApply(mv3,mv3, 0.5f * fBannerWidth, -0.5f * fBannerHeight + 104.f, 0.f); guMtxConcat(mv1, mv2, mv2); guMtxConcat(mv1, mv3, mv3); f32 viewportv[6]; f32 projectionv[7]; GX_GetViewportv(viewportv, m_vid.vid_mode()); GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC); guVector vecTL; guVector vecBR; GX_Project(0.0f, 0.0f, 0.0f, mv2, projectionv, viewportv, &vecTL.x, &vecTL.y, &vecTL.z); GX_Project(0.0f, 0.0f, 0.0f, mv3, projectionv, viewportv, &vecBR.x, &vecBR.y, &vecBR.z); // round up scissor box offset and round down the size u32 scissorX = (u32)(0.5f + std::max(vecTL.x, 0.0f)); u32 scissorY = (u32)(0.5f + std::max(vecTL.y, 0.0f)); u32 scissorW = (u32)std::max(vecBR.x - vecTL.x, 0.0f); u32 scissorH = (u32)std::max(vecBR.y - vecTL.y, 0.0f); GX_SetScissor(scissorX, scissorY, scissorW, scissorH); // load projection matrix GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC); if(gameBanner.getBanner()) { gameBanner.getBanner()->Render(modelview, ScreenProps, m_vid.wide(), 255.f); gameBanner.getBanner()->AdvanceFrame(); } // Setup GX ReSetup_GX(); GX_SetScissor(0, 0, m_vid.width(), m_vid.height()); // Clear and back to previous projection m_vid.setup2DProjection(); // If wanted if(Brightness == 200) DrawRectangle(0.0f, 0.0f, m_vid.width(), m_vid.height(), (GXColor) {0, 0, 0, Brightness}); }
void BannerWindow::Draw(void) { bool btnAGrow = (settingsBtn->GetState() == STATE_SELECTED || backBtn->GetState() == STATE_SELECTED); bannerFrame.SetButtonAGrow(btnAGrow); bannerFrame.SetButtonBGrow(startBtn->GetState() == STATE_SELECTED); //! Start playing banner sound after last animation frame if animation after zoom is enabled //! or on first frame if during zoom is enable if( AnimZoomIn && gameSound && (((Settings.BannerAnimStart == BANNER_START_ON_ZOOM) && AnimStep == 0) || ((Settings.BannerAnimStart == BANNER_START_AFTER_ZOOM) && ((AnimStep + 1) == MaxAnimSteps)))) { reducedVol = true; gameSound->Play(); } // Run window animation Animate(); // draw a black background image first Menu_DrawRectangle(0.0f, 0.0f, ScreenProps.x, ScreenProps.y, (GXColor) {0, 0, 0, BGAlpha}, true); // no banner alpha means its the start of the animation if(BannerAlpha == 0) return; // cut the unneeded stuff Mtx mv1, mv2, mv3; guMtxIdentity (mv2); guMtxIdentity (mv3); guMtxScaleApply(modelview,mv1, 1.f, -1.f, 1.f); guMtxTransApply(mv1,mv1, 0.5f * ScreenProps.x, 0.5f * ScreenProps.y, 0.f); guMtxTransApply(mv2,mv2, -0.5f * fBannerWidth, 0.5f * fBannerHeight, 0.f); guMtxTransApply(mv3,mv3, 0.5f * fBannerWidth, -0.5f * fBannerHeight, 0.f); guMtxConcat (mv1, mv2, mv2); guMtxConcat (mv1, mv3, mv3); f32 viewportv[6]; f32 projectionv[7]; GX_GetViewportv(viewportv, vmode); GX_GetProjectionv(projectionv, projection, GX_ORTHOGRAPHIC); guVector vecTL; guVector vecBR; GX_Project(0.0f, 0.0f, 0.0f, mv2, projectionv, viewportv, &vecTL.x, &vecTL.y, &vecTL.z); GX_Project(0.0f, 0.0f, 0.0f, mv3, projectionv, viewportv, &vecBR.x, &vecBR.y, &vecBR.z); // round up scissor box offset and round down the size u32 scissorX = (u32)(0.5f + std::max(vecTL.x, 0.0f)); u32 scissorY = (u32)(0.5f + std::max(vecTL.y, 0.0f)); u32 scissorW = (u32)std::max(vecBR.x - vecTL.x, 0.0f); u32 scissorH = (u32)std::max(vecBR.y - vecTL.y, 0.0f); GX_SetScissor( scissorX, scissorY, scissorW, scissorH ); // load projection matrix GX_LoadProjectionMtx(projection, GX_ORTHOGRAPHIC); if(gameBanner->getBanner()) { gameBanner->getBanner()->Render(modelview, ScreenProps, Settings.widescreen, BannerAlpha); // advance only when animation isnt running on certain options if(Settings.BannerAnimStart != BANNER_START_AFTER_ZOOM || !AnimationRunning) { gameBanner->getBanner()->AdvanceFrame(); // skip every 6th frame on PAL50 since all banners are 60 Hz if(Settings.PAL50 && (frameCount % 6 == 0)) { gameBanner->getBanner()->AdvanceFrame(); } } } // render big frame and animate button over effects bannerFrame.Render(modelview, ScreenProps, Settings.widescreen, BannerAlpha); bannerFrame.AdvanceFrame(); // Setup GX ReSetup_GX(); if(AnimationRunning) { // remove scissors again as we draw the background layout too GX_SetScissor(0, 0, vmode->fbWidth, vmode->efbHeight); // only render gui stuff when animation is done return; } GuiWindow::Draw(); }