]> Dogcows Code - chaz/yoink/blob - src/GameLayer.hh
game loop tweaks; shapes hierarchy defined
[chaz/yoink] / src / GameLayer.hh
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 #ifndef _GAMELAYER_HH_
13 #define _GAMELAYER_HH_
14
15 /**
16 * @file GameLayer.hh
17 * This is the big enchilada.
18 */
19
20 #include <iostream>
21 #include <string>
22 #include <vector>
23
24 #include <boost/shared_ptr.hpp>
25
26 #include <Moof/Layer.hh>
27 #include <Moof/Math.hh>
28 #include <Moof/Sound.hh>
29
30 #include <Moof/Line.hh> // TODO
31 #include <Moof/Plane.hh>
32 #include <Moof/Ray.hh>
33 #include <Moof/Sphere.hh>
34 #include <Moof/Timer.hh>
35
36 #include "GameState.hh"
37 #include "Hud.hh"
38
39
40 class GameLayer;
41 typedef boost::shared_ptr<GameLayer> GameLayerP;
42
43 class GameLayer : public Mf::Layer
44 {
45 public:
46
47 GameLayer();
48
49 static GameLayerP alloc()
50 {
51 return GameLayerP(new GameLayer);
52 }
53
54 void addedToCore();
55
56 void update(Mf::Scalar t, Mf::Scalar dt);
57 void draw(Mf::Scalar alpha) const;
58 bool handleEvent(const Mf::Event& event);
59
60 private:
61
62 void loadSceneLoader();
63 void advanceScene();
64
65 void thinkTimer();
66
67 void setProjection();
68 void setProjection(Mf::Scalar width, Mf::Scalar height);
69
70 GameState mState;
71 Mf::Timer mThinkTimer;
72
73 HudP mHud;
74
75 Mf::SoundStream mMusic;
76 Mf::Sound mPunchSound;
77
78 Mf::Ray2 mRay;
79 Mf::Line2 mLine;
80 Mf::Circle mCircle;
81
82 Mf::Timer mRayTimer;
83 void rayTimer();
84 };
85
86
87 #endif // _GAMELAYER_HH_
88
This page took 0.035821 seconds and 5 git commands to generate.