lGUI ( name pending )

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Borsty
Citizen
Posts: 66
Joined: Sun Oct 19, 2008 10:29 pm
Location: Hamburg, Germany
Contact:

lGUI ( name pending )

Post by Borsty »

Hi folks.
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:
Image

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
Calls:
  • onMouseDown( x, y, button )
    onMouseUp( x, y, button )
    onMouseMove( x, y )
    onMouseEnter()
    onMouseLeave()
    onKeyDown( key )
    onKeyUp( key )
    onGetFocus()
    onLooseFocus()
    onUpdate( dt )
    performLayout()
    draw()
    init()
Functions:
  • getPos()
    getSize()
    getParent()
    getChildren()
    getActive()
    getFocused()
    getVisible()
    getHovering()
    getClassname()
    getName()

    drag( on )
    bindMouse( on )
    setScissors( on )
GFX Library
  • 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 )
Example on how to write custom controls, here's the label:

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
Will keep you updated.
Last edited by Borsty on Fri Nov 14, 2008 12:30 am, edited 6 times in total.
Dvondrake
Prole
Posts: 29
Joined: Sun Oct 26, 2008 5:53 pm

Re: lGUI ( name pending )

Post by Dvondrake »

---
Last edited by Dvondrake on Mon Jan 21, 2019 10:21 pm, edited 1 time in total.
User avatar
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

Re: lGUI ( name pending )

Post by Merkoth »

Looks great Borsty, I'd löve to give it a try :)

You window decoration looks funny :3
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: lGUI ( name pending )

Post by bartbes »

I'm already waiting for a release...

ticks "Notify me when a reply is posted"
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: lGUI ( name pending )

Post by rude »

Cool! It must be somehwhat frustrating to create GUI without really awesome (precise) Font functions.

Also, I think we need a "Projects" section on the webpage soon.

If you're creating a name poll too, then I have many horrible ideas, and perhaps even some good ones:

Code: Select all

-- bump
-- (For some reason, I feel that a GUI library needs a "bouncy" name)
label = bump.label("Weee, label", 13, 37)
window = bump.window("Wee, window", 42, 42)

-- pope
-- (Because it makes no sense at all)
label = pope.label("Weee, label", 13, 37)
window = pope.window("Wee, window", 42, 42)

-- I had more, but they were even more horrible.
After a while, we'll have great forum posts like "Hay guys, I'm using bump with lube, and I can't get it to work properly with pope". Yeah, that will make total sense to newbs. ^^

Almost like LISP-related names, where nearly every word that matters is replaced by something horrible:
"CUSP uses the Swank-half of SLIME, and gives you a REPL in which you can car, cdr, cadar ... " (etc)
User avatar
Merkoth
Party member
Posts: 186
Joined: Mon Feb 04, 2008 11:43 pm
Location: Buenos Aires, Argentina

Re: lGUI ( name pending )

Post by Merkoth »

Boing? Böing? Cheez?
mystadio
Prole
Posts: 8
Joined: Thu Sep 18, 2008 8:00 pm

Re: lGUI ( name pending )

Post by mystadio »

My father always said: "When you've got an idea, one person somewhere around the globe just got it too."

Well... I've been working on a "Control Library" for the past few days... It's less advanced than yours yet and I'm really eager to see how you did it.

Perhaps I could help you with your code and give you some ideas too, only if you're interested of course.
Last edited by mystadio on Sat Nov 15, 2008 5:03 am, edited 1 time in total.
User avatar
Borsty
Citizen
Posts: 66
Joined: Sun Oct 19, 2008 10:29 pm
Location: Hamburg, Germany
Contact:

Re: lGUI ( name pending )

Post by Borsty »

Heh thanks but nah, I've got pretty much everything done. Prototyping works, library for single and multiline text edits works nicely. Working on the skin system now so you can easily change colors and looks. It's around 1500 lines of code by now, all done in a single day + like 2 h today.
User avatar
mike
Administrator
Posts: 364
Joined: Mon Feb 04, 2008 5:24 pm

Re: lGUI ( name pending )

Post by mike »

Hey, you want to get about 10000x more work to do? Add the ability to use CSS files to style the items!
This is sort of a joke, but would be awesome... :P
Now posting IN STEREO (where available)
u9_
Citizen
Posts: 54
Joined: Thu Oct 23, 2008 7:12 am

Re: lGUI ( name pending )

Post by u9_ »

Do the input fields work with the operating systems assigned characters, or is it ascii only? I mean will i be able to write danish or faroese characters? (i'm not sure this is even possible in love)
Post Reply

Who is online

Users browsing this forum: No registered users and 50 guests