OpenBarnyard
 
Loading...
Searching...
No Matches
AFadeManager Class Reference

#include <AFadeManager.h>

Inheritance diagram for AFadeManager:

Public Types

using ThisClass = AFadeManager
 
using BaseClass = Toshi::TTask
 

Public Member Functions

virtual Toshi::TClass * GetClass () override
 
 AFadeManager ()=default
 
virtual TBOOL OnUpdate (TFLOAT a_fDeltaTime) override
 
virtual void StopAllFades ()
 
AFadeStartFade (const AFade::Color &a_rFadeFrom, const AFade::Color &a_rFadeTo, TFLOAT a_fFadeTime)
 
TBOOL HasAnyFadesInProgress (TBOOL a_bThrowFadeOver)
 

Static Public Member Functions

static Toshi::TObject * CreateTObject ()
 
static Toshi::TObject * CreateTObjectInPlace (void *a_pPtr)
 
static void InitialiseClass ()
 
static void DeinitialiseClass ()
 
static TFORCEINLINE Toshi::TClass * GetClassStatic ()
 

Static Public Attributes

static constexpr Toshi::TClass * PARENTCLASS = & Toshi::TTask::ms_oClass
 
static Toshi::TClass ms_oClass = Toshi::TClass( "AFadeManager", AFadeManager::PARENTCLASS, AFadeManager::CreateTObject, AFadeManager::CreateTObjectInPlace, AFadeManager::InitialiseClass, AFadeManager::DeinitialiseClass, 0, 1, sizeof( AFadeManager ), alignof( AFadeManager ) )
 

Detailed Description

Definition at line 6 of file AFadeManager.h.

Member Typedef Documentation

◆ BaseClass

using AFadeManager::BaseClass = Toshi::TTask

Definition at line 10 of file AFadeManager.h.

◆ ThisClass

Definition at line 10 of file AFadeManager.h.

Constructor & Destructor Documentation

◆ AFadeManager()

AFadeManager::AFadeManager ( )
default

Member Function Documentation

◆ CreateTObject()

Toshi::TObject * AFadeManager::CreateTObject ( )
static

Definition at line 12 of file AFadeManager.cpp.

◆ CreateTObjectInPlace()

Toshi::TObject * AFadeManager::CreateTObjectInPlace ( void * a_pPtr)
static

Definition at line 12 of file AFadeManager.cpp.

◆ DeinitialiseClass()

void AFadeManager::DeinitialiseClass ( )
static

Definition at line 12 of file AFadeManager.cpp.

◆ GetClass()

Toshi::TClass * AFadeManager::GetClass ( )
overridevirtual

Definition at line 12 of file AFadeManager.cpp.

◆ GetClassStatic()

static TFORCEINLINE Toshi::TClass * AFadeManager::GetClassStatic ( )
inlinestatic

Definition at line 10 of file AFadeManager.h.

◆ HasAnyFadesInProgress()

TBOOL AFadeManager::HasAnyFadesInProgress ( TBOOL a_bThrowFadeOver)

Definition at line 99 of file AFadeManager.cpp.

100{
101 for ( auto it = m_ActiveFades.Begin(); it != m_ActiveFades.End(); it++ )
102 {
103 if ( it->IsStillFading( a_bThrowFadeOver ) )
104 {
105 return TTRUE;
106 }
107 }
108
109 return TFALSE;
110}
#define TFALSE
Definition Typedefs.h:24
#define TTRUE
Definition Typedefs.h:25

◆ InitialiseClass()

void AFadeManager::InitialiseClass ( )
static

Definition at line 12 of file AFadeManager.cpp.

◆ OnUpdate()

TBOOL AFadeManager::OnUpdate ( TFLOAT a_fDeltaTime)
overridevirtual

Definition at line 14 of file AFadeManager.cpp.

