mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 10:13:42 +00:00
29 lines
702 B
C++
29 lines
702 B
C++
#pragma once
|
|
|
|
#include "Component.h"
|
|
#include "Vector2D.h"
|
|
#include "Constants.h"
|
|
#include "DataComponent.h"
|
|
|
|
class TransformComponent : public Component
|
|
{
|
|
public:
|
|
Vector2D position; // TODO: change to int to save CPU time -> possibly subpixel coordinates
|
|
Vector2D direction;
|
|
|
|
int height = 32;
|
|
int width = 32;
|
|
int scale = 1;
|
|
|
|
explicit TransformComponent(int scale = 1);
|
|
TransformComponent(float x, float y, int scale = 1);
|
|
TransformComponent(float x, float y, int w, int h, int scale = 1);
|
|
|
|
void init() override;
|
|
/*! TODO: document usage of collision handler */
|
|
void update(uint_fast16_t diffTime) override;
|
|
void setPositionAfterCollision(Vector2D& positionChange);
|
|
int getSpeed();
|
|
|
|
};
|