Initial Commit
This commit is contained in:
36
include/Engine/Level/Fixed.h
Normal file
36
include/Engine/Level/Fixed.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include "J3ML/LinearAlgebra/Vector2i.hpp"
|
||||
#include "J3ML/Geometry/AABB2D.hpp"
|
||||
#include "JGL/types/Texture.h"
|
||||
|
||||
using J3ML::LinearAlgebra::Vector2i;
|
||||
using JGL::Texture;
|
||||
|
||||
// Things that are considered non-movable parts of the level.
|
||||
// TODO instanced textures.
|
||||
class Fixed {
|
||||
private:
|
||||
void GenerateCollision();
|
||||
protected:
|
||||
std::vector<Vector2i> collision{};
|
||||
bool enabled = false;
|
||||
bool collidable = false;
|
||||
Vector2i position = {0, 0};
|
||||
const Texture* texture = nullptr;
|
||||
public:
|
||||
[[nodiscard]] bool Collidable() const;
|
||||
[[nodiscard]] Vector2i GetPosition() const;
|
||||
[[nodiscard]] AABB2D GetBounds() const;
|
||||
[[nodiscard]] bool Enabled() const;
|
||||
[[nodiscard]] std::vector<Vector2i> GetCollision();
|
||||
[[nodiscard]] const Texture* GetTexture();
|
||||
public:
|
||||
void Enable();
|
||||
void Disable();
|
||||
virtual void Render() {};
|
||||
public:
|
||||
Fixed(const Vector2i& position, bool enabled, bool collidable, const Texture* texture) : position(position), enabled(enabled), collidable(collidable), texture(texture)
|
||||
{ if (collidable) GenerateCollision(); }
|
||||
virtual ~Fixed();
|
||||
};
|
Reference in New Issue
Block a user