Merge pull request #1200 from HimioneGranger/upstream-host-display-api

feat(host): add optional display lifecycle backend
This commit is contained in:
bryanthaboi
2026-08-13 06:06:12 -04:00
committed by GitHub
3 changed files with 136 additions and 3 deletions
+22 -3
View File
@@ -14,6 +14,7 @@ local SwitchDiagnostics = require("src.debug.SwitchDiagnostics")
local LaunchOptions = require("src.core.LaunchOptions")
local NxDisplay = require("src.core.NxDisplay")
local PlatformHooks = require("src.core.PlatformHooks")
local HostDisplay = require("src.core.HostDisplay")
-- Lua errors: persist a redacted trace in the save dir and surface a hint.
do
@@ -430,6 +431,7 @@ function love.load(args)
end
function love.update(dt)
HostDisplay.update(dt)
SwitchDiagnostics.maybeFlush(false)
-- NX only (no-op elsewhere): follow dock/undock without waiting for SDL.
NxDisplay.sync()
@@ -477,11 +479,27 @@ function love.update(dt)
end
function love.draw()
if editorMode then return EditorApp.draw() end
if TouchEditor then return TouchEditor.draw() end
if Importer then return Importer:draw() end
if editorMode then
HostDisplay.beginFrame("editor", EditorApp)
local result = EditorApp.draw()
HostDisplay.endFrame("editor", EditorApp)
return result
end
if TouchEditor then
HostDisplay.beginFrame("touch_editor", TouchEditor)
local result = TouchEditor.draw()
HostDisplay.endFrame("touch_editor", TouchEditor)
return result
end
if Importer then
HostDisplay.beginFrame("launcher", Importer)
local result = Importer:draw()
HostDisplay.endFrame("launcher", Importer)
return result
end
if not Game then return end
HostDisplay.beginFrame("game", Game)
Game:draw()
-- frame capture requested by a driver
if Game.capturePath then
@@ -496,6 +514,7 @@ function love.draw()
end
end)
end
HostDisplay.endFrame("game", Game)
end
function love.keypressed(key, scancode, isrepeat)