Add player color Venn HUD

This commit is contained in:
Your Name 2026-08-12 14:52:06 -04:00
parent 9b5b9ce182
commit 6f4b2fe696
3 changed files with 102 additions and 4 deletions

View file

@ -15,6 +15,7 @@ require "room"
require "world"
require "world_seed"
require "shaders"
GameUI = require "game_ui"
require "level_editor/editor"
-- Ink dialogue: ship the pre-parsed book (LÖVE has no lpeg to parse .ink at
@ -110,6 +111,7 @@ function love.draw()
else
currentRoom:draw()
end
GameUI.drawColorVenn(currentRoom)
love.graphics.setCanvas(finalCanvas)
love.graphics.clear()
@ -158,6 +160,10 @@ function love.draw()
love.graphics.setBlendMode("alpha")
love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(finalCanvas, 0, 0)
GameUI.drawBacking()
GameUI.drawVennOverlay()
love.graphics.setBlendMode("alpha")
love.graphics.setColor(1, 1, 1, 1)
if DEBUG then love.graphics.draw(sideBarCanvas, sideBarBox.x, sideBarBox.y) end
love.graphics.print("Current FPS: "..tostring(love.timer.getFPS( )), 10, 10)
PerfProfiler:draw()
@ -265,7 +271,7 @@ end
function love.wheelmoved(dx, dy)
if not DEBUG then return end
-- Scroll the editor's asset/folder list when the cursor is over the sidebar.
if editorView == "room" and love.mouse.getX() > width then
if editorView == "room" and love.mouse.getX() >= sideBarBox.x then
editorScrollRoomList(dy)
end
end
@ -304,7 +310,10 @@ function _computeDimensions()
height = width
end
sideBarBox = {x = width, y = 0, w = love.graphics.getWidth() - width, h = height}
local availableWidth = love.graphics.getWidth() - width
local hudWidth = math.min(availableWidth, width / (gridWidth or 11) * 2)
gameUiBox = {x = width, y = 0, w = hudWidth, h = height}
sideBarBox = {x = gameUiBox.x + gameUiBox.w, y = 0, w = availableWidth - gameUiBox.w, h = height}
-- The editor sidebar is authored in a fixed virtual space and scaled up to
-- fill the real panel, so every element keeps the same size relative to the
@ -333,6 +342,7 @@ function _initCanvases()
porousRoomCanvas = love.graphics.newCanvas()
sideBarCanvas = love.graphics.newCanvas(math.max(1, sideBarBox.w), math.max(1, sideBarBox.h))
sideBarCanvas:setFilter("nearest", "nearest") -- never average when sampled
GameUI.init()
end
function _initGridVars()