It's a great start. I'll only add one thing to what Kai said. The removal from the cache call needs to be improved. Basically free_surface needs to be easier to call. Passing in a 'surface *' would be better, but what I've been working towards is change the return value of surface_cache from 'surface *' to 'surfaceref *'. Then deleting surfaceref would decrease the ref counter automatically.
If you want to finish up the cache things, I'll let you make the changes. If you want to work on another task, I'll take what you have and get it Integrated with Kai's comments. Just let us know. Tyler On Feb 7, 2008 1:43 PM, Kai Sterker <[EMAIL PROTECTED]> wrote: > On Feb 7, 2008 5:33 PM, Rian Shelley <[EMAIL PROTECTED]> wrote: > > I'll leave the final word (and integration) to Tyler, but it looks > like a good start to me :-). Thanks a lot! > > > Some comments (that hopefully help to get an even better understanding > of the codebase): > > * the gfx::setup(...) method could be used to create the cache and > read the initial cache size from configuration. It's called during > engine startup (see main/adonthell.cc). > Something like > > s_int32 cache_size = cfg.get_int ("Video", "CacheSize", > DEFAULT_CACHE_SIZE); > surfaces->setmaxmem (cache_size < 0 ? DEFAULT_CACHE_SIZE : cache_size); > > would do the trick. Btw., the way you calculate the surface size seems > good to me. > > * similarly, the gfx::cleanup() method could be used to free the cache. > > * the animation class currently loads surfaces, but never releases them. > > * we've defined system-independent int-types in base/types.h (that > still need to be properly initialized by the build system). Their use > is preferred, although as long as no serialization is involved, > there's no harm in not using them. > > There are a couple cosmetic issues like mixture of tabs and spaces or > not having the cache class in a separate set of files (am I doing too > much Java at work? ;-)) and method names without underscores between > words, but none of that is a big deal. Since there is no real style > guide, none of that would have been obvious. > > > So, are there any other tasks you're interested in? Let us know and we > can either discuss stuff via adonthell-devel, IRC or IM. > > Kai > > > Here it is! > > > > A small summary of the changes: > > I added a _size private member variable to the base surface class, > > since I couldn't see a way to compute the amount of memory that a > > surface used. > > I created a surface_cacher class with get_surface(), free_surface(), > > and purge() methods. > > I created a global instance of the surface_cacher class called surfaces > > I changed the surface_cache() function in gfx.cc to make a call to > > surfaces->get_surface() > > > > I did some basic tests on the class, and it seems to be functional. > > > > > > On Feb 7, 2008 7:51 AM, Tyler Nielsen <[EMAIL PROTECTED]> wrote: > > > No worries here. I'd be happy to go through any diffs you have. I > can > > > combine it with what I have, and we can figure it out from there. > > > > > > Tyler > > > > > > > > > > > > On Feb 7, 2008 6:01 AM, Kai Sterker <[EMAIL PROTECTED]> wrote: > > > > > > > On Feb 6, 2008 11:57 PM, Rian Shelley <[EMAIL PROTECTED]> wrote: > > > > > > > > Hi Rian, > > > > > > > > your help is very welcome, of course. As you've probably seen, we > need > > > > more (active) developers to make faster progress ... which should > > > > create even more interest in the project. > > > > > > > > So please submit your diffs. > > > > > > > > > > > > It is a bit unfortunate that Tyler has been working on the same > part. > > > > Maybe he can have a look at your code as well and decide which to > use. > > > > > > > > Kai > > > > > > > > > > > > > > > > > > > > > > > > > I've long wanted to write a decent game similar to Adonthell. All > my > > > > > own starts at a game engine have been abandoned due to poor design > :D. > > > > > Id really like to help out if i could. > > > > > > > > > > Just to get my feet wet and get an idea of the architecture, I > > > > > implemented the Gfx Cache as described here: > > > > > http://adonthell.berlios.de/doc/index.php/Tasks:Gfx_Cache > > > > > > > > > > I updated the gfx::surface_cache() function so that it simply > makes a > > > > > call to a global instance of the new class. > > > > > > > > > > Let me know if you guys are interested, and I'll forward on some > diff > > > files > > > > > > > > > > > > > > > _______________________________________________ > > > > > Adonthell-devel mailing list > > > > > Adonthell-devel@nongnu.org > > > > > http://lists.nongnu.org/mailman/listinfo/adonthell-devel > > > > > > > > > > > > > > > > > _______________________________________________ > > > > Adonthell-devel mailing list > > > > Adonthell-devel@nongnu.org > > > > http://lists.nongnu.org/mailman/listinfo/adonthell-devel > > > > > > > > > > > > > _______________________________________________ > > > Adonthell-devel mailing list > > > Adonthell-devel@nongnu.org > > > http://lists.nongnu.org/mailman/listinfo/adonthell-devel > > > > > > > > > > _______________________________________________ > > Adonthell-devel mailing list > > Adonthell-devel@nongnu.org > > http://lists.nongnu.org/mailman/listinfo/adonthell-devel > > > > > > > _______________________________________________ > Adonthell-devel mailing list > Adonthell-devel@nongnu.org > http://lists.nongnu.org/mailman/listinfo/adonthell-devel >
_______________________________________________ Adonthell-devel mailing list Adonthell-devel@nongnu.org http://lists.nongnu.org/mailman/listinfo/adonthell-devel