State.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 5 -*- */
00002 
00003 /* 
00004  * Combination of a first person action and a real time strategy battle game.
00005  */
00006 
00007 /*
00008  * State.h
00009  * MetalWarriors
00010  * $Revision: 1.21 $
00011  *
00012  * Created by Daniel Aarno on Sun Oct 12 2003.
00013  * Copyright (c) 2003 Daniel Aarno and Erik Ytterberg - All rights reserved.
00014  *
00015  *     This program is free software; you can redistribute it and/or modify
00016  *     it under the terms of the GNU General Public License as published by
00017  *     the Free Software Foundation; either version 2 of the License, or
00018  *     (at your option) any later version.
00019  *
00020  *     This program is distributed in the hope that it will be useful,
00021  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *     GNU General Public License for more details.
00024  *
00025  *     You should have received a copy of the GNU General Public License
00026  *     along with this program; if not, write to the Free Software
00027  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00028  */
00029 
00030 #ifndef _STATE_
00031 #define _STATE_
00032 
00033 #include "Interface.h"
00034 class Model;
00035 
00036 typedef enum {
00037      STATE_FIRST = 1000,
00038      STATE_INIT,
00039      STATE_USER_QUIT,
00040      STATE_QUIT,
00041      STATE_MAIN_MENU,
00042      STATE_GAME_INIT,
00043      STATE_GAME_MAIN,
00044      STATE_GAME_OVER,
00045      STATE_LAST
00046 } StateID;
00047 
00048 
00060 class State
00061 {
00062 protected:
00063      StateID ID;
00064      bool stopIntro;
00065      static State* currentState;
00066 
00067 public:
00068      State() : ID(STATE_FIRST), stopIntro(false) { }
00069      State(StateID state);
00070      virtual ~State();
00071 
00073      virtual void paint();
00075      virtual void doKey(int key, int x, int y, bool special, 
00076                         bool down, unsigned int modifiers);
00078      virtual void doMouseDown(Interface::MouseButtonType button, 
00079                      int x, int y) {}
00081      virtual void doMouseUp(Interface::MouseButtonType button, int x, int y) {}
00083      virtual void doMouseDragged(int x, int y) {}
00084      
00089      static void SetState(StateID state);
00094      static void Destroy();
00096      static void DoRepaint();
00098      static void DoKey(int key, int x, int y, 
00099                  bool special, bool down, unsigned int modifiers);
00101      static void DoMouseDragged(int x, int y);
00103      static void DoMouse(int x, int y, 
00104                 Interface::MouseButtonType button, bool down);
00106      static void DoAnimateOneFrame(int value);
00107      
00108      //static void DoResizeScene(int width, int height);
00110      static void SynchronizePreferences(int ignore);
00111 };
00112 
00113 #endif //_STATE_

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7