-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: some unity game object interfaces
- Loading branch information
Showing
11 changed files
with
121 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// | ||
// Created by atolstenko on 11/22/2022. | ||
// | ||
|
||
#include "GameObject.h" |
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,8 @@ | ||
#ifndef MOBAGEN_ENGINE_GAMEOBJECT_H_ | ||
#define MOBAGEN_ENGINE_GAMEOBJECT_H_ | ||
|
||
class GameObject { | ||
|
||
}; | ||
|
||
#endif //MOBAGEN_ENGINE_GAMEOBJECT_H_ |
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,22 @@ | ||
// ref https://docs.unity3d.com/ScriptReference/HideFlags.html | ||
// If you set hide flags to DontSaveInEditor, DontSaveInBuild or HideInHierarchy, this internally removes the object from the Unity Scene, as well as from its current physics scene (this includes both 2D and 3D physics scenes). This also causes the object to trigger its OnDisable and OnEnable calls. | ||
enum class HideFlags{ | ||
// A normal, visible object. This is the default. | ||
None=0, | ||
// The object will not appear in the hierarchy. | ||
HideInHierarchy=1, | ||
// It is not possible to view it in the inspector. | ||
HideInInspector=2, | ||
// The object will not be saved to the Scene in the editor. | ||
DontSaveInEditor=4, | ||
// The object is not editable in the Inspector. | ||
NotEditable=8, | ||
// The object will not be saved when building a player. | ||
DontSaveInBuild=16, | ||
// The object will not be unloaded by Resources.UnloadUnusedAssets. | ||
DontUnloadUnusedAsset = 32, | ||
// The object will not be saved to the Scene. It will not be destroyed when a new Scene is loaded. It is a shortcut for HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.DontUnloadUnusedAsset. | ||
DontSave = 52, | ||
// The GameObject is not shown in the Hierarchy, not saved to Scenes, and not unloaded by Resources.UnloadUnusedAssets. | ||
HideAndDontSave=128 | ||
}; |
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,5 @@ | ||
#include "JobManager.h" | ||
bool JobManager::IsRunningInMainThread() { | ||
// todo: implement | ||
return true; | ||
} |
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,9 @@ | ||
#ifndef MOBAGEN_ENGINE_JOBMANAGER_H_ | ||
#define MOBAGEN_ENGINE_JOBMANAGER_H_ | ||
|
||
class JobManager { | ||
public: | ||
static bool IsRunningInMainThread(); | ||
}; | ||
|
||
#endif //MOBAGEN_ENGINE_JOBMANAGER_H_ |
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,8 @@ | ||
#include "Object.h" | ||
#include <typeinfo> | ||
|
||
template<class T> | ||
std::vector<T> Object::FindObjectsOfType() { | ||
auto typehash = typeid(T).hash_code(); | ||
return std::vector<T>(); | ||
} |
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,39 @@ | ||
#ifndef MOBAGEN_ENGINE_OBJECT_H_ | ||
#define MOBAGEN_ENGINE_OBJECT_H_ | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
class Object { | ||
public: | ||
const std::string& name() const { return _name; } | ||
void name(const std::string& name) { _name = name; } | ||
private: | ||
std::string _name; | ||
|
||
public: | ||
const std::uint64_t& instanceId() const { return _instanceId; } | ||
private: | ||
int _instanceId; // todo: initialize this properly | ||
|
||
// todo: equals comparison and attribution via copy or move ? | ||
public: | ||
Object(); // todo: implement copy and set internal variables | ||
|
||
public: | ||
// todo: mark to be deleted next frame | ||
static void Destroy(const Object& object); | ||
|
||
public: | ||
template<class T> | ||
static std::vector<T> FindObjectsOfType(); | ||
|
||
public: | ||
static void DontDestroyOnLoad(const Object& object); | ||
|
||
public: | ||
std::string ToString(); | ||
}; | ||
|
||
|
||
#endif //MOBAGEN_ENGINE_OBJECT_H_ |
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,5 @@ | ||
// | ||
// Created by atolstenko on 11/22/2022. | ||
// | ||
|
||
#include "Scene.h" |
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,8 @@ | ||
#ifndef MOBAGEN_ENGINE_SCENE_H_ | ||
#define MOBAGEN_ENGINE_SCENE_H_ | ||
|
||
class Scene { | ||
|
||
}; | ||
|
||
#endif //MOBAGEN_ENGINE_SCENE_H_ |
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,5 @@ | ||
// | ||
// Created by atolstenko on 11/22/2022. | ||
// | ||
|
||
#include "Utils.h" |
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,7 @@ | ||
#ifndef MOBAGEN_ENGINE_UTILS_H_ | ||
#define MOBAGEN_ENGINE_UTILS_H_ | ||
|
||
class Utils { | ||
}; | ||
|
||
#endif //MOBAGEN_ENGINE_UTILS_H_ |