We already have some nice libraries being worked on, networking, the envy framework, etc
But I'm missing an easy to use and skinable user interface system.
Version 0.3:
It includes input handling such as mouse and keyboard events ( onMouseDown, onMouseMove, onKeyDown, ... )
A very easy graphics library that makes rendering your custom controls a little easier.
And many more...
You can put every control on top of another control and it will move together with it's parent.
You can put a button on a button and an additional label and image on it for example.
lGui relies heavily on recursivity and is also optimised for speed.
Controls done so far:
- - Forms
- Labels
- Buttons
- Edits
- Sliders
- Memobox / multiline Edit
- onMouseDown( x, y, button )
onMouseUp( x, y, button )
onMouseMove( x, y )
onMouseEnter()
onMouseLeave()
onKeyDown( key )
onKeyUp( key )
onGetFocus()
onLooseFocus()
onUpdate( dt )
performLayout()
draw()
init()
- getPos()
getSize()
getParent()
getChildren()
getActive()
getFocused()
getVisible()
getHovering()
getClassname()
getName()
drag( on )
bindMouse( on )
setScissors( on )
- gfx.drawRoundedBox( cntrl, r, x, y, w, h )
gfx.setColor( cntrl, r, g, b, a )
gfx.drawQuad( cntrl, x, y, w, h )
gfx.drawLine( cntrl, x1, y1, x2, y2 )
gfx.drawBox( cntrl, x, y, w, h )
gfx.drawText( cntrl, txt, x, y )
gfx:drawButtonFX( cntrl, pressed )
Code: Select all
Control.name = "label"
Control.base = nil
util.createAccessor( Control, "Text", "_txt" )
function Control:init()
self._txt = "unnamed"
self.font = defaultFont
self:performLayout()
end
function Control:performLayout()
self:setH( self.font:getHeight() )
self:setW( self.font:getWidth( self._txt ) )
end
function Control:draw()
love.graphics.setFont( self.font )
gfx.setColor( self, clText )
gfx.drawText( self, self._txt, 0, 10 )
end
function Control:setText( caption )
self._txt = caption or "error"
self:performLayout()
end