[nostalgia/core] Add missing change for constant refresh option
This commit is contained in:
parent
34221f086c
commit
142c78db0e
@ -20,6 +20,7 @@ class Context;
|
||||
class Drawer {
|
||||
public:
|
||||
virtual ~Drawer() = default;
|
||||
|
||||
virtual void draw(Context*) noexcept = 0;
|
||||
};
|
||||
|
||||
@ -28,6 +29,7 @@ class Context {
|
||||
friend constexpr void setApplicationData(Context *ctx, void *applicationData) noexcept;
|
||||
template<typename T>
|
||||
friend constexpr T *applicationData(Context *ctx) noexcept;
|
||||
friend constexpr void setConstantRefresh(Context *ctx, bool) noexcept;
|
||||
friend bool bgStatus(Context *ctx, unsigned bg) noexcept;
|
||||
friend common::Size getScreenSize(Context *ctx) noexcept;
|
||||
friend int getScreenHeight(Context *ctx) noexcept;
|
||||
@ -50,10 +52,8 @@ class Context {
|
||||
friend void setBgStatus(Context *ctx, unsigned bg, bool status) noexcept;
|
||||
friend void setClipboardText(Context *ctx, const ox::String &text) noexcept;
|
||||
friend void setEventHandler(Context *ctx, event_handler h) noexcept;
|
||||
friend void setRendererData(Context *ctx, void *rendererData) noexcept;
|
||||
friend void setTile(Context *ctx, int layer, int column, int row, uint8_t tile) noexcept;
|
||||
friend void setWindowTitle(Context *ctx, const char *title) noexcept;
|
||||
friend void setWindowerData(Context *ctx, void *windowerData) noexcept;
|
||||
|
||||
public:
|
||||
ox::UniquePtr<ox::FileSystem> rom;
|
||||
@ -62,13 +62,17 @@ class Context {
|
||||
#ifndef OX_BARE_METAL
|
||||
AssetManager assetManager;
|
||||
#endif
|
||||
protected:
|
||||
#ifndef OX_BARE_METAL
|
||||
// sets screen refresh to constant instead of only on event
|
||||
bool constantRefresh = false;
|
||||
#endif
|
||||
void *m_customData = nullptr;
|
||||
|
||||
private:
|
||||
void *m_windowerData = nullptr;
|
||||
void *m_rendererData = nullptr;
|
||||
|
||||
protected:
|
||||
void *m_customData = nullptr;
|
||||
|
||||
public:
|
||||
Context() noexcept = default;
|
||||
|
||||
@ -109,5 +113,11 @@ constexpr T *applicationData(Context *ctx) noexcept {
|
||||
return static_cast<T*>(ctx->m_customData);
|
||||
}
|
||||
|
||||
constexpr void setConstantRefresh([[maybe_unused]] Context *ctx, [[maybe_unused]] bool r) noexcept {
|
||||
#ifndef OX_BARE_METAL
|
||||
ctx->constantRefresh = r;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -48,8 +48,10 @@ ox::Error run(Context *ctx) noexcept {
|
||||
}
|
||||
draw(ctx);
|
||||
glfwSwapBuffers(id->window);
|
||||
if (!ctx->constantRefresh) {
|
||||
glfwWaitEventsTimeout(sleepTime);
|
||||
}
|
||||
}
|
||||
// destroy GLFW window
|
||||
renderer::shutdown(ctx, ctx->rendererData<void>());
|
||||
glfwDestroyWindow(id->window);
|
||||
|
Loading…
x
Reference in New Issue
Block a user