Nox Engine
 
Loading...
Searching...
No Matches
Tile.h
Go to the documentation of this file.
1
6#pragma once
7
8#include "ECS.h"
9#include "Sprites.h"
10#include "Transform.h"
11#include <SDL2/SDL.h>
12
18struct Tile : public Component {
19public:
22
24 int tileID;
25 const char* path;
26
35 Tile(int x, int y, int w, int h, int id);
36 ~Tile();
37
41 void init() override;
48 void resizeTile(int w, int h, float scale = 0.64f);
49};
Defines the core classes for the Entity-Component-System (ECS) architecture.
ComponentID getComponentTypeID() noexcept
Gets the unique ID for a given component type.
Definition ECS.h:39
Defines the component for rendering a static or animated sprite.
Defines the component for managing an entity's position, rotation, and scale.
The base class for all components in the ECS.
Definition ECS.h:53
A component that gives an entity a visual representation using a texture.
Definition Sprites.h:18
A component that represents one square in a tilemap.
Definition Tile.h:18
void resizeTile(int w, int h, float scale=0.64f)
Resizes the tile's underlying components.
Definition Tile.cpp:41
void init() override
Initializes the tile by adding Transform and Sprite components to its entity.
Definition Tile.cpp:34
SDL_Rect tileRect
The rectangle defining the tile's position and size.
Definition Tile.h:23
Transform * transform
Pointer to the tile's Transform component.
Definition Tile.h:20
Sprites * sprite
Pointer to the tile's Sprite component.
Definition Tile.h:21
const char * path
The file path to the tile's texture.
Definition Tile.h:25
int tileID
The identifier for the type of tile (e.g., wall, path).
Definition Tile.h:24
Stores an entity's position, velocity, scale, and rotation.
Definition Transform.h:17