OpenBarnyard
 
Loading...
Searching...
No Matches
ASlideshowState.cpp
Go to the documentation of this file.
1#include "pch.h"
2#include "ASlideshowState.h"
4
5//-----------------------------------------------------------------------------
6// Enables memory debugging.
7// Note: Should be the last include!
8//-----------------------------------------------------------------------------
10
13
14ASlideshowState::ASlideshowState( const AGUISlideshow::Params& a_rSlideShowParams, AGameState* a_pNextGameState, TBOOL a_bShouldLocalise )
15{
16 m_pNextState = a_pNextGameState;
17 m_pInputMap = AInputMapManager::GetSingleton()->FindMap( TPS8( ASlideshowState ) );
18 m_Slideshow.Setup( &m_HUDParams, a_rSlideShowParams, a_bShouldLocalise );
19}
20
21TBOOL ASlideshowState::ProcessInput( const Toshi::TInputInterface::InputEvent* a_pInputEvent )
22{
23 if ( m_Slideshow.ProcessInput( a_pInputEvent ) )
24 {
25 return TTRUE;
26 }
27
28 return AGameState::ProcessInput( a_pInputEvent );
29}
30
31TBOOL ASlideshowState::ProcessCommand( AInputCommand a_eInputCommand, const Toshi::TInputInterface::InputEvent* a_pInputEvent, TBOOL& a_rStopEvents )
32{
33 return m_Slideshow.ProcessCommand( a_eInputCommand );
34}
35
37{
38 m_Slideshow.Update( a_fDeltaTime );
39
40 if ( m_Slideshow.IsSlideshowOver() )
41 {
42 if ( m_pNextState )
43 {
44 AGameStateController::GetSingleton()->ReplaceState( m_pNextState );
45 return TTRUE;
46 }
47 else
48 {
50 return TTRUE;
51 }
52 }
53 else
54 {
55 return AGameState::OnUpdate( a_fDeltaTime );
56 }
57}
58
60{
61 if ( !m_Slideshow.HasSlides() )
62 {
63 if ( m_pNextState )
64 {
65 AGameStateController::GetSingleton()->ReplaceState( m_pNextState );
66 }
67 else
68 {
70 }
71 }
72
73 AInputMapManager::GetSingleton()->SetMap( TPS8( ASlideshowState ) );
75}
76
78{
79 m_Slideshow.Activate();
81}
82
84{
85 m_Slideshow.Deactivate();
86 m_Slideshow.Reset();
88}
89
90void ASlideshowState::AddSlide( const Toshi::TPString8& a_rName )
91{
92 m_Slideshow.AddSlide( a_rName );
93}
#define TDEFINE_CLASS_NORUNTIME(...)
Definition TObject.h:138
#define TPSTRING8_DECLARE(STR)
Definition TPString8.h:15
#define TPS8(STR)
Definition TPString8.h:16
float TFLOAT
Definition Typedefs.h:4
#define TTRUE
Definition Typedefs.h:25
bool TBOOL
Definition Typedefs.h:6
AInputCommand
Definition AInputMap.h:12
virtual void OnActivate()
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime)
virtual TBOOL ProcessInput(const Toshi::TInputInterface::InputEvent *a_pInputEvent)
virtual void OnDeactivate()
AInputMap * m_pInputMap
Definition AGameState.h:138
virtual void OnInsertion()
void Remove()
HUDParams m_HUDParams
Definition AGameState.h:135
virtual TBOOL ProcessInput(const Toshi::TInputInterface::InputEvent *a_pInputEvent) override
virtual TBOOL ProcessCommand(AInputCommand a_eInputCommand, const Toshi::TInputInterface::InputEvent *a_pInputEvent, TBOOL &a_rStopEvents) override
virtual void OnDeactivate() override
ASlideshowState(const AGUISlideshow::Params &a_rSlideShowParams, AGameState *a_pNextGameState, TBOOL a_bShouldLocalise)
virtual TBOOL OnUpdate(TFLOAT a_fDeltaTime) override
void AddSlide(const Toshi::TPString8 &a_rName)
virtual void OnInsertion() override
virtual void OnActivate() override