On Thu, Sep 22, 2011 at 11:54 PM, StyxD <sty...@gmail.com> wrote: > Ok, I'm moving very slowly with this one. I had some problems last > week and I don't think I'll have that much free time till the end of > this year. Still, I'd like to finish.
No worries there, take your time. > A quick question: I want the comment logic class react to mapview > moving, so that text bubbles can be repositioned and won't go out of > the screen. What would be the best way to do that? I thought about > registering a callback that would be called every game cycle, but it > seems only drawables can do that with thier update() method. Seems even that is a leftover from v0,3 and some misleading code documentation. The only drawable that makes use of update is sprite and that has update hooked to a time event. > Or maybe > just a normal time event that would be raised ex. every 0.2 seconds? > Ultimately, I don't think repositioning is going to be needed that > often, so it just might be enough. That might be a viable approach. You could also extend mapview to allow registering callbacks (would need a list of those, I guess, since more than one bubble could be open at a time) that would get executed when the mapview moves. No need to go the route of events here, something simple like mapview::add_update_listener (base::functor_0 *callback); mapview::remove_update_listener (base::functor_0 *callback); and an array to store the callbacks should be good enough. And it would mean you'd only get notifications if there was an actual change of the mapview position. If your logic class resides on C++ side, it can directly use those methods to register itself for updates. (Also see test/callbacktest.cc for example code). If you want to register callbacks from Python side, you'd need to extend the mapview in py_world.i. There's already an exmplae there, for a callback of pathfinding_manager. Kai _______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/adonthell-devel