Basic dialog boxes (another wheel reinvented)

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Peter Hickman
Prole
Posts: 15
Joined: Fri Jan 30, 2009 8:19 am

Basic dialog boxes (another wheel reinvented)

Post by Peter Hickman »

When I finished the pairs game I posted earlier I was dissatisfied with the way that dialogs were handled. To many magic numbers being thrown around - which is never a good sign. So here's a simple dialog system that uses an image as a dialog and puts it to the centre of the screen and awaits a click on one of the buttons (which are just designated rectangles in the image). It also casts a transparent shadow.

Designed to handle nothing more than "new game / resume game / quit" style dialogs. See the dialog and click on a button.

There is a variable, dialogs_debug, which when set to true will draw a red box around the button and print the button's name.

I realise that this is the umpteenth half arsed implementation of a dialog box but that's what I like about Lua. It's easy to knock out your own tools :megagrin:
Attachments
simple_dialogs.love.zip
A simple system for displaying a dialog box
(20.1 KiB) Downloaded 469 times
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: Basic dialog boxes (another wheel reinvented)

Post by osuf oboys »

It's a good start!

American English is the usual naming convention though, e.g. initialising -> initializing.

I believe that you may want to write a class for dialogs and write the system so that multiple ones can be active at once. e.g. by having the draw function call the draw of every active dialog, and similar for mouse clicks.

Take a look at Leif GUI: http://love2d.org/forum/viewtopic.php?f=5&t=261
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
User avatar
Peter Hickman
Prole
Posts: 15
Joined: Fri Jan 30, 2009 8:19 am

Re: Basic dialog boxes (another wheel reinvented)

Post by Peter Hickman »

Leif certainly looks good. I'll keep that one squirrelled away for when I need something more sophisticated.
Post Reply

Who is online

Users browsing this forum: No registered users and 91 guests