-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
285 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* File: Component.h | ||
* Author: kissholic | ||
* Copyright (c) 2024 kissholic. All wrongs reserved. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Object.h" | ||
|
||
|
||
namespace be { | ||
|
||
class Component { | ||
public: | ||
Component() = default; | ||
virtual ~Component() = default; | ||
|
||
}; | ||
|
||
|
||
using ComponentRef = ObjectRefT<Component>; | ||
|
||
} // namespace be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* File: GameObject.h | ||
* Author: kissholic | ||
* Copyright (c) 2024 kissholic. All wrongs reserved. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "Object.h" | ||
|
||
namespace be { | ||
|
||
struct GameObjectPosition { | ||
float X; | ||
float Y; | ||
float Z; | ||
}; | ||
|
||
struct GameObjectScale { | ||
float X; | ||
float Y; | ||
}; | ||
|
||
class GameObject : public Object { | ||
public: | ||
|
||
virtual void Step([[maybe_unused]] double DeltaTime) noexcept {} | ||
|
||
GameObjectPosition mPosition; | ||
GameObjectScale mScale; | ||
float mRotation; | ||
}; | ||
|
||
|
||
template<typename T> | ||
concept IsGameObject = std::is_base_of<GameObject, T>::value; | ||
|
||
|
||
using GameObjectRef = ObjectRefT<GameObject>; | ||
|
||
|
||
|
||
} // namespace be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* File: Level.h | ||
* Author: kissholic | ||
* Copyright (c) 2024 kissholic. All wrongs reserved. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <algorithm> | ||
#include <string> | ||
#include <vector> | ||
|
||
#include "GameObject.h" | ||
|
||
namespace be { | ||
|
||
|
||
class Level : public GameObject { | ||
public: | ||
Level(const std::string& Name) : mName(Name) {} | ||
|
||
virtual void Step(double DeltaTime) noexcept override { | ||
for (auto& Obj : mGameObjects) { | ||
Obj->Step(DeltaTime); | ||
} | ||
} | ||
|
||
void AddGameObject(GameObjectRef Obj) noexcept { | ||
mGameObjects.push_back(Obj); | ||
} | ||
|
||
void RemoveGameObject(GameObjectRef Obj) noexcept { | ||
std::ranges::remove(mGameObjects, Obj); | ||
} | ||
|
||
private: | ||
std::string mName; | ||
std::vector<GameObjectRef> mGameObjects; | ||
}; | ||
|
||
using LevelRef = ObjectRefT<Level>; | ||
|
||
} // namespace be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* File: Scene.h | ||
* Author: kissholic | ||
* Copyright (c) 2024 kissholic. All wrongs reserved. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <memory> | ||
#include <vector> | ||
|
||
#include "Level.h" | ||
|
||
|
||
namespace be { | ||
|
||
|
||
class Scene : public GameObject { | ||
public: | ||
|
||
virtual void Step(double DeltaTime) noexcept override { | ||
for (auto& Level : mLevels) { | ||
Level->Step(DeltaTime); | ||
} | ||
} | ||
|
||
private: | ||
std::vector<LevelRef> mLevels; | ||
}; | ||
|
||
using SceneRef = ObjectRefT<Scene>; | ||
|
||
|
||
} // namespace be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* File: Sprite.h | ||
* Author: kissholic | ||
* Copyright (c) 2024 kissholic. All wrongs reserved. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "GameObject.h" | ||
|
||
namespace be { | ||
|
||
class Sprite : public GameObject { | ||
}; | ||
|
||
} // namespace be |