Nox Engine
 
Loading...
Searching...
No Matches
Tile Struct Reference

A component that represents one square in a tilemap. More...

#include <Tile.h>

Inheritance diagram for Tile:
Inheritance graph
Collaboration diagram for Tile:
Collaboration graph

Public Member Functions

 Tile (int x, int y, int w, int h, int id)
 Constructs a Tile.
 
void init () override
 Initializes the tile by adding Transform and Sprite components to its entity.
 
void resizeTile (int w, int h, float scale=0.64f)
 Resizes the tile's underlying components.
 
- Public Member Functions inherited from Component
virtual void update ()
 Called once per frame. Contains the component's main logic.
 
virtual void reload ()
 Called to reset the component's state.
 
virtual void draw ()
 Called once per frame after update. Used for rendering.
 

Public Attributes

Transformtransform
 Pointer to the tile's Transform component.
 
Spritessprite
 Pointer to the tile's Sprite component.
 
SDL_Rect tileRect
 The rectangle defining the tile's position and size.
 
int tileID
 The identifier for the type of tile (e.g., wall, path).
 
const charpath
 The file path to the tile's texture.
 
- Public Attributes inherited from Component
Entityentity
 Pointer to the entity that owns this component.
 

Detailed Description

A component that represents one square in a tilemap.

This is a convenience component that combines a Transform and a Sprite and holds data specific to its role in a map, like its ID.

Constructor & Destructor Documentation

◆ Tile()

Tile::Tile ( int  x,
int  y,
int  w,
int  h,
int  id 
)

Constructs a Tile.

Parameters
xThe grid x-coordinate.
yThe grid y-coordinate.
wThe width of the tile.
hThe height of the tile.
idThe tile's type ID.
Here is the call graph for this function:

Member Function Documentation

◆ init()

void Tile::init ( )
overridevirtual

Initializes the tile by adding Transform and Sprite components to its entity.

Reimplemented from Component.

Here is the call graph for this function:

◆ resizeTile()

void Tile::resizeTile ( int  w,
int  h,
float  scale = 0.64f 
)

Resizes the tile's underlying components.

Parameters
wThe new width.
hThe new height.
scaleThe new rendering scale.
Here is the call graph for this function:

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