Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CameraEventHandler Class Reference

#include <CameraEventHandler.h>

+ Inheritance diagram for CameraEventHandler:
+ Collaboration diagram for CameraEventHandler:

Public Member Functions

void Initialize ()
 
void Shutdown ()
 
virtual void OnEvent (const Message &msg) override
 
void TriggerCameraShake (short playerID, float intensity, float duration)
 
void StopCameraShake (short playerID)
 
void TeleportCamera (short playerID, float x, float y)
 
void ZoomCameraTo (short playerID, float targetZoom, float speed)
 
void RotateCameraTo (short playerID, float targetRotation, float speed)
 
void ResetCamera (short playerID)
 
void SetCameraBounds (short playerID, const SDL_FRect &bounds)
 
void ClearCameraBounds (short playerID)
 
void FollowTarget (short playerID, EntityID targetEntity)
 
void FollowTarget_Legacy (short playerID, GameObject *targetObject)
 
void UnfollowTarget (short playerID)
 
- Public Member Functions inherited from IMessageListener
virtual ~IMessageListener ()=default
 

Static Public Member Functions

static CameraEventHandlerGetInstance ()
 
static CameraEventHandlerGet ()
 

Private Member Functions

 CameraEventHandler ()=default
 
 ~CameraEventHandler ()=default
 
 CameraEventHandler (const CameraEventHandler &)=delete
 
CameraEventHandleroperator= (const CameraEventHandler &)=delete
 
 CameraEventHandler (CameraEventHandler &&)=delete
 
CameraEventHandleroperator= (CameraEventHandler &&)=delete
 
void HandleShakeEvent (const Message &msg)
 
void HandleShakeStopEvent (const Message &msg)
 
void HandleTeleportEvent (const Message &msg)
 
void HandleZoomEvent (const Message &msg)
 
void HandleRotateEvent (const Message &msg)
 
void HandleResetEvent (const Message &msg)
 
void HandleBoundsEvent (const Message &msg)
 
void HandleClearBoundsEvent (const Message &msg)
 
void HandleFollowEvent (const Message &msg)
 
void HandleUnfollowEvent (const Message &msg)
 

Private Attributes

bool m_initialized = false
 

Detailed Description

Definition at line 31 of file CameraEventHandler.h.

Constructor & Destructor Documentation

◆ CameraEventHandler() [1/3]

CameraEventHandler::CameraEventHandler ( )
privatedefault

◆ ~CameraEventHandler()

CameraEventHandler::~CameraEventHandler ( )
privatedefault

◆ CameraEventHandler() [2/3]

CameraEventHandler::CameraEventHandler ( const CameraEventHandler )
privatedelete

◆ CameraEventHandler() [3/3]

CameraEventHandler::CameraEventHandler ( CameraEventHandler &&  )
privatedelete

Member Function Documentation

◆ ClearCameraBounds()

void CameraEventHandler::ClearCameraBounds ( short  playerID)

Definition at line 194 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_ClearBounds, and EventQueue::Push().

+ Here is the call graph for this function:

◆ FollowTarget()

void CameraEventHandler::FollowTarget ( short  playerID,
EntityID  targetEntity 
)

Definition at line 207 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), GetComponentTypeID_Static(), World::GetSystem(), and INVALID_ENTITY_ID.

+ Here is the call graph for this function:

◆ FollowTarget_Legacy()

void CameraEventHandler::FollowTarget_Legacy ( short  playerID,
GameObject targetObject 
)

◆ Get()

static CameraEventHandler & CameraEventHandler::Get ( )
inlinestatic

Definition at line 40 of file CameraEventHandler.h.

References GetInstance().

Referenced by GameEngine::Initialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetInstance()

static CameraEventHandler & CameraEventHandler::GetInstance ( )
inlinestatic

Definition at line 35 of file CameraEventHandler.h.

References GetComponentTypeID_Static().

Referenced by Get().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleBoundsEvent()

void CameraEventHandler::HandleBoundsEvent ( const Message msg)
private

Definition at line 394 of file CameraEventHandler.cpp.

Referenced by OnEvent().

+ Here is the caller graph for this function:

◆ HandleClearBoundsEvent()

void CameraEventHandler::HandleClearBoundsEvent ( const Message msg)
private

Definition at line 401 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and CameraBounds_data::useBounds.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleFollowEvent()

void CameraEventHandler::HandleFollowEvent ( const Message msg)
private

Definition at line 421 of file CameraEventHandler.cpp.

