adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] I'm back !!!


From: Kai Sterker
Subject: Re: [Adonthell-devel] I'm back !!!
Date: Mon, 18 Feb 2002 13:54:23 +0100 (CET)

On 18 Feb 2002 13:25:29 +0100 Alexandre Courbot wrote

> Well, I'm rather for limiting callbacks at maximum (for the window
> system and such, where they are nearly mandatory) - but I don't know
> exactly what you have in mind.

[...]

>> As for the callback mechanism, I guess you could do it similar to Java.
>> I think input stuff is handled pretty good there, despite my feelings for
>> Java as such ;).
> 
> Java? What's that? ;)
> Maybe you can describe a bit how it works - but I feel like callbacks
> aren't the best way to handle events. And the fact that Java uses them
> only strenghten my opinion ;)

Well, you might say real men need no garbage collector, and complain that
there are no pointers. I'd be willing to argue about the pointers, but I
thing the gc is rather useful.

And I think the use of interfaces is much cleaner than C++ style multiple
inheritance.

I didn't like Java, because it is interpreted, but you can get native 
compilers now, so that's no longer an issue.

Still I don't like to have declarations and definitions in the same file.
And if they made it completely OO, why aren't the base types objects then!?

But no more about this ;).


As for the key-callbacks:

Basically, each object that wants to recieve keyboard input implements the
KeyListener interface
(http://java.sun.com/j2se/1.4/docs/api/java/awt/event/KeyListener.html).

I'm not totally certain about it, but I guess the input handler has a list
of KeyListeners, and if your object wants to get notified of keypresses,
you register it with the handler.

And if a key is pressed, the handler would just call the keyPressed()
method of each listener in it's list.

Then each object could check what key has been pressed, and react
accordingly.


Is that comparable to the signals you suggested, Sphair? I remember
hearing the term, but I don't remember any details. (Isn't that what
Qt/KDE does - slots and signals and all that?).

Kai





reply via email to

[Prev in Thread] Current Thread [Next in Thread]