]> Dogcows Code - chaz/yoink/blobdiff - src/TitleLayer.cc
foundational changes; tying up some loose ends
[chaz/yoink] / src / TitleLayer.cc
index a12168a9639eeeaf047b28b0317883e1906c184b..f5e4ef02a423300c928e5cc77c52dd153dfc96af 100644 (file)
 #include "TitleLayer.hh"
 
 
-void TitleLayer::pushed(Mf::Engine& e)
+void TitleLayer::pushed(Mf::Engine& engine)
 {
-       engine = &e;
-
        Mf::Scalar coeff[] = {0.0, 1.0};
-       fadeIn.init(coeff, 0.1);
+       mFadeIn.init(coeff, 0.1);
 
-       gameLayer = GameLayer::alloc();
+       mGameLayer = GameLayer::alloc();
 }
 
-void TitleLayer::update(Mf::Scalar t, Mf::Scalar dt)
+void TitleLayer::update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt)
 {
-       if (!fadeIn.isDone()) fadeIn.update(t, dt);
+       if (!mFadeIn.isDone()) mFadeIn.update(t, dt);
 }
 
-void TitleLayer::draw(Mf::Scalar alpha) const
+void TitleLayer::draw(Mf::Engine& engine, Mf::Scalar alpha) const
 {
-       glClearColor(0.0, 0.0, fadeIn.getState(alpha), 1.0);
+       glClearColor(0.0, 0.0, mFadeIn.getState(alpha), 1.0);
        glClear(GL_COLOR_BUFFER_BIT);
 }
 
-bool TitleLayer::handleEvent(const Mf::Event& event)
+bool TitleLayer::handleEvent(Mf::Engine& engine, const Mf::Event& event)
 {
        switch (event.type)
        {
                case SDL_KEYUP:
-                       Mf::LayerP titleLayer = engine->pop(this);
-                       //engine->pushLayer(GameLayer::alloc());
+                       //if (event.key.keysym.sym == SDLK_ESCAPE)
+                       //{
+                               //break;
+                       //}
+
+                       Mf::LayerP titleLayer = engine.pop(this);
+                       //engine.pushLayer(GameLayer::alloc());
 
-                       Mf::Scalar coeff[] = {0.0, 1.0};
-                       Mf::Lerp interp(coeff, 0.2);
+                       Mf::Scalar coeff[] = {0.0, 0.75, 0.99, 1.0};
+                       Mf::PolynomialInterpolator<3> interp(coeff, 0.1);
 
-                       //Mf::LayerP gameLayer = GameLayer::alloc();
-                       Mf::Transition<Mf::Lerp>::Ptr transition =
-                               Mf::Transition<Mf::Lerp>::alloc(gameLayer, titleLayer, interp);
-                       engine->push(transition);
+                       //Mf::LayerP mGameLayer = GameLayer::alloc();
+                       Mf::Transition<Mf::PolynomialInterpolator<3> >::Ptr transition =
+                               Mf::Transition<Mf::PolynomialInterpolator<3> >::alloc(mGameLayer, titleLayer, interp);
+                       engine.push(transition);
                        return true;
        }
 
This page took 0.021311 seconds and 4 git commands to generate.