From: Beal, S. <Ste...@co...> - 2000-05-31 09:08:47
|
Rusty writes: >The thing I was running into with this (apart from having trouble getting >at the current image name when saving & loading) is that if you have 10 >tanks on the board (all using the same images), You don't need the current image name when saving/loading. Calling ImageFlipper::current() will return it, but you don't need it. Calling GPiece::getPixmapString() will return an encoded list of image names, including the number of the current one (okay, the number part isn't done yet, but it's just a 15-minute job that I'll do tonight or tomorrow). Passing that string back to GPiece::setPixmapString() will decode it and all just fine, and will (tonight) set the current pixmap to the selected number automatically (or #0, by default). This isn't the friendlist approach for people wanting to write anything to do with the pixmap itself or the name of the pixmap, but people shouldn't directly manipulate the pieces' pixmaps anyway (though there are probably uses for this, I'd rather avoid it for now). I am going to add some functions to make collecting this info easier, though: - Add to GPiece: const QPixmap &getPixmap() QString getPixmapName() These will return the current values for the pixmap. It's actually not as cumbersome as it sounds (I only know this because of Java GUB). Also, to address the concern about the messy savegames: I will change GPiece:: and ImageFlipper::getPixmapString() to return paths relative to the gameset.root. Currently it only does this if it was passed that way (which only happens when you programmatically add a piece with a relative filename). When you double-click and image to add it to the board, it'll get the full name. This will be made relative, though - I'm just not yet sure if I wanna "fix" this in GPiece, DirView, or GUB::addGraphic(). Probably GPiece, so it'll be usable "out of the box" for all classes. ----- Stephan Beal Generic Technically-Inclined Employee Compaq EMEA Consumer Product Development Center +49 (89) 9392 4922 http://pdcweb/preplan and http://155.61.104.229 (Only Within Compaq) "Fear can stop you loving. Love can stop your fear." -- Morcheeba |