-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automatic execution of main loop entities
- Loading branch information
Showing
21 changed files
with
95 additions
and
129 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
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
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
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,10 @@ | ||
#pragma once | ||
|
||
class MainLoopEntity | ||
{ | ||
public: | ||
virtual ~MainLoopEntity() = default; | ||
|
||
virtual void shutdown() = 0; | ||
virtual void process() = 0; | ||
}; |
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 @@ | ||
#include "MainLoopEntityController.h" | ||
|
||
#include <ranges> | ||
|
||
void MainLoopEntityController::registerObject(MainLoopEntity* object) | ||
{ | ||
_objects.emplace_back(object); | ||
} | ||
|
||
void MainLoopEntityController::shutdown() | ||
{ | ||
for (auto const& object : _objects | std::views::reverse) { | ||
object->shutdown(); | ||
} | ||
} | ||
|
||
void MainLoopEntityController::process() | ||
{ | ||
for (auto const& object : _objects | std::views::reverse) { | ||
object->process(); | ||
} | ||
} |
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,21 @@ | ||
#pragma once | ||
|
||
#include "Base/Singleton.h" | ||
|
||
#include "Definitions.h" | ||
#include "MainLoopEntity.h" | ||
|
||
|
||
class MainLoopEntityController | ||
{ | ||
MAKE_SINGLETON(MainLoopEntityController); | ||
|
||
public: | ||
void registerObject(MainLoopEntity* object); | ||
|
||
void shutdown(); | ||
void process(); | ||
|
||
private: | ||
std::vector<MainLoopEntity*> _objects; | ||
}; |
Oops, something went wrong.