11#include " TitleScreen.h"
22
3+ #include " Constants.h"
34#include " WindowMan.h"
45#include " FrameMan.h"
56#include " UInputMan.h"
1213#include " AllegroBitmap.h"
1314#include " PresetMan.h"
1415#include " MusicMan.h"
16+ #include " WindowMan.h"
1517
1618#include " raylib/raylib.h"
1719#include " raylib/rlgl.h"
20+ #include " Draw.h"
1821
1922using namespace RTE ;
2023
@@ -546,13 +549,13 @@ void TitleScreen::Draw() {
546549 }
547550
548551 if (m_IntroSequenceState >= IntroSequence::DataRealmsLogoFadeIn && m_IntroSequenceState <= IntroSequence::DataRealmsLogoFadeOut) {
549- draw_sprite (g_FrameMan. GetBackBuffer32 (), m_DataRealmsLogo, (m_TitleScreenMaxWidth - m_DataRealmsLogo->w ) / 2 , (g_WindowMan.GetResY () - m_DataRealmsLogo->h ) / 2 );
552+ DrawTexture ( m_DataRealmsLogo, (m_TitleScreenMaxWidth - m_DataRealmsLogo->w ) / 2 , (g_WindowMan.GetResY () - m_DataRealmsLogo->h ) / 2 , RLColor ( 255 , 255 , 255 , 255 ) );
550553 std::string copyrightNotice (64 , ' \0 ' );
551554 std::snprintf (copyrightNotice.data (), copyrightNotice.size (), " Cortex Command is TM and %c 2023 Data Realms, LLC" , -35 );
552555 AllegroBitmap guiBackBuffer (g_FrameMan.GetBackBuffer32 ());
553556 m_IntroTextFont->DrawAligned (&guiBackBuffer, m_TitleScreenMaxWidth / 2 , g_WindowMan.GetResY () - m_IntroTextFont->GetFontHeight () - 5 , copyrightNotice, GUIFont::Centre);
554557 } else if (m_IntroSequenceState >= IntroSequence::FmodLogoFadeIn && m_IntroSequenceState <= IntroSequence::FmodLogoFadeOut) {
555- draw_sprite (g_FrameMan. GetBackBuffer32 (), m_FmodLogo, (m_TitleScreenMaxWidth - m_FmodLogo->w ) / 2 , (g_WindowMan.GetResY () - m_FmodLogo->h ) / 2 );
558+ DrawTexture ( m_FmodLogo, (m_TitleScreenMaxWidth - m_FmodLogo->w ) / 2 , (g_WindowMan.GetResY () - m_FmodLogo->h ) / 2 , RLColor ( 255 , 255 , 255 , 255 ) );
556559 AllegroBitmap guiBackBuffer (g_FrameMan.GetBackBuffer32 ());
557560 m_IntroTextFont->DrawAligned (&guiBackBuffer, m_TitleScreenMaxWidth / 2 , g_WindowMan.GetResY () - m_IntroTextFont->GetFontHeight () - 5 , " Made with FMOD Studio by Firelight Technologies Pty Ltd." , GUIFont::Centre);
558561 } else if (m_IntroSequenceState >= IntroSequence::ShowSlide1 && m_IntroSequenceState <= IntroSequence::ShowSlide8) {
@@ -582,13 +585,9 @@ void TitleScreen::Draw() {
582585}
583586
584587void TitleScreen::DrawTitleScreenScene () {
585- // This only needs to be done once, but bitmaps can be reloaded which effectively undoes this, so just do it all the time to not deal with flags and checks.
586- set_write_alpha_blender ();
587- draw_trans_sprite (m_Planet.GetSpriteFrame (0 ), ContentFile (" Base.rte/GUIs/Title/PlanetAlpha.png" ).GetAsBitmap (), 0 , 0 );
588- draw_trans_sprite (m_Moon.GetSpriteFrame (0 ), ContentFile (" Base.rte/GUIs/Title/MoonAlpha.png" ).GetAsBitmap (), 0 , 0 );
589588 rlDisableDepthTest ();
590589
591- Box nebulaTargetBox (Vector (), g_FrameMan.GetBackBuffer32 ()->w , g_FrameMan.GetBackBuffer32 ()->h );
590+ Box nebulaTargetBox (Vector (), g_FrameMan.GetBackBuffer32 ()->w , g_FrameMan.GetBackBuffer32 ()->h );
592591 m_Nebula.SetOffset (Vector (static_cast <float >((m_TitleScreenMaxWidth - m_Nebula.GetBitmap ()->w ) / 2 ), m_ScrollOffset.GetY ()));
593592 m_Nebula.Draw (nebulaTargetBox, nebulaTargetBox, true );
594593
@@ -598,10 +597,10 @@ void TitleScreen::DrawTitleScreenScene() {
598597
599598 for (const Star& star: m_BackdropStars) {
600599 int intensity = star.Intensity + RandomNum (0 , (star.Size == Star::StarSize::StarSmall) ? 35 : 70 );
601- // set_screen_blender(intensity, intensity, intensity, intensity);
600+ // set_screen_blender(intensity, intensity, intensity, intensity);
602601 int starPosY = static_cast <int >(star.Position .GetY () - (m_ScrollOffset.GetY () * (m_Nebula.GetScrollRatio ().GetY () * ((star.Size == Star::StarSize::StarSmall) ? 0 .8F : 1 .0F ))));
603602 DrawTexture (g_GLResourceMan.GetStaticTextureFromBitmap (star.Bitmap ), star.Position .m_X , starPosY, RLColor (intensity, intensity, intensity, intensity));
604- // draw_trans_sprite(g_FrameMan.GetBackBuffer32(), star.Bitmap, star.Position.GetFloorIntX(), starPosY);
603+ // draw_trans_sprite(g_FrameMan.GetBackBuffer32(), star.Bitmap, star.Position.GetFloorIntX(), starPosY);
605604 }
606605
607606 rlSetBlendMode (RL_BLEND_ALPHA );
@@ -618,20 +617,20 @@ void TitleScreen::DrawTitleScreenScene() {
618617 m_StationOffset.RadRotate (m_StationOrbitRotation);
619618 m_Station.SetPos (m_PlanetPos + m_StationOffset);
620619 m_Station.SetRotAngle (-c_HalfPI + m_StationOrbitRotation);
621- // m_Station.Draw(g_FrameMan.GetBackBuffer32());
620+ // m_Station.Draw(g_FrameMan.GetBackBuffer32());
622621 DrawTextureEx (g_GLResourceMan.GetStaticTextureFromBitmap (m_Station.GetSpriteFrame (0 )), m_Station.GetPos () + m_Station.GetSpriteOffset () + Vector (m_Station.GetSpriteFrame (0 )->w / 2 , m_Station.GetSpriteFrame (0 )->h / 2 ), m_StationOrbitRotation - c_HalfPI, 1 .0f , {255 , 255 , 255 , 255 });
623622}
624623
625624void TitleScreen::DrawGameLogo () {
626625 DrawTextureV (g_GLResourceMan.GetStaticTextureFromBitmap (m_GameLogo.GetSpriteFrame (0 )), m_GameLogo.GetPos () + m_GameLogo.GetSpriteOffset (), {255 , 255 , 255 , 255 });
627- // m_GameLogo.Draw(g_FrameMan.GetBackBuffer32());
626+ // m_GameLogo.Draw(g_FrameMan.GetBackBuffer32());
628627 m_GameLogoGlow.SetPos (m_GameLogo.GetPos ());
629628 rlEnableColorBlend ();
630629 rlSetBlendFactorsSeparate (GL_ONE , GL_ONE_MINUS_SRC_COLOR , GL_ONE , GL_ONE_MINUS_SRC_ALPHA , GL_FUNC_ADD , GL_FUNC_ADD );
631630 rlSetBlendMode (RL_BLEND_CUSTOM_SEPARATE );
632631 int glowIntensity = 220 + RandomNum (-35 , 35 );
633- // set_screen_blender(glowIntensity, glowIntensity, glowIntensity, glowIntensity);
634- // m_GameLogoGlow.Draw(g_FrameMan.GetBackBuffer32(), Vector(), DrawMode::g_DrawTrans);
632+ // set_screen_blender(glowIntensity, glowIntensity, glowIntensity, glowIntensity);
633+ // m_GameLogoGlow.Draw(g_FrameMan.GetBackBuffer32(), Vector(), DrawMode::g_DrawTrans);
635634 DrawTextureV (g_GLResourceMan.GetStaticTextureFromBitmap (m_GameLogoGlow.GetSpriteFrame (0 )), m_GameLogoGlow.GetPos () + m_GameLogoGlow.GetSpriteOffset (), RLColor (glowIntensity, glowIntensity, glowIntensity, glowIntensity));
636635}
637636
@@ -654,7 +653,8 @@ void TitleScreen::DrawSlideshowSlide() {
654653 // Set a clipping rect so parts of slides that are too wide to fit the primary window's display (left-most) don't get drawn on other displays. This only has effect in multi-display fullscreen.
655654 set_clip_rect (g_FrameMan.GetBackBuffer32 (), 0 , 0 , m_TitleScreenMaxWidth - g_WindowMan.GetResMultiplier (), g_WindowMan.GetResY ());
656655
657- draw_trans_sprite (g_FrameMan.GetBackBuffer32 (), m_IntroSlides.at (slide), slidePos.GetFloorIntX (), slidePos.GetFloorIntY ());
656+ // draw_trans_sprite(g_FrameMan.GetBackBuffer32(), m_IntroSlides.at(slide), slidePos.GetFloorIntX(), slidePos.GetFloorIntY());
657+ DrawTextureV (g_GLResourceMan.GetStaticTextureFromBitmap (m_IntroSlides.at (slide)), slidePos, RLColor (255 , 255 , 255 , fadeAmount));
658658
659659 // Have to immediately reset the clipping rect otherwise the stars in the other displays slowly go into warp speed until the intro sequence is done.
660660 set_clip_rect (g_FrameMan.GetBackBuffer32 (), 0 , 0 , g_FrameMan.GetBackBuffer32 ()->w , g_FrameMan.GetBackBuffer32 ()->h );
@@ -668,4 +668,8 @@ void TitleScreen::DrawSlideshowSlide() {
668668void TitleScreen::DrawOverlayEffectBitmap () const {
669669 set_trans_blender (m_FadeAmount, m_FadeAmount, m_FadeAmount, m_FadeAmount);
670670 draw_trans_sprite (g_FrameMan.GetBackBuffer32 (), g_FrameMan.GetOverlayBitmap32 (), 0 , 0 );
671+ rlEnableColorBlend ();
672+ rlSetBlendMode (RL_BLEND_ALPHA );
673+ DrawRectangle (0 , 0 , g_WindowMan.GetResX (), g_WindowMan.GetResY (), RLColor (1 , 1 , 1 , m_FadeAmount));
674+ rlDrawRenderBatchActive ();
671675}
0 commit comments