-
Notifications
You must be signed in to change notification settings - Fork 54
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
40 changed files
with
697 additions
and
385 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,19 @@ | ||
#pragma once | ||
|
||
#include "CmptPtr.h" | ||
#include "CmptType.h" | ||
#include "CmptTag.h" | ||
|
||
#include <set> | ||
|
||
namespace Ubpa::UECS { | ||
class EntityLocator; | ||
|
||
// use CmptsView::Iterator to read CmptPtr | ||
class CmptsView { | ||
public: | ||
CmptsView(const EntityLocator* locator, void** cmpts) | ||
: locator{ locator }, cmpts{ cmpts }{} | ||
CmptsView(const CmptPtr* cmpts, size_t num) | ||
: cmpts{ cmpts }, num{ num } {} | ||
|
||
// check AccessMode | ||
CmptPtr GetCmpt(CmptType) const; | ||
|
||
template<typename Cmpt> | ||
LastFrame<Cmpt> GetCmptAsLastFrame() const { | ||
return GetCmpt(CmptType::Of<LastFrame<Cmpt>>).AsLastFrame<Cmpt>(); | ||
} | ||
|
||
template<typename Cmpt> | ||
Write<Cmpt> GetCmptAsWrite() const { | ||
return GetCmpt(CmptType::Of<Write<Cmpt>>).AsWrite<Cmpt>(); | ||
} | ||
|
||
template<typename Cmpt> | ||
Latest<Cmpt> GetCmptAsLatest() const { | ||
return GetCmpt(CmptType::Of<Latest<Cmpt>>).AsLatest<Cmpt>(); | ||
} | ||
|
||
void* const* Components() const noexcept { return cmpts; } | ||
const CmptPtr* Components() const noexcept { return cmpts; } | ||
size_t NumberOfComponents() const noexcept { return num; } | ||
private: | ||
const EntityLocator* locator; | ||
void* const* cmpts; | ||
const CmptPtr* cmpts; | ||
size_t num; | ||
}; | ||
} |
Oops, something went wrong.