00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef IO_PARSER
00034 #define IO_PARSER
00035
00036 #include <stdio.h>
00037 #include <string>
00038
00039 #include "../util/gllist.h"
00040
00041 class TiXmlNode;
00042
00043
00044 class KrDom
00045 {
00046 public:
00047 struct Frame
00048 {
00049 Frame() : x( 0 ), y( 0 ), width( 0 ), height( 0 ), hotspotX( 0 ),
00050 hotspotY( 0 ), deltaX( 0 ), deltaY( 0 ),
00051 isotile( 0 ), hasHotspot( false ), hasDelta( false ) {}
00052
00053 int x;
00054 int y;
00055 int width;
00056 int height;
00057 int hotspotX;
00058 int hotspotY;
00059 int deltaX;
00060 int deltaY;
00061 int isotile;
00062
00063 bool hasHotspot;
00064 bool hasDelta;
00065 };
00066
00067 struct Tile
00068 {
00069 Tile() : x( 0 ), y( 0 ), size( 0 ) {}
00070
00071 int x;
00072 int y;
00073 int size;
00074 };
00075
00076 static void ReadFrameAttributes( const TiXmlNode* node,
00077 KrDom::Frame* frame );
00078
00079 static void ReadTileAttributes( const TiXmlNode* node,
00080 KrDom::Tile* tile );
00081
00082 static const TiXmlNode* ReadFrame( const TiXmlNode* action, int frameNumber );
00083
00084 static int CountChildren( const TiXmlNode* node, const std::string& value );
00085 };
00086
00087
00088 #endif