[studio,turbine] Fix Turbine sleep logic, tweak Studio default sleep values
All checks were successful
Build / build (push) Successful in 3m16s
All checks were successful
Build / build (push) Successful in 3m16s
This commit is contained in:
parent
04bf815642
commit
f8acaf6551
@ -78,7 +78,7 @@ WorldEditorImGui::WorldEditorImGui(studio::StudioContext &sctx, ox::StringView p
|
||||
m_doc(makeValid(*readObj<WorldDoc>(keelCtx(m_sctx), path).unwrapThrow())),
|
||||
m_objCache(buildObjCache(keelCtx(m_sctx), m_doc).unwrapThrow()),
|
||||
m_worldStatic(loadWorldStatic(m_objCache, m_doc)),
|
||||
m_view(m_sctx.tctx, m_worldStatic) {
|
||||
m_view(m_sctx, m_worldStatic) {
|
||||
oxThrowError(loadObjectSets());
|
||||
setRequiresConstantRefresh(false);
|
||||
m_objSetPicker.filePicked.connect(this, &WorldEditorImGui::addObjSet);
|
||||
|
@ -8,8 +8,9 @@
|
||||
|
||||
namespace jasper::world {
|
||||
|
||||
WorldEditorView::WorldEditorView(turbine::Context &tctx, WorldStatic const&worldStatic):
|
||||
m_cctx(ncore::init(tctx, {.glInstallDrawer = false}).unwrapThrow()),
|
||||
WorldEditorView::WorldEditorView(studio::StudioContext &sctx, WorldStatic const&worldStatic):
|
||||
m_sctx(sctx),
|
||||
m_cctx(ncore::init(m_sctx.tctx, {.glInstallDrawer = false}).unwrapThrow()),
|
||||
m_worldStatic(worldStatic),
|
||||
m_world(*m_cctx, m_worldStatic) {
|
||||
}
|
||||
@ -33,6 +34,10 @@ void WorldEditorView::draw(ox::Size const&targetSz) noexcept {
|
||||
glutils::resizeInitFrameBuffer(m_frameBuffer, ncore::gl::drawSize(m_scale));
|
||||
}
|
||||
glutils::FrameBufferBind const frameBufferBind(m_frameBuffer);
|
||||
auto const wakeUp = m_world.update();
|
||||
if (wakeUp.ok()) {
|
||||
turbine::setRefreshWithin(m_sctx.tctx, wakeUp.value);
|
||||
}
|
||||
ncore::gl::draw(*m_cctx, m_scale);
|
||||
m_highlighter.draw();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ namespace ncore = nostalgia::core;
|
||||
class WorldEditorView {
|
||||
|
||||
private:
|
||||
studio::StudioContext &m_sctx;
|
||||
ncore::ContextUPtr m_cctx;
|
||||
WorldStatic const&m_worldStatic;
|
||||
int m_columns{}, m_rows{};
|
||||
@ -33,7 +34,7 @@ class WorldEditorView {
|
||||
MapTileHighlighter m_highlighter;
|
||||
|
||||
public:
|
||||
WorldEditorView(turbine::Context &ctx, WorldStatic const&worldStatic);
|
||||
WorldEditorView(studio::StudioContext &ctx, WorldStatic const&worldStatic);
|
||||
|
||||
ox::Error setupWorld() noexcept;
|
||||
|
||||
@ -56,7 +57,7 @@ class WorldEditorView {
|
||||
void setPixelBufferObject(
|
||||
unsigned vertexRow,
|
||||
float x, float y,
|
||||
bool const selected,
|
||||
bool selected,
|
||||
float *vbo,
|
||||
GLuint *ebo) const noexcept;
|
||||
|
||||
|
@ -70,13 +70,15 @@ void World::setupLayer(
|
||||
|
||||
ox::Result<int> World::update() const noexcept {
|
||||
auto const time = ticksMs(turbineCtx(m_nctx));
|
||||
int expiresIn = 30 * 1000;
|
||||
for (size_t i = 0; auto const&pal : m_palettes) {
|
||||
auto const interval = m_worldStatic.palettes[i].intervalMs;
|
||||
auto const page = (time / interval) % pal->pages.size();
|
||||
expiresIn = ox::min(expiresIn, static_cast<int>(time % interval));
|
||||
oxReturnError(ncore::loadBgPalette(m_nctx, i, *pal, static_cast<size_t>(page)));
|
||||
++i;
|
||||
}
|
||||
return -1;
|
||||
return expiresIn;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user