A vector graphics engine and editing software built in pico-8.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
vectorator/center_pane.lua

120 lines
2.4 KiB

--center pane?
toolkit_index = 1
unselected_color = 6
selected_color = 10
selected_secondary_color = 7
z_pressed = false
export_icon_up = false
function toolkit_update()
if current_pane == 2 then
if btnp(2) and not btn(4) then
toolkit_index -= 1
if (toolkit_index < 1) toolkit_index = 1
elseif btnp(3) and not btn(4) then
toolkit_index += 1
if (toolkit_index > 4) toolkit_index = 4
end
export_icon_up = false
if btnp(4) then
if (toolkit_index==1) then
do_export()
export_icon_up = true
end
if (toolkit_index==2) do_switch_handles()
if (toolkit_index==3) do_linked_edits()
end
if btn(4) and toolkit_index==4 then
if (btnp(2)) do_change_instruction(-1)
if (btnp(3)) do_change_instruction(1)
end
if (not btn(4)) export_icon_up = false
end
end
function do_export()
local output = export_memory(m)
printh(output, '@clip')
end
function do_switch_handles()
show_path_handles = not show_path_handles
end
function do_linked_edits()
use_linked_editing = not use_linked_editing
end
function do_change_instruction(direction)
current_node = holding
if (current_node==nil) current_node = under
change_node(current_node, 1)
end
function change_node(record, direction)
if (record==nil) return
idx=1
for i, v in pairs(instructions) do
if v==record.operation[1] then
idx = i
break
end
end
new_idx = idx + direction
if (new_idx>#instructions) new_idx = 1
if (new_idx<1) new_idx = #instructions
m[record.address[1]][record.address[2]][1] = instructions[new_idx]
end
tooltips = {
"export current vram to clipboard",
"show/hide node markers",
"isolate nodes while editing?",
"🅾+⬆/⬇ to change node type"
}
function get_current_tooltip_text()
return tooltips[toolkit_index]
end
function c_pane_draw()
rectfill(39, 14, 60, 116, frame_color)
for i=1,4 do
local c=unselected_color
if i==toolkit_index then
c=selected_secondary_color
end
if i==toolkit_index and current_pane==2 then
c=selected_color
rect(40, 21*i-7, 59, 21*i+12, 7)
end
rect(41, 21*i-6, 58, 21*i+11, c)
spr_num = 2+2*i
if i==1 and export_icon_up then
spr_num += 32
end
if i==2 and not show_path_handles then
spr_num += 32
end
if i==3 and not use_linked_editing then
spr_num += 32
end
spr(spr_num, 42, 21*i-5, 2, 2)
end
end