initial components
This commit is contained in:
18
include/GameObject.h
Normal file
18
include/GameObject.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "Graphics.h"
|
||||
#include "components/GraphicsComponent.h"
|
||||
|
||||
class GameObject : std::enable_shared_from_this<GameObject> {
|
||||
public:
|
||||
GameObject(std::unique_ptr<GraphicsComponent> graphics)
|
||||
: m_graphics(std::move(graphics)) {}
|
||||
|
||||
void update(Graphics &graphics) {
|
||||
m_graphics->update(graphics);
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<GraphicsComponent> m_graphics;
|
||||
};
|
||||
8
include/Graphics.h
Normal file
8
include/Graphics.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
class Graphics {
|
||||
public:
|
||||
Graphics(){}
|
||||
private:
|
||||
};
|
||||
|
||||
13
include/components/GraphicsComponent.h
Normal file
13
include/components/GraphicsComponent.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Graphics.h"
|
||||
|
||||
class GraphicsComponent {
|
||||
|
||||
public:
|
||||
virtual ~GraphicsComponent() {}
|
||||
virtual void update(Graphics &graphics) = 0;
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
11
include/components/PlayerGraphics.h
Normal file
11
include/components/PlayerGraphics.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Graphics.h"
|
||||
#include "GraphicsComponent.h"
|
||||
#include <print>
|
||||
|
||||
class PlayerGraphics : public GraphicsComponent {
|
||||
void update(Graphics &graphics) {
|
||||
std::print("Updating player graphics");
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user