Hi,
I’ve made a library that requires all game objects to implement SSObject (an interface which lets the objects be serialized/turned into bytes), but I want to use another library in my code: JBox2D (http://www.box2d.org/forum/viewtopic.php?f=5&t=36&start=30). Obviously JBox2D objects don’t implement SSObject, so I have to either
- Change their source code so that everything extends SSObject
- Extend every one of their classes with my own class and make that class implement SSObject.
I’ve done option 1 before because it’s very direct and easy to do. But obviously it sucks when a new release of jBox2D comes out because then I have to do it all over again
:’(
With extending every one of their classes, it will be a lot of work since I’ll probably have to over-ride many methods. JBox2D would create its own objects internally which would not be my extended objects that implement SSObject. For example the JBox2D World might create lots of Body’s in its constructor, but my SSWorld which extends World but implements SSObject would have to over-ride the World contructor and make SSBody’s, which extends Body but implements SSObject.
So both options are a pain in the neck. What do you guys do with such problems?? The SSObject class has just a few methods, basically writeObject(outStream) and readObject(inStream).
Thanks,
Keith


