-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I think the main question here is the shape of the API we want to expose to lua.
As a conversation starter, here is my PoC implementation that mostly just maps the scene-graph API one-to-one to lua: kuruczgy@e83bc5b
The API exposed to lua looks like this:
---@meta
---Represents a view (a window in kiwmi terms).
---@class kiwmi_view
local view = {}
---@return scene_tree The scene tree for this view.
function view:scene_tree() end
---A scene node.
---@class scene_node
local node = {}
---Set the position of this node.
---@param x number
---@param y number
function node:set_position(x, y) end
---Only valid if created through tree:add_rect.
---@param width number
---@param height number
function node:set_size(width, height) end
---Only valid if created through tree:add_rect.
---@param color string
function node:set_color(color) end
---@class scene_tree
local tree = {}
---Add a new rectangle node to this tree.
---@param color string The color in the format #rrggbb.
---@return scene_node node The created node.
function tree:add_rect(width, height, color) end
---Add a new text node to this tree.
---@return scene_node node The created node.
function tree:add_text(text, color) endThis API should already be quite powerful. Most decorations we want to draw (window borders, title bars, highlighting the active view) can be done with just rectangles, and window titles (with any other kind of information we want) can be added with text nodes.
Metadata
Metadata
Assignees
Labels
No labels