CS4850 Final Project
Loading...
Searching...
No Matches
Collision2DComponent.hpp
1#pragma once
2#include <SDL2/SDL.h>
3#include <memory>
4#include <string>
5
6#include "Component.hpp"
7
14
16 ComponentType GetType() override;
17
18 void Input(float deltaTime) override;
19
20 void Update(float deltaTime) override;
21
22 void Render(SDL_Renderer* renderer) override;
23
24 void SetW(float w);
25 void SetH(float h);
26 void SetWH(float w, float h);
27
28 float GetW() const;
29 float GetH() const;
30
31 void SetX(float x);
32 void SetY(float y);
33 void SetXY(float x, float y);
34
35 float GetX() const;
36 float GetY() const;
37
38 SDL_FRect GetRectangle() const;
39
40 private:
41 SDL_FRect mRectangle;
42};
A component that represents a 2D collision box.
Definition Collision2DComponent.hpp:12
void Update(float deltaTime) override
Update the game state.
ComponentType GetType() override
Get the type of the component.
void Render(SDL_Renderer *renderer) override
Render the game.
void Input(float deltaTime) override
Handle input.
Base class for all components.
Definition Component.hpp:15