|
Buffering class for datafiles. |
julian_boolean
Member #8,201
January 2007
|
I seen this thread http://www.allegro.cc/forums/thread/590302 for a buffering class someone made and was wondering if there is any floating around that work with datafiles instead? |
CGamesPlay
Member #2,559
July 2002
|
Thanks for searching the forum before you posted, but I am not quite sure what it is you want to accomplish. -- Ryan Patterson - <http://cgamesplay.com/> |
julian_boolean
Member #8,201
January 2007
|
No problem? hehe Well okay.. I got a function in each state of my game that looks something like this: I want to try to find a way to remove this function all together and just put a buffer through the class?.. If that makes sense. |
Steve Terry
Member #1,989
March 2002
|
I just hope you realize first off that the class you are referring to is severely broken and as far as I can tell does nothing than blit the image to location x, y and push the pointer into a vector which serves no purpose. ___________________________________ |
julian_boolean
Member #8,201
January 2007
|
Nm about the whole thing, I'll find a way to do it myself since I'm having trouble explaining what I want. The code I posted was just a very, very small example.. Not even my actual code. (edit) Oh you mean that guy's code? Well I want to find a way to put all the objects I create into a vector and buffer them, without actually having to say yknow.. button_instance_name->draw(buffer) |
Steve Terry
Member #1,989
March 2002
|
Yes that guys code. What do you want in a buffering class? If you mean the ability to switch between buffered modes (i.e. double, triple, page flipping) then there are plenty of examples in the forums. If on the other hand you want some kind of class which all widgets draw to you can create a simple class that creates a buffer and has a draw method which blits it to the screen. You can create a singleton instance of this class which means there is only one copy of it and each widget can get the instance and blit to it.
In your class you simply do this:
Also you can have in the singleton display class a vector of pointers to base objects that have a draw method and upon flip you can simply iterate through those classes and have them draw to its buffer. That would work as well. A vector of bitmaps like the other guys class wouldn't work for what you want. ___________________________________ |
julian_boolean
Member #8,201
January 2007
|
Ohhhhhh!! That looks good, going to fool around with that for a bit. Thanks a bunch! |
Steve Terry
Member #1,989
March 2002
|
Alternative method which may be more of what you are looking for:
So you create somewhere a Display object and add your widgets to it, then in a main draw function you call display->flip(). Easy enough? [edit] ___________________________________ |
ImLeftFooted
Member #3,935
October 2003
|
Damn, I was hoping this thread would be about adding a buffer for the datafile system to allow partial loading / unloading of datafiles. I'm currently trying to figure out just that nightmare to lower my memory usage ... But being on topic, I have a class that just does this. It is not particularly clean as I wrote it years ago (and I had horrible style then). The class works very well though, if you would like it I can post its source maybe? |
Thomas Fjellstrom
Member #476
June 2000
|
Quote: I'm currently trying to figure out just that nightmare to lower my memory usage ... -- |
julian_boolean
Member #8,201
January 2007
|
I would like to see it if you want to post it. Going to try out everyone's code/ideas to see what works best for me. Thanks! |
|