From: Dan P. <ba...@al...> - 2005-11-27 21:03:06
|
Ok, I'm FINALLY gonna get around to answering this :D (I'm so bad about email...) On Nov 20, 2005, at 11:13 PM, Atani wrote: >> Speaking of Object event handling, I never really discussed why that >> was in there. :D It might be interesting... > > I have been meaning to ask you what you were thinking of doing with > that > stuff :) > > I am thinking it would be a good way to implement the Object > notifications perhaps? What exactly did you mean by Object notifications? I think that already exists unless I'm misunderstanding. > I am quickly getting to the point where the current animations/etc are > not quite enough for Chain Reaction. I need a similar style of event > handling. If I come up with anything that is reasonably decent I will > promote it from CR into Tiki so others can use it as well. Something > that might be useful is completing the Timeline classes which are in > Tiki now, these could (based on docs) support the style of events that > CR and Marbol needs. Yeah, this ought to work already too. I'm actually using them in the latest version of Marbol (I think the public 1.0 release didn't have it, but my SVN version does). I can try to boil down some examples from the code, but it's a pretty nasty mix of old and new styles (and I more or less quit working on it after that). > Actually that would be a good idea to have somehow... I am not sure > how > we would go about doing game logic, unless you include lua into the > mix. > lua is not out of the question for a "game framework" which makes use > of an "uncompiled" definition file. I can certainly see this as a > good way to export the visible bits out of the code though. It would > take a bit of work perhaps to integrate the callbacks, but that should > be doable too, most everything, including animations and "side shows" > can be done via the XML (using Slideshow and similar background > effects). > > This could be a way to describe a lightbar menu: ... > Basically this could define a scene with a static background image > (data/bg.png), a slideshow with 5 slides in it, and a simple lightbar > menu with three options in it all having a unique id assigned in the > XML. The id attribute values could be used as the "return value" from > the scene. Of course this is only an example and does not contain > enough attributes to be very useful. Yeah, that's just the sort of thing I had in mind. It would save a crapload of time that's currently spent doing things like loading up textures, creating Drawables, setting animations and triggers, etc. I could have, e.g., written all of the setup code for Reverie as a big XML file if we'd had a way to go from a string in the XML to a class to instantiate (and that was a lot :). Might be another interesting thing to look into, re Sam's message about Drawable creation. And especially with the string-based Object event slots, we could probably do a system where as long as you write any custom code you need in C++ and wrap it up with something where it can be created via a string lookup, you probably wouldn't need any sort of scripting language. Like I mentioned there, functors would probably be a good thing to do that with. If you guys don't know about 'em, they're basically objects that have an operator(), so you can call them as a function. e.g.: class Foo { public: void operator() { printf("Hello!\n"); } }; void bar() { Foo foo; foo(); } Will result in "Hello!" being printed out. There's some neat stuff in the boost library for doing partially bound functions and lambda-type functions using that stuff. We could import some of that if you guys are interested, since it's about 90% template headers and not dependent on the rest of boost anyway. |