I am working on gui library. The main idea that i have 2 types of object:actors and stage. Actor is a gui element(label/button and etc).
Stage is handle all input and change actor status(pressed/unpressed/over).
One of the main features is skin.You can describe how you elements shoould look. And also you can change skin in runtime.
Skin example
local skin= {}
skin.default_button_style={normal="button_normal",pressed="button_pressed",over="radio_normal"}
skin.default_label_style={font="system_font",font_scale=1}
The library is still in development.It contains only label and button.But i will add more gui elements in future.Source can be found on github
The code look like:
local stage_ui=require("stageUI.stage_ui")
local styles=require("stageUI.styles")
function init(self)
msg.post(".", "acquire_input_focus")
self.stage=stage_ui.Stage:new(styles)
local label=stage_ui.Label:new("label","default")
label:set_text("test text")
--add actor to stage
self.stage:add(label)
self.stage:add(stage_ui.Button:new("button","default",function() print("callback") end))
self.stage:add(stage_ui.Button:new("button1","default"))
end
function final(self)
msg.post(".", "release_input_focus")
end
function on_input(self, action_id, action)
--stage handle all input
self.stage:on_input(action_id,action)
end