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

#include <ECS_Systems.h>

+ Inheritance diagram for CameraSystem:
+ Collaboration diagram for CameraSystem:

Public Member Functions

 CameraSystem ()
 
virtual ~CameraSystem ()
 
virtual void Process () override
 
virtual void Render () override
 
EntityID CreateCameraForPlayer (short playerID, bool bindToKeyboard=false)
 
void RemoveCameraForPlayer (short playerID)
 
EntityID GetCameraEntityForPlayer (short playerID)
 
void BindCameraToKeyboard (EntityID cameraEntity)
 
void BindCameraToJoystick (EntityID cameraEntity, short playerID, SDL_JoystickID joystickId)
 
void UnbindCameraKeyboard (EntityID cameraEntity)
 
void SetCameraTarget_ECS (EntityID cameraEntity, EntityID targetEntity)
 
void ClearCameraTarget (EntityID cameraEntity)
 
void ApplyCameraToRenderer (SDL_Renderer *renderer, short playerID)
 
void OnEvent (const Message &msg)
 
void UpdateCameraInput (EntityID entity, float dt)
 
void UpdateCameraFollow (EntityID entity, float dt)
 
void UpdateCameraZoom (EntityID entity, float dt)
 
void UpdateCameraRotation (EntityID entity, float dt)
 
void UpdateCameraShake (EntityID entity, float dt)
 
void ApplyCameraBounds (EntityID entity)
 
void ProcessKeyboardInput (EntityID entity, CameraInputBinding_data &binding)
 
void ProcessJoystickInput (EntityID entity, CameraInputBinding_data &binding)
 
float ApplyDeadzone (float value, float deadzone)
 
void ResetCameraControls (EntityID entity)
 
void SyncZoomLevelIndex (Camera_data &cam)
 
- Public Member Functions inherited from ECS_System
 ECS_System ()
 
virtual void RenderDebug ()
 
void AddEntity (EntityID entity)
 
void RemoveEntity (EntityID entity)
 

Public Attributes

std::unordered_map< short, EntityIDm_playerCameras
 
EntityID m_defaultKeyboardCamera = INVALID_ENTITY_ID
 
- Public Attributes inherited from ECS_System
ComponentSignature requiredSignature
 
std::set< EntityIDm_entities
 

Detailed Description

Definition at line 255 of file ECS_Systems.h.

Constructor & Destructor Documentation

◆ CameraSystem()

CameraSystem::CameraSystem ( )

Definition at line 35 of file ECS_Systems_Camera.cpp.

References GetComponentTypeID_Static(), ECS_System::requiredSignature, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ ~CameraSystem()

CameraSystem::~CameraSystem ( )
virtual

Definition at line 44 of file ECS_Systems_Camera.cpp.

References SYSTEM_LOG.

Member Function Documentation

◆ ApplyCameraBounds()

void CameraSystem::ApplyCameraBounds ( EntityID  entity)

Definition at line 653 of file ECS_Systems_Camera.cpp.

References CameraBounds_data::boundingBox, CameraBounds_data::clampToViewport, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), and CameraBounds_data::useBounds.

Referenced by Process().

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

◆ ApplyCameraToRenderer()

void CameraSystem::ApplyCameraToRenderer ( SDL_Renderer renderer,
short  playerID 
)

Definition at line 771 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), m_playerCameras, and renderer.

+ Here is the call graph for this function:

◆ ApplyDeadzone()

float CameraSystem::ApplyDeadzone ( float  value,
float  deadzone 
)

Definition at line 491 of file ECS_Systems_Camera.cpp.

References GetComponentTypeID_Static().

Referenced by ProcessJoystickInput().

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

◆ BindCameraToJoystick()

void CameraSystem::BindCameraToJoystick ( EntityID  cameraEntity,
short  playerID,
SDL_JoystickID  joystickId 
)

Definition at line 213 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), SYSTEM_LOG, and CameraInputBinding_data::useKeyboard.

+ Here is the call graph for this function:

◆ BindCameraToKeyboard()

void CameraSystem::BindCameraToKeyboard ( EntityID  cameraEntity)

Definition at line 198 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), m_defaultKeyboardCamera, SYSTEM_LOG, and CameraInputBinding_data::useKeyboard.

Referenced by CreateCameraForPlayer().

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

◆ ClearCameraTarget()

void CameraSystem::ClearCameraTarget ( EntityID  cameraEntity)

Definition at line 259 of file ECS_Systems_Camera.cpp.

References Camera_data::controlMode, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), INVALID_ENTITY_ID, Mode_Free, SYSTEM_LOG, and CameraTarget_data::targetEntityID.

Referenced by OnEvent().

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

◆ CreateCameraForPlayer()

EntityID CameraSystem::CreateCameraForPlayer ( short  playerID,
bool  bindToKeyboard = false 
)

