[nostalgia/core] Make core::setMainViewEnabled take a Context

This commit is contained in:
2023-05-25 00:37:43 -05:00
parent 323d5d8d53
commit 8679f6b5a3
4 changed files with 10 additions and 14 deletions
+7 -7
View File
@@ -20,12 +20,6 @@ void ImGui_Impl_NewFrame() noexcept;
namespace gl {
static bool mainViewEnabled = true;
void setMainViewEnabled(bool enabled) noexcept {
mainViewEnabled = enabled;
}
}
namespace renderer {
@@ -73,6 +67,7 @@ struct GlImplData {
glutils::GLProgram spriteShader;
int64_t prevFpsCheckTime = 0;
uint64_t draws = 0;
bool mainViewEnabled = true;
ox::Array<CBB, 4> cbbs;
SpriteBlockset spriteBlocks;
ox::Array<Sprite, 128> spriteStates;
@@ -448,7 +443,7 @@ void draw(Context *ctx) noexcept {
glClearColor(0, 0, 0, 1);
glClear(GL_COLOR_BUFFER_BIT);
// render
if (gl::mainViewEnabled) {
if (id->mainViewEnabled) {
gl::drawMainView(ctx);
}
for (const auto cd : ctx->drawers) {
@@ -557,6 +552,11 @@ void setTile(Context *ctx, unsigned bgIdx, int column, int row, uint8_t tile) no
namespace gl {
void setMainViewEnabled(core::Context *ctx, bool enabled) noexcept {
const auto id = ctx->rendererData<renderer::GlImplData>();
id->mainViewEnabled = enabled;
}
void drawMainView(core::Context *ctx) noexcept {
const auto id = ctx->rendererData<renderer::GlImplData>();
renderer::drawBackgrounds(ctx, id);