move some files around

This commit is contained in:
asrael 2025-10-06 19:00:03 -05:00
parent 47c4f2045c
commit cfe7501fe2
12 changed files with 78 additions and 49 deletions

View file

@ -2,6 +2,7 @@ local ffi = require("ffi")
local C = ffi.C
local gfx = _pxl8_gfx
local input = _pxl8_input
local ui = _pxl8_ui
-- pxl8 lua api
--
@ -369,30 +370,30 @@ function pxl8.mat4_lookat(eye, center, up)
return C.pxl8_mat4_lookat(eye_vec, center_vec, up_vec)
end
pxl8.gfx = gfx
pxl8.input = input
pxl8.ui = _pxl8_ui
function pxl8.bounds(x, y, w, h)
return ffi.new("pxl8_bounds", {x = x, y = y, w = w, h = h})
end
function pxl8.ui_button(label)
return C.pxl8_ui_button(_pxl8_ui, label)
return C.pxl8_ui_button(ui, label)
end
function pxl8.ui_checkbox(label, state)
local state_ptr = ffi.new("bool[1]", state)
local changed = C.pxl8_ui_checkbox(_pxl8_ui, label, state_ptr)
local changed = C.pxl8_ui_checkbox(ui, label, state_ptr)
return changed, state_ptr[0]
end
function pxl8.ui_has_mouse_focus()
return C.pxl8_ui_has_mouse_focus(ui)
end
function pxl8.ui_indent(amount)
C.pxl8_ui_indent(_pxl8_ui, amount)
C.pxl8_ui_indent(ui, amount)
end
function pxl8.ui_label(text)
C.pxl8_ui_label(_pxl8_ui, text)
C.pxl8_ui_label(ui, text)
end
function pxl8.ui_layout_row(item_count, widths, height)
@ -402,20 +403,20 @@ function pxl8.ui_layout_row(item_count, widths, height)
elseif type(widths) == "number" then
widths_array = ffi.new("int[1]", widths)
end
C.pxl8_ui_layout_row(_pxl8_ui, item_count, widths_array, height)
C.pxl8_ui_layout_row(ui, item_count, widths_array, height)
end
function pxl8.ui_window_begin(title, x, y, w, h, options)
local rect = ffi.new("pxl8_bounds", {x = x, y = y, w = w, h = h})
return C.pxl8_ui_window_begin(_pxl8_ui, title, rect, options or 0)
return C.pxl8_ui_window_begin(ui, title, rect, options or 0)
end
function pxl8.ui_window_end()
C.pxl8_ui_window_end(_pxl8_ui)
C.pxl8_ui_window_end(ui)
end
function pxl8.ui_window_set_open(title, open)
C.pxl8_ui_window_set_open(_pxl8_ui, title, open)
C.pxl8_ui_window_set_open(ui, title, open)
end
return pxl8