]> Dogcows Code - chaz/yoink/blob - src/TitleLayer.cc
destroyed global classes; view hierarchy instead
[chaz/yoink] / src / TitleLayer.cc
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #include <Moof/OpenGL.hh>
13
14 #include "GameLayer.hh"
15 #include "TitleLayer.hh"
16
17
18 void TitleLayer::didAddToView()
19 {
20 mFadeIn.init(0.0, 1.0);
21 mFadeIn.reset(0.1);
22
23 //mGameLayer = GameLayer::alloc();
24 }
25
26 void TitleLayer::update(Mf::Scalar t, Mf::Scalar dt)
27 {
28 mFadeIn.update(t, dt);
29 Mf::View::update(t, dt);
30 }
31
32 void TitleLayer::draw(Mf::Scalar alpha) const
33 {
34 glClearColor(0.0, 0.0, mFadeIn.getState(alpha), 1.0);
35 glClear(GL_COLOR_BUFFER_BIT);
36 Mf::View::draw(alpha);
37 }
38
39 bool TitleLayer::handleEvent(const Mf::Event& event)
40 {
41 if (Mf::View::handleEvent(event)) return true;
42
43 switch (event.type)
44 {
45 case SDL_KEYUP:
46 if (event.key.keysym.sym == SDLK_ESCAPE)
47 {
48 parent().removeChild(this);
49 return true;
50 }
51
52 mGameLayer = GameLayer::alloc();
53 parent().addChild(mGameLayer);
54
55 parent().removeChild(this);
56
57 //Mf::Lerp interp(0.1);
58 //interp.init(0.0, 1.0);
59
60 //Mf::Transition<Mf::Lerp>::Ptr transition =
61 //Mf::Transition<Mf::Lerp>::alloc(mGameLayer, titleLayer,
62 //interp);
63
64 return true;
65 }
66
67 return false;
68 }
69
This page took 0.036064 seconds and 4 git commands to generate.