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

#include <ViewportManager.h>

Public Member Functions

 ViewportManager ()
 
 ~ViewportManager ()
 
virtual void Render ()
 
void Initialize (int w, int h)
 
void Shutdown ()
 
bool AddPlayer (short playerID, ViewportLayout viewportLayout)
 
bool RemovePlayer (short playerID)
 
void SetSize (int w, int h)
 
int GetPlayerCount () const
 
const std::vector< SDL_FRect > & GetViewRects () const
 
bool GetViewRectForPlayer (short playerID, SDL_FRect &outRect) const
 
const std::vector< short > & GetPlayers () const
 
void UpdateViewports ()
 

Static Public Member Functions

static ViewportManagerGetInstance ()
 
static ViewportManagerGet ()
 

Private Attributes

int m_width = 400
 
int m_height = 320
 
std::vector< SDL_FRectm_viewRects
 
std::vector< shortm_players
 
std::unordered_map< short, intm_playerIndexMap
 
ViewportLayout m_currentLayout = ViewportLayout::ViewportLayout_Grid1x1
 

Detailed Description

Definition at line 23 of file ViewportManager.h.

Constructor & Destructor Documentation

◆ ViewportManager()

ViewportManager::ViewportManager ( )

Definition at line 7 of file ViewportManager.cpp.

References Initialize(), GameEngine::screenHeight, and GameEngine::screenWidth.

+ Here is the call graph for this function:

◆ ~ViewportManager()

ViewportManager::~ViewportManager ( )

Definition at line 12 of file ViewportManager.cpp.

References Shutdown().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddPlayer()

bool ViewportManager::AddPlayer ( short  playerID,
ViewportLayout  viewportLayout = ViewportLayout::ViewportLayout_Grid1x1 
)

Definition at line 48 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_playerIndexMap, m_players, MAX_PLAYERS, and UpdateViewports().

Referenced by VideoGame::SetViewportLayout().

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

◆ Get()

static ViewportManager & ViewportManager::Get ( )
inlinestatic

Definition at line 34 of file ViewportManager.h.

References GetInstance().

Referenced by CameraSystem::CreateCameraForPlayer(), GetActiveCameraTransform(), RenderingSystem::Render(), GridSystem::Render(), UIRenderingSystem::Render(), World::Render_ECS_Systems(), and SDL_AppIterate().

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

◆ GetInstance()

static ViewportManager & ViewportManager::GetInstance ( )
inlinestatic

Definition at line 29 of file ViewportManager.h.

References GetComponentTypeID_Static().

Referenced by Get().

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

◆ GetPlayerCount()

int ViewportManager::GetPlayerCount ( ) const
inline

Definition at line 43 of file ViewportManager.h.

References m_players.

◆ GetPlayers()

const std::vector< short > & ViewportManager::GetPlayers ( ) const
inline

Definition at line 50 of file ViewportManager.h.

References m_players.

Referenced by RenderingSystem::Render(), GridSystem::Render(), UIRenderingSystem::Render(), and SDL_AppIterate().

+ Here is the caller graph for this function:

◆ GetViewRectForPlayer()

bool ViewportManager::GetViewRectForPlayer ( short  playerID,
SDL_FRect outRect 
) const

Definition at line 79 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_playerIndexMap, and m_viewRects.

Referenced by GetActiveCameraTransform().

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

◆ GetViewRects()

const std::vector< SDL_FRect > & ViewportManager::GetViewRects ( ) const
inline

Definition at line 46 of file ViewportManager.h.

References m_viewRects.

Referenced by SDL_AppIterate().

+ Here is the caller graph for this function:

◆ Initialize()

void ViewportManager::Initialize ( int  w,
int  h 
)

Definition at line 28 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_height, m_playerIndexMap, m_players, m_viewRects, m_width, SYSTEM_LOG, and UpdateViewports().

Referenced by VideoGame::VideoGame(), and ViewportManager().

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

◆ RemovePlayer()

bool ViewportManager::RemovePlayer ( short  playerID)

Definition at line 62 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_playerIndexMap, m_players, and UpdateViewports().

+ Here is the call graph for this function:

◆ Render()

void ViewportManager::Render ( )
virtual

Definition at line 17 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_viewRects, and GameEngine::renderer.

Referenced by World::Render_ECS_Systems().

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

◆ SetSize()

void ViewportManager::SetSize ( int  w,
int  h 
)

Definition at line 73 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_height, m_width, and UpdateViewports().

+ Here is the call graph for this function:

◆ Shutdown()

void ViewportManager::Shutdown ( )

Definition at line 39 of file ViewportManager.cpp.

References m_playerIndexMap, m_players, m_viewRects, and SYSTEM_LOG.

Referenced by ~ViewportManager().

+ Here is the caller graph for this function:

◆ UpdateViewports()

void ViewportManager::UpdateViewports ( )

Definition at line 89 of file ViewportManager.cpp.

References GetComponentTypeID_Static(), m_height, m_playerIndexMap, m_players, m_viewRects, and m_width.

Referenced by AddPlayer(), Initialize(), RemovePlayer(), and SetSize().

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

Member Data Documentation

◆ m_currentLayout

ViewportLayout ViewportManager::m_currentLayout = ViewportLayout::ViewportLayout_Grid1x1
private

Definition at line 60 of file ViewportManager.h.

◆ m_height

int ViewportManager::m_height = 320
private

Definition at line 55 of file ViewportManager.h.

Referenced by Initialize(), SetSize(), and UpdateViewports().

◆ m_playerIndexMap

std::unordered_map<short,int> ViewportManager::m_playerIndexMap
private

◆ m_players

std::vector<short> ViewportManager::m_players
private

◆ m_viewRects

std::vector<SDL_FRect> ViewportManager::m_viewRects
private

◆ m_width

int ViewportManager::m_width = 400
private

Definition at line 54 of file ViewportManager.h.

Referenced by Initialize(), SetSize(), and UpdateViewports().


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