2d-platformer/Engine-Core/include/Entities/Components.h

74 lines
1.0 KiB
C++

#pragma once
#include "utility.h"
#include <SFML/Graphics.hpp>
class Transform
{
public:
sf::Vector2f position{};
sf::Vector2f speed{};
Transform() = default;
Transform(sf::Vector2f position_in, sf::Vector2f speed_in)
: position(position_in)
, speed(speed_in)
{ }
};
// class DrawDepth
// {
// public:
// DrawDepth() = default;
// DrawDepth(u8 input)
// : depth(input)
// {}
// u8 depth{};
// };
class Sprite
{
public:
Sprite() = default;
u8 x{};
u8 y{};
u8 textureIndex{};
u8 drawDepth{};
};
class BoundingBox
{
public:
BoundingBox() = default;
BoundingBox(sf::FloatRect input)
{
x = input.position.x;
y = input.position.y;
sizeX = input.size.x;
sizeY = input.size.y;
}
BoundingBox(sf::Vector2f pos, sf::Vector2f size)
{
x = pos.x;
y = pos.y;
sizeX = size.x;
sizeY = size.y;
}
BoundingBox(float x_in, float y_in, float sizeX_in, float sizeY_in)
: x(x_in)
, y(y_in)
, sizeX(sizeX_in)
, sizeY(sizeY_in)
{ }
float x{};
float y{};
float sizeX{};
float sizeY{};
};