[nostalgia/core] Make core::setMainViewEnabled take a Context
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user