use only triangles; no quads
[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::did_add_to_view()
19 {
20 mFadeIn.init(0.0, 1.0, 0.15);
21
22 //mGameLayer = GameLayer::alloc();
23 }
24
25 void TitleLayer::update(moof::scalar t, moof::scalar dt)
26 {
27 mFadeIn.update(t, dt);
28 moof::view::update(t, dt);
29 }
30
31 void TitleLayer::draw(moof::scalar alpha) const
32 {
33 glClearColor(mFadeIn.state(alpha), 0.0, mFadeIn.state(alpha), 1.0);
34 glClear(GL_COLOR_BUFFER_BIT);
35 moof::view::draw(alpha);
36 }
37
38 bool TitleLayer::handle_event(const moof::event& event)
39 {
40 if (moof::view::handle_event(event)) return true;
41
42 switch (event.type)
43 {
44 case SDL_KEYUP:
45 if (event.key.keysym.sym == SDLK_ESCAPE)
46 {
47 parent().stop();
48 return true;
49 }
50
51 mGameLayer = GameLayer::alloc();
52 parent().add_child(mGameLayer);
53
54 parent().remove_child(this);
55
56 //moof::lerp_scalar interp(0.1);
57 //interp.init(0.0, 1.0);
58
59 //moof::Transition<moof::lerp_scalar>::Ptr transition =
60 //moof::Transition<moof::lerp_scalar>::alloc(mGameLayer, titleLayer,
61 //interp);
62
63 return true;
64 }
65
66 return false;
67 }
68
This page took 0.031801 seconds and 4 git commands to generate.