Referenced by OnEvent().

+ Here is the caller graph for this function:

◆ HandleResetEvent()

void CameraEventHandler::HandleResetEvent ( const Message msg)
private

Definition at line 370 of file CameraEventHandler.cpp.

References Camera_data::controlOffset, World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), and INVALID_ENTITY_ID.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleRotateEvent()

void CameraEventHandler::HandleRotateEvent ( const Message msg)
private

Definition at line 338 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and Camera_data::targetRotation.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleShakeEvent()

void CameraEventHandler::HandleShakeEvent ( const Message msg)
private

Definition at line 237 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and CameraEffects_data::isShaking.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleShakeStopEvent()

void CameraEventHandler::HandleShakeStopEvent ( const Message msg)
private

Definition at line 262 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and CameraEffects_data::isShaking.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleTeleportEvent()

void CameraEventHandler::HandleTeleportEvent ( const Message msg)
private

Definition at line 284 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and Camera_data::position.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleUnfollowEvent()

void CameraEventHandler::HandleUnfollowEvent ( const Message msg)
private

Definition at line 428 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), GetComponentTypeID_Static(), World::GetSystem(), and INVALID_ENTITY_ID.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HandleZoomEvent()

void CameraEventHandler::HandleZoomEvent ( const Message msg)
private

Definition at line 306 of file CameraEventHandler.cpp.

References World::Get(), CameraSystem::GetCameraEntityForPlayer(), World::GetComponent(), GetComponentTypeID_Static(), World::GetSystem(), World::HasComponent(), INVALID_ENTITY_ID, and Camera_data::targetZoom.

Referenced by OnEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Initialize()

void CameraEventHandler::Initialize ( )

Definition at line 20 of file CameraEventHandler.cpp.

References m_initialized, and SYSTEM_LOG.

Referenced by GameEngine::Initialize().

+ Here is the caller graph for this function:

◆ OnEvent()

void CameraEventHandler::OnEvent ( const Message msg)
overridevirtual

◆ operator=() [1/2]

CameraEventHandler & CameraEventHandler::operator= ( CameraEventHandler &&  )
privatedelete

◆ operator=() [2/2]

CameraEventHandler & CameraEventHandler::operator= ( const CameraEventHandler )
privatedelete

◆ ResetCamera()

void CameraEventHandler::ResetCamera ( short  playerID)

Definition at line 160 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_Reset, and EventQueue::Push().

+ Here is the call graph for this function:

◆ RotateCameraTo()

void CameraEventHandler::RotateCameraTo ( short  playerID,
float  targetRotation,
float  speed 
)

Definition at line 145 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_RotateTo, and EventQueue::Push().

+ Here is the call graph for this function:

◆ SetCameraBounds()

void CameraEventHandler::SetCameraBounds ( short  playerID,
const SDL_FRect bounds 
)

◆ Shutdown()

void CameraEventHandler::Shutdown ( )

Definition at line 32 of file CameraEventHandler.cpp.

References m_initialized, and SYSTEM_LOG.

◆ StopCameraShake()

void CameraEventHandler::StopCameraShake ( short  playerID)

Definition at line 102 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_Shake_Stop, and EventQueue::Push().

+ Here is the call graph for this function:

◆ TeleportCamera()

void CameraEventHandler::TeleportCamera ( short  playerID,
float  x,
float  y 
)

Definition at line 115 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_Teleport, and EventQueue::Push().

+ Here is the call graph for this function:

◆ TriggerCameraShake()

void CameraEventHandler::TriggerCameraShake ( short  playerID,
float  intensity,
float  duration 
)

Definition at line 87 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_Shake, and EventQueue::Push().

+ Here is the call graph for this function:

◆ UnfollowTarget()

void CameraEventHandler::UnfollowTarget ( short  playerID)

Definition at line 221 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_Target_Unfollow, and EventQueue::Push().

+ Here is the call graph for this function:

◆ ZoomCameraTo()

void CameraEventHandler::ZoomCameraTo ( short  playerID,
float  targetZoom,
float  speed 
)

Definition at line 130 of file CameraEventHandler.cpp.

References Camera, Message::Create(), EventQueue::Get(), GetComponentTypeID_Static(), Olympe_EventType_Camera_ZoomTo, and EventQueue::Push().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_initialized

bool CameraEventHandler::m_initialized = false
private

Definition at line 84 of file CameraEventHandler.h.

Referenced by Initialize(), and Shutdown().


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