22 m_needsToBeRemoved =
false;
24 m_transitionInTime = 0.0;
25 m_transitionOutTime = 0.0;
27 m_pScreenManager =
nullptr;
31 m_pRenderTarget =
nullptr;
33 m_transitionValue = 0.0f;
39 void Screen::UpdateTransition(
const GameTime& gameTime)
47 if (m_transitionInTime > 0)
49 m_transitionValue = 1 - (float)m_transitionTime / (
float)m_transitionInTime;
53 m_transitionValue = 1;
59 if (m_transitionOutTime > 0)
61 m_transitionValue = (float)m_transitionTime / (
float)m_transitionOutTime;
65 m_transitionValue = 0;
69 if (m_transitionValue < 0) m_transitionValue = 0;
70 if (m_transitionValue > 1) m_transitionValue = 1;
72 if (m_transitionTime <= 0)
79 m_needsToBeRemoved =
true;
87 m_pScreenManager = &screenManager;
101 if (m_onExit) ((
OnExit)m_onExit)(
this);
104 void Screen::TransitionIn()
108 m_transitionTime = m_transitionInTime;
113 void Screen::TransitionOut()
117 m_transitionTime = m_transitionOutTime;
124 return m_pScreenManager->
GetGame();
Base class for all games. Provides graphics initialization, game loop, and rendering code....
static int GetScreenHeight()
Gets the screen width in pixels.
static int GetScreenWidth()
Gets the screen width in pixels.
Contains timing values for game updates and rendering.
double GetElapsedTime() const
Gets the time in seconds since last frame.
Contains a 2D texture that can be used as a render target.
virtual void UseRenderTarget()
Forces all screen rendering to a render target.
virtual Game * GetGame() const
Gets a pointer to the Game.
virtual void Show()
Tells the screen to transition in.
virtual void Exit()
Tells the screen to transition out. When the screen has completed its transition, UnloadContent() wil...
@ None
The screen is not transitioning.
@ Out
The screen is transitioning out.
@ In
The screen is transitioning in.
virtual void SetScreenManager(ScreenManager &screenManager)
Gets a pointer to the ScreenManager, for managing game screens.
Updates, renders, and manages transitions between instances of the Screen class.
Game * GetGame() const
Gets a pointer to the Game.
Katana Engine is a library of classes, interfaces, and value types that provides a foundation for dev...
void(* OnExit)(Screen *pScreen)
Callback function for when Exit() is called on a screen and it begins to transition out.