My Project
Loading...
Searching...
No Matches
Public Member Functions | List of all members
BackGroundGameEntity Struct Reference

The BackGroundGameEntity struct is a specialized game entity for displaying a background image. More...

#include <BackGroundGameEntity.h>

Inheritance diagram for BackGroundGameEntity:
GameEntity

Public Member Functions

 BackGroundGameEntity (SDL_Renderer *renderer)
 
virtual void Input (float deltaTime) override
 Handles input for the entity.
 
virtual void Update (float deltaTime) override
 Updates the entity and its components.
 
virtual void Render (SDL_Renderer *renderer) override
 Renders the entity and its components.
 
- Public Member Functions inherited from GameEntity
 GameEntity ()=default
 Default constructor for GameEntity.
 
virtual ~GameEntity ()
 Virtual destructor for GameEntity.
 
void SetRenderable (bool value)
 Sets the entity's renderable state.
 
bool IsRenderable () const
 Checks if the entity is renderable.
 
template<typename T , typename... Args>
T * AddComponent (Args &&...args)
 Adds a component to the entity.
 
template<typename T >
TGetComponent ()
 Retrieves the first component of type T.
 
template<typename T >
const TGetComponent () const
 Retrieves the first component of type T, const version.
 
bool Intersects (const GameEntity *e) const
 Checks if the entity intersects with another entity.
 
SDL_Rect ConvertFRectToRect (const SDL_FRect &frect) const
 Converts an SDL_FRect to SDL_Rect by casting float values to ints.
 

Additional Inherited Members

- Protected Attributes inherited from GameEntity
std::vector< std::shared_ptr< Component > > components
 
bool mRenderable {true}
 

Detailed Description

The BackGroundGameEntity struct is a specialized game entity for displaying a background image.

Inherits from GameEntity and adds a SpriteComponent to render a static background image.

Member Function Documentation

◆ Input()

virtual void BackGroundGameEntity::Input ( float deltaTime)
inlineoverridevirtual

Handles input for the entity.

Parameters
deltaTimeThe time since the last update.

This method is meant to be overridden by derived classes to handle specific input actions.

Reimplemented from GameEntity.

◆ Render()

virtual void BackGroundGameEntity::Render ( SDL_Renderer * renderer)
inlineoverridevirtual

Renders the entity and its components.

Parameters
rendererThe SDL renderer to draw to.

If the entity is marked as renderable, iterates over all components and renders each one.

Reimplemented from GameEntity.

◆ Update()

virtual void BackGroundGameEntity::Update ( float deltaTime)
inlineoverridevirtual

Updates the entity and its components.

Parameters
deltaTimeThe time since the last update.

Iterates over all components and updates each one. Can be overridden by derived classes for additional update logic.

Reimplemented from GameEntity.


The documentation for this struct was generated from the following file: