1 //
2 // Cross-platform free Puyo-Puyo clone.
3 // Copyright (C) 2006, 2007 Emma's Software
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 #if !defined (AMOEBAX_VERSUS_STATE_H)
20 #define AMOEBAX_VERSUS_STATE_H
21 
22 #include "IState.h"
23 #include "Surface.h"
24 
25 namespace Amoebax
26 {
27     ///
28     /// \class VersusState
29     /// \brief The versus screen.
30     ///
31     class VersusState: public IState
32     {
33         public:
34             VersusState (const std::string &player,
35                          const std::string &opponent);
36 
37             virtual void activate (void);
38             virtual void joyMotion (uint8_t joystick, uint8_t axis,
39                                     int16_t value);
40             virtual void joyDown (uint8_t joystick, uint8_t button);
41             virtual void joyUp (uint8_t joystick, uint8_t button);
42 #if !defined (IS_GP2X_HOST)
43             virtual void keyDown (uint32_t key);
44             virtual void keyUp (uint32_t key);
45 #endif // !IS_GP2X_HOST
46             virtual void redrawBackground (SDL_Rect *region, SDL_Surface *screen);
47             virtual void render (SDL_Surface *screen);
48             virtual void update (uint32_t elapsedTime);
49             virtual void videoModeChanged (void);
50 
51         private:
52             void endVersusState (void);
53             const std::string &getPlayerName (void) const;
54             const std::string &getOpponentName (void) const;
55             void loadGraphicResources (void);
56             bool mustEnd (void) const;
57 
58             /// The background image.
59             std::auto_ptr<Surface> m_Background;
60             /// The background music.
61             std::auto_ptr<Music> m_BackgroundMusic;
62             /// The versus state must end.
63             bool m_End;
64             /// The opponent's name.
65             std::string m_Opponent;
66             /// The player's avatar name.
67             std::string m_Player;
68             /// The time elapsed since the start of the versus mode.
69             uint32_t m_TimeElapsed;
70     };
71 }
72 
73 
74 #endif  // !AMOEBAX_VERSUS_STATE_H
75 
76 
77 
78