CS4850 Final Project
Loading...
Searching...
No Matches
TextureComponent.hpp
1#pragma once
2#include <SDL2/SDL.h>
3#include <memory>
4#include <string>
5
6#include "Component.hpp"
7#include "Scene.hpp"
8
9// Forward declaration to avoid circular dependencies
10struct Scene;
11
16struct TextureComponent : public Component {
18
19 void CreateTextureComponent(SDL_Renderer* renderer);
20
26 void SetSpritePath(const std::string& filepath) {
27 mFilePath = filepath;
28 }
29
31
32 void Input(float deltaTime) override;
33 void Update(float deltaTime) override;
34 void Render(SDL_Renderer* renderer) override;
35
36 ComponentType GetType() override;
37
38 private:
39 std::shared_ptr<SDL_Texture> mTexture;
40 std::string mFilePath;
41};
Base class for all components.
Definition Component.hpp:15
Scene class that represents a scene in the game.
Definition Scene.hpp:16
A component that represents a texture.
Definition TextureComponent.hpp:16
ComponentType GetType() override
Get the type of the component.
void SetSpritePath(const std::string &filepath)
Set the path to the sprite that will be set when the scene is loaded.
Definition TextureComponent.hpp:26
void Input(float deltaTime) override
Handle input.
void Render(SDL_Renderer *renderer) override
Render the game.
void Update(float deltaTime) override
Update the game state.