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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 // 19 #if !defined (AMOEBAX_FADE_IN_STATE_H) 20 #define AMOEBAX_FADE_IN_STATE_H 21 22 #include "IState.h" 23 #include "Surface.h" 24 25 namespace Amoebax 26 { 27 /// 28 /// \class FadeInState 29 /// \brief Fades the screen from black to its contents. 30 /// 31 class FadeInState: public IState 32 { 33 public: 34 FadeInState (IState *nextState, uint32_t fadeTime = 300); 35 36 virtual void activate (void); joyMotion(uint8_t joystick,uint8_t axis,int16_t value)37 virtual void joyMotion (uint8_t joystick, uint8_t axis, int16_t value) { } joyDown(uint8_t joystick,uint8_t button)38 virtual void joyDown (uint8_t joystick, uint8_t button) { } joyUp(uint8_t joystick,uint8_t button)39 virtual void joyUp (uint8_t joystick, uint8_t button) { } 40 #if !defined (IS_GP2X_HOST) keyDown(uint32_t key)41 virtual void keyDown (uint32_t key) { } keyUp(uint32_t key)42 virtual void keyUp (uint32_t key) { } 43 #endif // !IS_GP2X_HOST 44 virtual void redrawBackground (SDL_Rect *region, SDL_Surface *screen); 45 virtual void render (SDL_Surface *screen); 46 virtual void update (uint32_t elapsedTime); 47 virtual void videoModeChanged (void); 48 49 private: 50 int16_t getAlpha (void) const; 51 uint32_t getFadeTime (void) const; 52 void setAlpha (int16_t alpha); 53 54 /// The current alpha value. 55 int16_t m_Alpha; 56 /// The background image to fade. 57 std::auto_ptr<Surface> m_Background; 58 /// The time the fade should take. 59 uint32_t m_FadeTime; 60 /// The state that will be active next. 61 IState *m_NextState; 62 }; 63 } 64 65 #endif // AMOEBAX_FADE_IN_STATE_H 66