[nostalgia/core] Rename customData functions in Context and move them out of Context
This commit is contained in:
@@ -25,6 +25,10 @@ class Drawer {
|
||||
|
||||
// User Input Output
|
||||
class Context {
|
||||
friend constexpr void setApplicationData(Context *ctx, void *applicationData) noexcept;
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
friend constexpr T *applicationData(Context *ctx) noexcept;
|
||||
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
||||
friend common::Size getScreenSize(Context *ctx) noexcept;
|
||||
friend int getScreenHeight(Context *ctx) noexcept;
|
||||
@@ -60,10 +64,12 @@ class Context {
|
||||
AssetManager assetManager;
|
||||
#endif
|
||||
private:
|
||||
void *m_customData = nullptr;
|
||||
void *m_windowerData = nullptr;
|
||||
void *m_rendererData = nullptr;
|
||||
|
||||
protected:
|
||||
void *m_customData = nullptr;
|
||||
|
||||
public:
|
||||
Context() noexcept = default;
|
||||
|
||||
@@ -71,16 +77,6 @@ class Context {
|
||||
Context(const Context &other) noexcept = delete;
|
||||
Context(const Context &&other) noexcept = delete;
|
||||
|
||||
constexpr void setCustomData(void *customData) noexcept {
|
||||
m_customData = customData;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
constexpr T *customData() noexcept {
|
||||
return static_cast<T*>(m_customData);
|
||||
}
|
||||
|
||||
protected:
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
@@ -104,5 +100,15 @@ class Context {
|
||||
|
||||
};
|
||||
|
||||
constexpr void setApplicationData(Context *ctx, void *applicationData) noexcept {
|
||||
ctx->m_customData = applicationData;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
[[nodiscard]]
|
||||
constexpr T *applicationData(Context *ctx) noexcept {
|
||||
return static_cast<T*>(ctx->m_customData);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user