◆ GetCameraEntityForPlayer()

EntityID CameraSystem::GetCameraEntityForPlayer ( short  playerID)

◆ OnEvent()

void CameraSystem::OnEvent ( const Message msg)

◆ Process()

void CameraSystem::Process ( )
overridevirtual

◆ ProcessJoystickInput()

void CameraSystem::ProcessJoystickInput ( EntityID  entity,
CameraInputBinding_data binding 
)

Definition at line 448 of file ECS_Systems_Camera.cpp.

References ApplyDeadzone(), JoystickManager::Get(), GetComponentTypeID_Static(), and SYSTEM_LOG.

Referenced by UpdateCameraInput().

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

◆ ProcessKeyboardInput()

void CameraSystem::ProcessKeyboardInput ( EntityID  entity,
CameraInputBinding_data binding 
)

Definition at line 375 of file ECS_Systems_Camera.cpp.

References GameEngine::fDt, KeyboardManager::Get(), GetComponentTypeID_Static(), SYSTEM_LOG, Vector::x, and Vector::y.

Referenced by UpdateCameraInput().

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

◆ RemoveCameraForPlayer()

void CameraSystem::RemoveCameraForPlayer ( short  playerID)

Definition at line 175 of file ECS_Systems_Camera.cpp.

References World::DestroyEntity(), World::Get(), GetComponentTypeID_Static(), m_playerCameras, and SYSTEM_LOG.

+ Here is the call graph for this function:

◆ Render()

void CameraSystem::Render ( )
overridevirtual

Reimplemented from ECS_System.

Definition at line 89 of file ECS_Systems_Camera.cpp.

◆ ResetCameraControls()

void CameraSystem::ResetCameraControls ( EntityID  entity)

Definition at line 697 of file ECS_Systems_Camera.cpp.

References Camera_data::controlOffset, CameraTarget_data::followTarget, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), INVALID_ENTITY_ID, CameraEffects_data::isShaking, Mode_Free, and SYSTEM_LOG.

Referenced by OnEvent(), and UpdateCameraInput().

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

◆ SetCameraTarget_ECS()

void CameraSystem::SetCameraTarget_ECS ( EntityID  cameraEntity,
EntityID  targetEntity 
)

Definition at line 239 of file ECS_Systems_Camera.cpp.

References Camera_data::controlMode, World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), Mode_FollowWithControl, SYSTEM_LOG, and CameraTarget_data::targetEntityID.

Referenced by OnEvent().

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

◆ SyncZoomLevelIndex()

void CameraSystem::SyncZoomLevelIndex ( Camera_data cam)

Definition at line 751 of file ECS_Systems_Camera.cpp.

References GetComponentTypeID_Static(), Camera_data::ZOOM_LEVEL_COUNT, and Camera_data::ZOOM_LEVELS.

Referenced by OnEvent().

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

◆ UnbindCameraKeyboard()

void CameraSystem::UnbindCameraKeyboard ( EntityID  cameraEntity)

Definition at line 227 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), SYSTEM_LOG, and CameraInputBinding_data::useKeyboard.

+ Here is the call graph for this function:

◆ UpdateCameraFollow()

void CameraSystem::UpdateCameraFollow ( EntityID  entity,
float  dt 
)

Definition at line 503 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), World::HasComponent(), INVALID_ENTITY_ID, Mode_Follow, Mode_FollowWithControl, Position_data::position, and vBlend().

Referenced by Process().

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

◆ UpdateCameraInput()

void CameraSystem::UpdateCameraInput ( EntityID  entity,
float  dt 
)

◆ UpdateCameraRotation()

void CameraSystem::UpdateCameraRotation ( EntityID  entity,
float  dt 
)

Definition at line 589 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), and Camera_data::targetRotation.

Referenced by Process().

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

◆ UpdateCameraShake()

void CameraSystem::UpdateCameraShake ( EntityID  entity,
float  dt 
)

Definition at line 620 of file ECS_Systems_Camera.cpp.

References gen(), World::Get(), World::GetComponent(), GetComponentTypeID_Static(), shakeDist(), and CameraEffects_data::shakeOffset.

Referenced by Process().

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

◆ UpdateCameraZoom()

void CameraSystem::UpdateCameraZoom ( EntityID  entity,
float  dt 
)

Definition at line 569 of file ECS_Systems_Camera.cpp.

References World::Get(), World::GetComponent(), GetComponentTypeID_Static(), and Camera_data::zoom.

Referenced by Process().

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

Member Data Documentation

◆ m_defaultKeyboardCamera

EntityID CameraSystem::m_defaultKeyboardCamera = INVALID_ENTITY_ID

Definition at line 304 of file ECS_Systems.h.

Referenced by BindCameraToKeyboard().

◆ m_playerCameras

std::unordered_map<short, EntityID> CameraSystem::m_playerCameras

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