Suggestion: Event Object.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Suggestion: Event Object.

Post by appleide »

Whenever event happens, eg. key press, mouse click, on quit, all of these "Event Handler Objects" will be notified.

It is basically a class with some empty functions - onClick, onMousePressed, onKeyPressed, etc.

when user calls "love.events.newEventHandler", a new object will be returned. The user can edit its functions, and when event happens, it will be notified and the corresponding function to the event will be called.

This reduces the number of loops the user will have to write in Lua inside the "function keyreleased( key ) ... end" and "function mousepressed( x, y, button ) ... end" and puts those loops in C instead, thus potentially increasing performance.

i.e, when user makes a set of buttons, user creates an eventhandler for each and every one of those button, instead of looping through each.

Not to mention it is rather convenient.

What do you think?

I have been doing an equivalent thing to LOVE for a while, and after poring over the LOVE documentation this is the only thing I have got to offer. ><
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Suggestion: Event Object.

Post by rude »

Yeah, I see how that can be useful, especially for GUI programming ...

But, because this is feairly easy to implement in Lua, and I don't think the performance gain will be that significant (even when there's many objects), I'm going to focus on more exiting stuff first, like physics (<-- mini preview).

But don't let that pulverize your feedback-mojo. Suggestions, requests, and demands are always welcome. ^^
User avatar
farvardin
Party member
Posts: 167
Joined: Sat Jun 28, 2008 6:46 pm

Re: Suggestion: Event Object.

Post by farvardin »

this physics engine looks great!
User avatar
Sardtok
Party member
Posts: 108
Joined: Thu Feb 21, 2008 2:37 pm
Location: Norway/Norge/諾威/挪威 (Yes, I'm teh back!)
Contact:

Re: Suggestion: Event Object.

Post by Sardtok »

rude wrote:I'm going to focus on more exiting stuff first, like physics (<-- mini preview).
Yeah, physics look awesome, but I think it's more exciting than exiting, but then again, I don't know exactly what it's supposed to be exiting.
Take off every Zigg for great rapist.
Now, outgay that!
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: Suggestion: Event Object.

Post by rude »

:D

It's exiting. It's outta here!
Post Reply

Who is online

Users browsing this forum: No registered users and 203 guests