[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Adonthell-devel] I'm back !!!
From: |
joel vennin |
Subject: |
Re: [Adonthell-devel] I'm back !!! |
Date: |
Mon, 18 Feb 2002 14:05:42 +0100 (CET) |
--- Alexandre Courbot
<address@hidden> a écrit : >
> > Yes, that would be a lot cleaner. So you would
> basically register a
> > callback if you want to get notified of keypresses
> and all that.
>
> Callbacks? Mmm, maybe that's a bit much. How about a
> queue of cathced
> events (similar to SDL)?
>
> > As we only care for a dozend buttons or so, you
> might even have individual
> > callbacks for each key (or groups of keys). Like
> one callback for movement
> > keys, another one for action keys, etc.
> >
> > Just a random idea; not sure if it's feasible or
> useful.
>
> 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.
>
> > Completely right. In the main programm we should
> just use the keys we
> > defined ourselves. And the input system would just
> map physical keys and
> > buttons and whatnot to those logical keys.
>
> Exact. This would also make the higher-level game
> layer totally
> independant from SDL. That way, if we decide to make
> Adonthell runnable
> on Clanlib, or anything else too, we could do it by
> only tweaking a bit
> the image, audio and input classes.
>
> > 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 ;)
I'm not sure about give a callback for each key, for
me, i think:
class input_manager
{
vector<input_client> client;
//this is the object which receive in first the
input event
input_client * cur;
update()
{
in this function update all input (mouse, keyboard,
...)
next update cur object
and if cur doesn't use the event we iterate the
vector while an object doesn't use the event
}
}
class input_client
{
//abstract class
// a constructor when this object is created
automaticly it is added in input_manager
//a bool represent if this object is able to take
event
bool event_enable;
//maybe other stuff
};
class mouse_client: public input_client
{
virtual void on_mouse_click();
virtual void on_mouse_press();
....
}
and the same for the keyboard.
An example if you want in map view browse the map
class map_view_browse:public keyboard_client
{
redefined some virtual method of keyboard_client
}
We can also add for mouse_client, keyboard_client a
callback for each event, a callback for
on_mouse_press()
In this case you are not oblige to inherite your class
with mouse_client
you can create in your class an object like
mapview mv;
mouse_client mc(&mv);
mc.set_callback(mc.MOUSE_PRESS, action_method);
It's just some examples and a possible orientation.
So i wait your ideas and suggestion
Jol
> Alex.
> --
> http://www.gnurou.org
>
>
>
> _______________________________________________
> Adonthell-devel mailing list
> address@hidden
>
http://mail.freesoftware.fsf.org/mailman/listinfo/adonthell-devel
___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com
- Re: [Adonthell-devel] I'm back !!!, (continued)
- Re: [Adonthell-devel] I'm back !!!, Kai Sterker, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Alexandre Courbot, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Kai Sterker, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Alexandre Courbot, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Kai Sterker, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Alexandre Courbot, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Kenneth Gangstoe, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!,
joel vennin <=
- Re: [Adonthell-devel] I'm back !!!, Alexandre Courbot, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Kai Sterker, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Alexandre Courbot, 2002/02/18
- Re: [Adonthell-devel] I'm back !!!, Kai Sterker, 2002/02/18