15{
16 if ( !ARootTask::GetSingleton()->IsPaused() )
17 {
18 for ( auto it = m_ActiveFades.Begin(); it != m_ActiveFades.End(); it++ )
19 {
20 it->Update( a_fDeltaTime );
21 }
22
23 for ( auto it = m_ActiveFades.Begin(); it != m_ActiveFades.End(); )
24 {
25 auto pNext = it->Next();
26
27 if ( it->IsStillFading( TTRUE ) )
28 {
29 AFade::Color color;
30 it->GetCurrentColor( color );
31 it->GetRectangleElement().SetColour( color.GetTColor32() );
32 }
33 else
34 {
35 m_ActiveFades.Remove( it );
36 m_Fades.DeleteObject( it );
37 }
38
39 it = pNext;
40 }
41
42 return TTRUE;
43 }
44
45 return TFALSE;
46}
constexpr TUINT32 GetTColor32() const
Definition AFade.h:32

◆ StartFade()

AFade * AFadeManager::StartFade ( const AFade::Color & a_rFadeFrom,
const AFade::Color & a_rFadeTo,
TFLOAT a_fFadeTime )

Definition at line 60 of file AFadeManager.cpp.

61{
62 TFLOAT fWidth;
63 TFLOAT fHeight;
64 AGUI2::GetSingleton()->GetDimensions( fWidth, fHeight );
65
66 if ( m_Fades.GetUsedSize() == m_Fades.GetCapacity() )
67 {
68 auto pFade = m_ActiveFades.Begin();
69
70 if ( pFade != m_ActiveFades.End() )
71 {
72 m_ActiveFades.Remove( pFade );
73 m_Fades.DeleteObject( pFade );
74 }
75 }
76
77 TASSERT( m_Fades.GetUsedSize() != m_Fades.GetCapacity() );
78
79 auto pFade = m_Fades.NewObject();
80 m_ActiveFades.Push( pFade );
81
82 pFade->SetFadeTime( a_fFadeTime );
83 pFade->SetFadeFromColor( a_rFadeFrom );
84 pFade->SetFadeToColor( a_rFadeTo );
85
86 auto& rRectangle = pFade->GetRectangleElement();
87 rRectangle.Create( fWidth, fHeight );
88 rRectangle.SetAttachment( AGUI2ATTACHMENT_TOPCENTER, AGUI2ATTACHMENT_TOPCENTER );
89 rRectangle.SetColour( a_rFadeFrom.GetTColor32() );
90 rRectangle.SetInFront();
91
92 rRectangle.Unlink();
93 AGUI2::GetRootElement()->AddChildTail( rRectangle );
94 rRectangle.Show();
95
96 return pFade;
97}
#define TASSERT(X,...)
Definition Defines.h:138
float TFLOAT
Definition Typedefs.h:4
@ AGUI2ATTACHMENT_TOPCENTER
static AGUI2Element * GetRootElement()
Definition AGUI2.h:31
void AddChildTail(AGUI2Element &a_rElement)

◆ StopAllFades()

void AFadeManager::StopAllFades ( )
virtual

Definition at line 48 of file AFadeManager.cpp.

49{
50 while ( TTRUE )
51 {
52 auto it = m_ActiveFades.Begin();
53 if ( it == m_ActiveFades.End() ) break;
54
55 m_ActiveFades.Remove( it );
56 m_Fades.DeleteObject( it );
57 }
58}

Member Data Documentation

◆ ms_oClass

Toshi::TClass AFadeManager::ms_oClass = Toshi::TClass( "AFadeManager", AFadeManager::PARENTCLASS, AFadeManager::CreateTObject, AFadeManager::CreateTObjectInPlace, AFadeManager::InitialiseClass, AFadeManager::DeinitialiseClass, 0, 1, sizeof( AFadeManager ), alignof( AFadeManager ) )
static

Definition at line 10 of file AFadeManager.h.

◆ PARENTCLASS

Toshi::TClass* AFadeManager::PARENTCLASS = & Toshi::TTask::ms_oClass
staticconstexpr

Definition at line 10 of file AFadeManager.h.


The documentation for this class was generated from the following files: