From 5a9232c600b333b325eb14cc91ba1bba1e369283 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 17 Sep 2011 03:20:02 +0200 Subject: new fancy preprocessor stuff for States --- include/game.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'include') diff --git a/include/game.h b/include/game.h index 3476eaa..7382c34 100755 --- a/include/game.h +++ b/include/game.h @@ -1104,6 +1104,23 @@ public: }; +#define DECLARE_STATE(NAME) \ + static State StateID_##NAME; \ + void beginState_##NAME(); \ + void executeState_##NAME(); \ + void endState_##NAME(); + +#define CREATE_STATE(CLASS, NAME) \ + CLASS::State CLASS::StateID_##NAME \ + (#CLASS "::StateID_" #NAME, \ + &CLASS::beginState_##NAME, \ + &CLASS::executeState_##NAME, \ + &CLASS::endState_##NAME); + +#define USING_STATES(CLASS) \ + typedef State State; + + struct LinkListEntry { LinkListEntry *prev; LinkListEntry *next; -- cgit v1.2.3