X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FGameLayer.hh;h=4e0a84f07752c4742417930073cf5e1f53f0a71d;hp=c4c5420888b63e5f7b7e7067fd5a9df9172f11da;hb=7f3984f3f9524f5b6813e01ceb2fe576dadff94e;hpb=a4debfe4a5f5d339410788971b698ba00cb7f09c diff --git a/src/GameLayer.hh b/src/GameLayer.hh index c4c5420..4e0a84f 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -36,19 +36,25 @@ #include #include +#include #include #include -#include #include #include #include +#include #include +#include +#include +#include +#include +#include + #include "Character.hh" #include "Heroine.hh" -#include "Hud.hh" #include "Scene.hh" @@ -58,6 +64,7 @@ typedef boost::shared_ptr GameLayerP; class GameLayer : public Mf::Layer { public: + GameLayer(); static GameLayerP alloc() @@ -66,26 +73,46 @@ public: } void pushed(Mf::Engine& engine); - void update(Mf::Scalar t, Mf::Scalar dt); - void draw(Mf::Scalar alpha) const; - bool handleEvent(const Mf::Event& event); + + void update(Mf::Engine& engine, Mf::Scalar t, Mf::Scalar dt); + void draw(Mf::Engine& engine, Mf::Scalar alpha) const; + bool handleEvent(Mf::Engine& engine, const Mf::Event& event); + + struct State + { + // the script object must be mutable because some script functions must be + // called during draw + mutable Mf::Script script; + std::vector sceneList; + + HeroineP heroine; + SceneP scene; + + Mf::PolynomialInterpolator<5> interp; + + Mf::Camera camera; + }; private: - void setProjection(); - void setProjection(Mf::Scalar width, Mf::Scalar height); + void loadSceneLoader(); + void advanceScene(); - Mf::Sound music; + Mf::Scalar getZCoord(const Mf::Vector2& position) const; - HeroineP heroine; - SceneP scene; - Mf::Sound punchSound; + void setProjection(); + void setProjection(Mf::Scalar width, Mf::Scalar height); - Mf::PolynomialInterpolator<5> interp; + State mState; + Mf::SoundStream mMusic; + Mf::Sound mPunchSound; - Mf::Camera camera; + Mf::Ray<2> mRay; + Mf::Line<2> mLine; + Mf::Sphere<2> mSphere; - HudP hud; + Mf::Timer mRayTimer; + void rayTimer(); };