00001 #ifndef INCLUDED_SCENE_GRAPH
00002 #define INCLUDED_SCENE_GRAPH
00003
00004 #ifndef INCLUDED_POLYGON
00005 # include "polygon.h"
00006 #endif
00007
00008 #ifndef INCLUDED_PAD
00009 # include "Pad.h"
00010 #endif
00011
00012 class SceneGraph;
00013
00014 typedef void (*move_func)(SceneGraph* node, int screen_w, int screen_h);
00015 typedef void (*collision_func)(SceneGraph* node, int screen_w, int screen_h,
00016 SceneGraph* tree);
00017 typedef SceneGraph* SceneGraphPtr;
00018
00019 class SceneGraph : public Polygon {
00020 public:
00021 SceneGraph(void);
00022 SceneGraph(xmlNodePtr surface);
00023 SceneGraph(SceneGraphPtr orig);
00024 ~SceneGraph(void);
00025
00026
00027
00028 float stack_xyz[3];
00029 float stack_angle[3];
00030
00031
00032 SceneGraphPtr next;
00033 SceneGraphPtr prev;
00034 SceneGraphPtr last;
00035
00036
00037 SceneGraphPtr parent;
00038 SceneGraphPtr brother;
00039 SceneGraphPtr children;
00040 SceneGraphPtr lastChild;
00041
00042
00043 int flag_remove;
00044
00045
00046 int sgid;
00047
00048
00049 int flag_drawable;
00050
00051
00052 int frame;
00053
00054
00055 move_func move;
00056 collision_func collision;
00057
00058
00059 void (SceneGraph::*finalize)(void);
00060
00061 void init(void);
00062 void finalize_original(void);
00063 void finalize_copy(void);
00064 void move_execute(int screen_w, int screen_h);
00065 void collision_check(int screen_w, int screen_h, SceneGraphPtr tree);
00066 void all_execute(int screen_w, int screen_h);
00067
00068 void add_next(SceneGraphPtr next);
00069 SceneGraphPtr addChild(SceneGraphPtr child);
00070 SceneGraphPtr addBrother(SceneGraphPtr bro);
00071 SceneGraphPtr clone(void);
00072 SceneGraphPtr clone(void *buf);
00073 SceneGraphPtr searchSceneGraph(const char *name);
00074 void set_move_collision(SceneGraphPtr node,
00075 move_func new_move, collision_func new_collision);
00076 void set_move_collision(move_func new_move, collision_func new_collision);
00077 void remove(void);
00078 SceneGraphPtr realRemoveFromTree(SceneGraphPtr tree);
00079 SceneGraphPtr realRemoveFromList(SceneGraphPtr list);
00080 int isRemoved(void);
00081
00082 static void createFromXMLfile(const char *);
00083 static SceneGraphPtr createSceneGraph(int id);
00084
00085 void translate(float x, float y, float z);
00086 void translateX(float x);
00087 void translateY(float y);
00088 void translateZ(float z);
00089
00090
00091 void tree_check(void);
00092 void print_member(void);
00093 void get_data(xmlNodePtr cur);
00094 void delete_data(void);
00095 };
00096
00097 #endif
00098
00099
00100 extern SceneGraphPtr scene_graph;
00101
00102
00103 extern SceneGraphPtr scene_graph_view;