/*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * * vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * **************************************************************************/ #include #include "GameLayer.hh" #include "TitleLayer.hh" void TitleLayer::didAddToView() { mFadeIn.init(0.0, 1.0); mFadeIn.reset(0.1); //mGameLayer = GameLayer::alloc(); } void TitleLayer::update(Mf::Scalar t, Mf::Scalar dt) { mFadeIn.update(t, dt); Mf::View::update(t, dt); } void TitleLayer::draw(Mf::Scalar alpha) const { glClearColor(0.0, 0.0, mFadeIn.getState(alpha), 1.0); glClear(GL_COLOR_BUFFER_BIT); Mf::View::draw(alpha); } bool TitleLayer::handleEvent(const Mf::Event& event) { if (Mf::View::handleEvent(event)) return true; switch (event.type) { case SDL_KEYUP: if (event.key.keysym.sym == SDLK_ESCAPE) { parent().stop(); return true; } mGameLayer = GameLayer::alloc(); parent().addChild(mGameLayer); parent().removeChild(this); //Mf::Lerp interp(0.1); //interp.init(0.0, 1.0); //Mf::Transition::Ptr transition = //Mf::Transition::alloc(mGameLayer, titleLayer, //interp); return true; } return false; }