|
A framework thingy with animations and stuff and yummy XML seutp |
Neil Walker
Member #210
April 2000
|
Hello, As an example, assume I have a sprite with a series of animated frames and I want to animate it at 60FPS. I also want the program to run with triple buffering and I want the Framework to control the whole thing, calling everything at the right time. I also want it to intelligently load the graphics (such as stop VRAM->MEM transfers, obtain the best graphics mode if triple buffering isn't supported, etc). The code avoid error handling, etc. has been omitted.
And that's it for a complete timer based loop with little allegro coding. You can find the download at: It's quite simple and there are samples for all the three parts, with make files for devcpp and msvc If anyone's interested in what exactly goes on in the configuration config.xml file that sets everything up: <?xml version="1.0" encoding="UTF-8" ?> <config> <system fps="60" debugon="1" autowritemain="0" autowritecustom="0" enablejoystick="0" enablekeyboard="1" enablemouse="1" enablesound="1" enablemidi="1" matchrefreshrate="1" /> <graphics vsync="0" graphicsmode="3" depthpreferred="32" depthfallback="16" capbmptype="0" /> <window width="640" height="480" autodetect="windowed" /> <sound maxvoicearray="32" samplevolume="150" musicvolume="128" /> <custom name="message" valuestring="Hi Mam" /> </config>
Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
nonnus29
Member #2,606
August 2002
|
I'm very interested in this project, but I'm not coding anything with allegro (or c/c++) at the moment. I would like to try it one day though. This would be an ideal resource to use in the upcoming TINS. |
Rodrigo Monteiro
Member #4,373
February 2004
|
You can't use it on TINS, actually, because of the time availability rule. If you COULD, then I'd also want to upload an updated version of Halley, which is my framework, and part of the reason that I probably won't join TINS (I don't want to use the outdated one) _____________________________ |
Marcello
Member #1,860
January 2002
|
Rodrigo: Apparently you can, for libraries. The 4 week thing is for code you don't release, I believe. Marcello |
Rodrigo Monteiro
Member #4,373
February 2004
|
Well, amarillion said "available in the depot", which Halley isn't. I guess I'll need to ask him. _____________________________ |
Neil Walker
Member #210
April 2000
|
Well, my AXL project has been in the depot for a while now, before TINS was even mentioned. This last release is just a code increment So this 4 week thing is quite interesting - what happens if, say, you use FBlend (from about 2002) but Bob puts up a newer version a few days before TINS to make stuff faster and add a few extra blenders? does this mean you have to use the earlier version only? If anyone's interested I'm knocking up a demo game (a tile based racing game based on an old game called TranzAm) and have saved the incremental versions, if anyone is interested in a tutorial on making a simple tile based scrolling game? Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
CGamesPlay
Member #2,559
July 2002
|
Does it have a facility to use a different file system handler? I want to be able to load from Allegro packfiles, as well as from a custom VFS I have -- Ryan Patterson - <http://cgamesplay.com/> |
Neil Walker
Member #210
April 2000
|
No, just bitmap files. I only ever wanted it to read graphics from single and sheet files to make the XML file simple. Adding other formats would mean a much more complicated XML format. Although saying that, ultimately the file you specify in the XML just gets passed into a load_bmp type function, and don't these functions support stuff like "file.dat#graphic" ? Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
CGamesPlay
Member #2,559
July 2002
|
Yes, but I'd be more interested in being able to install hooks. If the library will only ever load bitmap files, then I'd like to be able to give XML configuration via a const char* (or const std::string&) paramter, and a BITMAP* (*my_load)(const char*) parameter. Framework::Framework(const std::string& config, const std::string& animations, BITMAP* (*load)(const char*)) -- Ryan Patterson - <http://cgamesplay.com/> |
Neil Walker
Member #210
April 2000
|
At the minute, at the graphic frame level I do this: this->Image=load_bmp(filename.c_str(),NULL); Is your change simply a matter of if(load) where "load" is your function pointer Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Rick
Member #3,572
June 2003
|
When I try to extract I get and error: There is a CRC error on file: axl.h and axl_animations.cpp ======================================================== |
Neil Walker
Member #210
April 2000
|
I've just tried it and it works fine, there's been a few downloads and no one else has mentioned it. Maybe it was corruption on downloading? try it again, it should work. I zipped it using winrar and all the default settings and have tried it on winrar and 7-z and both download ok. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
Rodrigo Monteiro
Member #4,373
February 2004
|
Well, if by "the depot" they mean this forum, then I guess I can update Halley. _____________________________ |
CGamesPlay
Member #2,559
July 2002
|
No, my code would be a new overload. I want to be able to do something like...
-- Ryan Patterson - <http://cgamesplay.com/> |
Neil Walker
Member #210
April 2000
|
Actually, that's a really good idea as one of the axl constructors lets you initialise the library without setting up the system so you can override any changes someone makes to the XML before continuing. Your suggestion takes it one step further. tinyXML has a nice little function TiXmlDocument::Parse that effectively does what you want - it reads from a character stream rather than a file - so that'll avoid having to hard code override values but allows you to not have to distribute XML files. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
CGamesPlay
Member #2,559
July 2002
|
Super. Including it will also open up a nice world of possibilities such as reading from zipfiles, and any other interface allegro packfiles have been wrapped around. -- Ryan Patterson - <http://cgamesplay.com/> |
BAF
Member #2,981
December 2002
|
How about a more OOP interface, ie, instead of : BillyTheFish=new Animation(GameLibrary,"billy"); you do: BillyTheFish = GameLibrary->GetAnimation("billy");
|
CGamesPlay
Member #2,559
July 2002
|
Because GameLibrary doesn't need to be a factory for Animation objects? You method isn't more OOP, it just adds extra code to the Framework class for instantiating Animations. Arguably it's even less OOP, because it requires objects to know more about others. -- Ryan Patterson - <http://cgamesplay.com/> |
Marcello
Member #1,860
January 2002
|
It's a different approach. BAF's suggestion would imply that animation objects are more static (you don't have multiple animation objects for a particular animation), and theoretically it could be optimized in the sense that GetAnimation may simply do a lookup and return an existing class, whereas new Animation makes a new animation. I would say that a more oop method with the same functionality would be GameLibrary.new Animation("billy"), but that's just me. However, I haven't even looked at the project itself, so I'm not making a comment on which approach is best. Marcello |
Neil Walker
Member #210
April 2000
|
Hello, The reason is that you might want a class to handle graphics and animation but not necessarily a full framework for game control, paging, etc. Similarly the Configurator class can be used by itself for managing an XML configuration file and starting up Allegro. As for OOP, there are quite a few public data members which of course everyone knows are bad. But there is a choice to be made between hiding everything and making it fast and simple. I chose the latter. Neil. Neil. wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie |
|