Inky

In the LÖVE community there is a common understanding that there isn't a single GUI library that can fit anybody's needs. I wanted to fix this.
I noticed that existing libraries went one of two ways: Immediate style, and Retained style:
In the Immediate style the user writes their GUI directly in the draw
function. The library then under the hood figures out the ID of the
drawn element and handles it's state.
With this style, it is incredibly hard to do layouting and to define
your own widgets you'll have to compose it out of others. Making the
GUI change is very easy though.
In the Retained style, the user writes their GUI beforehand, setting
up all the property and callbacks, and then renders it all in one go.
State is contained within the widgets itself.
With this style, it is hard to extend widgets (because they tend to be
VERY complex) and there's a lot of boilerplate code to setting up the
GUI. Making the GUI change is a challenge too.
Regardless of the style, the library always provided a set of widgets that were styled in a certain way. Sometimes, there is a way to alter the theme, but this isn't enough.
Inky uses a combination of Immediate and Retained style: The user
creates their widgets like in Retained style, but renders them like
Immediate style.
Inky doesn't supply any builtin widgets. Instead, it provides a set of
helper functions to quickly and easily create your widgets, which you
can then style exactly like you want.
local Inky = require("inky")
return Inky.defineElement(function(self)
self.props.count = 0
self:onPointer("release", function()
self.props.count = self.props.count + 1
end)
return function(_, x, y, w, h, depth)
love.graphics.rectangle("line", x, y, w, h)
love.graphics.printf("I have been clicked " .. self.props.count .. " times", x, y, w, "center")
end
end)