Jagguar Game Engine
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
TileMapComponent Class Reference

#include <TileMap.hpp>

Inheritance diagram for TileMapComponent:
Inheritance graph
[legend]
Collaboration diagram for TileMapComponent:
Collaboration graph
[legend]

Public Member Functions

 TileMapComponent (std::string tileSheetFileName, int rows, int cols, int _TileWidth, int _TileHeight, int _mapX, int _mapY, SDL_Renderer *ren)
 
 ~TileMapComponent ()
 
void GenerateSimpleMap ()
 
void PrintMap ()
 
void SetTile (int x, int y, int type)
 
int GetTileType (int x, int y)
 
void Update (SDL_Event e, int frame, std::vector< std::string > broadcastList) override
 
void Render (SDL_Renderer *ren) override
 
void ShowComponentEditor (bool *showEditor) override
 
const char * ComponentTypeName () override
 
- Public Member Functions inherited from Component
 Component ()
 
 ~Component ()
 
virtual void Update (SDL_Event e, int frame, std::vector< std::string > broadcastList)
 
virtual void Render (SDL_Renderer *ren)
 
virtual void ShowComponentEditor (bool *showEditor)
 
virtual bool HasTag (ComponentTag t)
 
virtual const char * ComponentTypeName ()
 
void ParseAndUpdateBroadcast (std::vector< std::string > broadcastList)
 

Private Attributes

int m_Rows
 
int m_Cols
 
int m_TileWidth
 
int m_TileHeight
 
int m_MapX
 
int m_MapY
 
SDL_Surface * m_TileSpriteSheet
 
SDL_Texture * m_Texture
 
int * m_Tiles
 

Additional Inherited Members

- Protected Attributes inherited from Component
std::vector< ComponentTag > tags
 
std::vector< std::string > previousBroadcasts
 
std::vector< std::string > pendingBroadcasts
 

Detailed Description

This is a minimal implementation of a TileMapComponent

Constructor & Destructor Documentation

◆ TileMapComponent()

TileMapComponent::TileMapComponent ( std::string  tileSheetFileName,
int  rows,
int  cols,
int  _TileWidth,
int  _TileHeight,
int  _mapX,
int  _mapY,
SDL_Renderer *  ren 
)

Constructor for a tilemap

◆ ~TileMapComponent()

TileMapComponent::~TileMapComponent ( )

Destructor for a tilemap

Member Function Documentation

◆ ComponentTypeName()

const char * TileMapComponent::ComponentTypeName ( )
inlineoverridevirtual

The name of the component type. Used by the GUI

See also
GameMakerGUI::CreateComponent()
Returns
the name of the component

Reimplemented from Component.

◆ GenerateSimpleMap()

void TileMapComponent::GenerateSimpleMap ( )

Temporary function for generating a simple map to display some tiles

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

◆ GetTileType()

int TileMapComponent::GetTileType ( int  x,
int  y 
)

Return the tile type at an x and y position

Here is the caller graph for this function:

◆ PrintMap()

void TileMapComponent::PrintMap ( )

Function for printing text to console

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

◆ Render()

void TileMapComponent::Render ( SDL_Renderer *  ren)
overridevirtual

Renders the component (if it has anything to render)

Parameters
renthe SDL renderer to be displayed upon
See also
IGraphicsEngineRenderer

Reimplemented from Component.

Here is the call graph for this function:

◆ SetTile()

void TileMapComponent::SetTile ( int  x,
int  y,
int  type 
)

Set the 'type' of tile at an x and y position

Here is the caller graph for this function:

◆ ShowComponentEditor()

void TileMapComponent::ShowComponentEditor ( bool *  showEditor)
overridevirtual

Using Imgui, render an editor for this component

See also
GameMakerGUI::RenderEditor()
Parameters
showEditor

Reimplemented from Component.

Here is the call graph for this function:

◆ Update()

void TileMapComponent::Update ( SDL_Event  e,
int  frame,
std::vector< std::string >  broadcastList 
)
overridevirtual

Draw all of the tiles in the tilemap

Reimplemented from Component.

Here is the call graph for this function:

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