欢迎来到虫虫下载站 | 资源下载 资源专辑 关于我们
虫虫下载站

fadeoutstate.cpp

Source code (C++) of the Amoebax game for Symbian OS UIQ3.x。
CPP
字号:
//// Cross-platform free Puyo-Puyo clone.// Copyright (C) 2006, 2007 Emma's software//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or// (at your option) any later version.//// This program is distributed in the hope that it will be useful,// 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//#if defined (HAVE_CONFIG_H)#include <config.h>#endif // !HAVE_CONFIG_H#include "FadeOutState.h"#include "System.h"using namespace Amoebax;////// \brief Constructor.////// \param fadeTime The time the fade should take in milliseconds.///FadeOutState::FadeOutState (uint32_t fadeTime):    IState (),    m_Alpha (255),    m_Background (0),    m_FadeTime (fadeTime){}voidFadeOutState::activate (void){    m_Background.reset (Surface::fromScreen ());    m_Background->setAlpha (getAlpha ());}////// \brief The current alpha to apply to the screen.////// \return The current alpha value to apply to the screen.///inline int16_tFadeOutState::getAlpha (void) const{    return m_Alpha;}////// \brief Gets the time the fade should take, in milliseconds.////// \return The time the fade should take, in milliseconds.///inline uint32_tFadeOutState::getFadeTime (void) const{    return m_FadeTime;}voidFadeOutState::redrawBackground (SDL_Rect *region, SDL_Surface *screen){    SDL_FillRect (screen, region, SDL_MapRGB (screen->format, 0, 0, 0));}voidFadeOutState::render (SDL_Surface *screen){    m_Background->blit (screen);}////// \brief Sets the alpha value to apply to the screen.////// \param alpha The alpha value to set to the screen.///inline voidFadeOutState::setAlpha (int16_t alpha){    m_Alpha = alpha;}voidFadeOutState::update (uint32_t elapsedTime){    setAlpha (getAlpha () -              static_cast<int16_t>(Surface::k_MaxAlpha *                    static_cast<float> (elapsedTime) / getFadeTime ()));    if ( getAlpha () > 0 )    {        m_Background->setAlpha (getAlpha ());    }    else    {        System::getInstance ().removeActiveState (false);    }}voidFadeOutState::videoModeChanged (void){}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -