| 1 | /*(LGPL) |
| 2 | ------------------------------------------------------------ |
| 3 | Game State Manager |
| 4 | ------------------------------------------------------------ |
| 5 | * Copyright (C) 2001-2003, David Olofson |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU Lesser General Public License as published by |
| 9 | * the Free Software Foundation; either version 2.1 of the License, or (at |
| 10 | * your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public License |
| 18 | * along with this program; if not, write to the Free Software Foundation, |
| 19 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef _GAMESTATEMANAGER_H_ |
| 23 | #define _GAMESTATEMANAGER_H_cxx . . $ `gamestate.h:23:9`! |
| 24 | |
| 25 | class gamestatemanager_tcxx . . $ gamestatemanager_t#; |
| 26 | |
| 27 | class gamestate_tcxx . . $ gamestate_t# |
| 28 | { |
| 29 | friend class gamestatemanager_tcxx . . $ gamestatemanager_t#; |
| 30 | private: |
| 31 | gamestate_tcxx . . $ gamestate_t# *nextcxx . . $ gamestate_t#next.; //LIFO stack |
| 32 | gamestatemanager_tcxx . . $ gamestatemanager_t# *managercxx . . $ gamestate_t#manager.; |
| 33 | protected: |
| 34 | const char *namecxx . . $ gamestate_t#name.; |
| 35 | int unicodecxx . . $ gamestate_t#unicode.; //for last press()/release() |
| 36 | void popcxx . . $ gamestate_t#pop(49f6e7a06ebc5aa8).(); |
| 37 | |
| 38 | virtual void presscxx . . $ gamestate_t#press(d4f767463ce0a6b3).(int button); |
| 39 | virtual void releasecxx . . $ gamestate_t#release(d4f767463ce0a6b3).(int button); |
| 40 | virtual void poscxx . . $ gamestate_t#pos(3e454b8ccf442868).(int x, int y); |
| 41 | virtual void deltacxx . . $ gamestate_t#delta(3e454b8ccf442868).(int dx, int dy); |
| 42 | |
| 43 | virtual void entercxx . . $ gamestate_t#enter(49f6e7a06ebc5aa8).(); |
| 44 | virtual void leavecxx . . $ gamestate_t#leave(49f6e7a06ebc5aa8).(); |
| 45 | virtual void yieldcxx . . $ gamestate_t#yield(49f6e7a06ebc5aa8).(); |
| 46 | virtual void reentercxx . . $ gamestate_t#reenter(49f6e7a06ebc5aa8).(); |
| 47 | |
| 48 | virtual void framecxx . . $ gamestate_t#frame(49f6e7a06ebc5aa8).(); //Control system stuff |
| 49 | virtual void pre_rendercxx . . $ gamestate_t#pre_render(49f6e7a06ebc5aa8).(); //Background rendering |
| 50 | virtual void post_rendercxx . . $ gamestate_t#post_render(49f6e7a06ebc5aa8).(); //Foreground rendering |
| 51 | public: |
| 52 | gamestate_tcxx . . $ gamestate_t#gamestate_t(49f6e7a06ebc5aa8).(); |
| 53 | virtual ~cxx . . $ gamestate_t#`~gamestate_t`(ced63f7c635d850d).gamestate_tcxx . . $ gamestate_t#(); |
| 54 | }; |
| 55 | |
| 56 | |
| 57 | class gamestatemanager_tcxx . . $ gamestatemanager_t# |
| 58 | { |
| 59 | private: |
| 60 | gamestate_tcxx . . $ gamestate_t# *topcxx . . $ gamestatemanager_t#top.; //Stack top |
| 61 | public: |
| 62 | gamestatemanager_tcxx . . $ gamestatemanager_t#gamestatemanager_t(49f6e7a06ebc5aa8).(); |
| 63 | ~cxx . . $ gamestatemanager_t#`~gamestatemanager_t`(ced63f7c635d850d).gamestatemanager_tcxx . . $ gamestatemanager_t#(); |
| 64 | |
| 65 | /* Event router interface */ |
| 66 | void presscxx . . $ gamestatemanager_t#press(3e454b8ccf442868).(int button, int unicode = 0); |
| 67 | void releasecxx . . $ gamestatemanager_t#release(3e454b8ccf442868).(int button, int unicode = 0); |
| 68 | void poscxx . . $ gamestatemanager_t#pos(3e454b8ccf442868).(int x, int y); |
| 69 | void deltacxx . . $ gamestatemanager_t#delta(3e454b8ccf442868).(int dx, int dy); |
| 70 | |
| 71 | /* CS frame and rendering callbacks */ |
| 72 | void framecxx . . $ gamestatemanager_t#frame(49f6e7a06ebc5aa8).(); |
| 73 | void pre_rendercxx . . $ gamestatemanager_t#pre_render(49f6e7a06ebc5aa8).(); |
| 74 | void post_rendercxx . . $ gamestatemanager_t#post_render(49f6e7a06ebc5aa8).(); |
| 75 | |
| 76 | /* State management */ |
| 77 | void changecxx . . $ gamestatemanager_t#change(986b9106f7eb93e3).(gamestate_tcxx . . $ gamestate_t# *gs); |
| 78 | void pushcxx . . $ gamestatemanager_t#push(986b9106f7eb93e3).(gamestate_tcxx . . $ gamestate_t# *gs); |
| 79 | void popcxx . . $ gamestatemanager_t#pop(49f6e7a06ebc5aa8).(); |
| 80 | gamestate_tcxx . . $ gamestate_t# *currentcxx . . $ gamestatemanager_t#current(1d7a3439b3301cd3).(); |
| 81 | gamestate_tcxx . . $ gamestate_t# *previouscxx . . $ gamestatemanager_t#previous(1d7a3439b3301cd3).(); |
| 82 | }; |
| 83 | |
| 84 | #endif /*_GAMESTATEMANAGER_H_*/ |