X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fscreen.hpp;h=ae07d59ec5060d0a9298161ae047bdb941783887;hb=fb8cef6efacc0dff5faaff6dc4aa638289285099;hp=fd3b8908fe90bef1c7170b2f0df9640c939113bf;hpb=1486ceaaf9dd7a9d2d7e3654550b9a2768df2a56;p=supertux.git diff --git a/src/screen.hpp b/src/screen.hpp index fd3b8908f..ae07d59ec 100644 --- a/src/screen.hpp +++ b/src/screen.hpp @@ -1,5 +1,5 @@ -// $Id: worldmap.hpp 2800 2005-10-02 22:57:31Z matzebraun $ -// +// $Id$ +// // SuperTux // Copyright (C) 2006 Matthias Braun // @@ -12,7 +12,7 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. @@ -21,19 +21,39 @@ class DrawingContext; +/** + * Abstract base class for code the MainLoop runs exclusively and full-screen. + * + * Examples of Screens are: The TitleScreen, a WorldMap, a level's + * GameSession, a TextScroller, ... + */ class Screen { public: virtual ~Screen() {} + /** + * gets called before this screen gets activated (which is at least once + * before the first draw or update call + */ virtual void setup() {} + /** gets called when the current screen is temporarily suspended */ + virtual void leave() + {} + /** + * gets called once per frame. The screen should draw itself in this function. + * State changes should not be done in this function, but rather in update + */ virtual void draw(DrawingContext& context) = 0; + /** + * gets called for once (per logical) frame. Screens should do their state + * updates and logic here + */ virtual void update(float elapsed_time) = 0; }; #endif -