X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FGameLayer.hh;h=f966c7092ca3703affa4dee90dc60172815a75dd;hp=a1b5d6d87f3a5dbf38922de6487d3981e5f76f1c;hb=6a5d12788f2778a26223de690d34b00ac16a6ec3;hpb=a31d65a998121df0651c57bfb68782e2a07d2e2f diff --git a/src/GameLayer.hh b/src/GameLayer.hh index a1b5d6d..f966c70 100644 --- a/src/GameLayer.hh +++ b/src/GameLayer.hh @@ -36,19 +36,24 @@ #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 +63,7 @@ typedef boost::shared_ptr GameLayerP; class GameLayer : public Mf::Layer { public: + GameLayer(); static GameLayerP alloc() @@ -66,27 +72,44 @@ 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); -private: + 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); - void setProjection(); - void setProjection(Mf::Scalar width, Mf::Scalar height); + 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::Sound mMusic; + Mf::PolynomialInterpolator<5> interp; - HeroineP mHeroine; - SceneP mScene; - Mf::Sound mPunchSound; + Mf::Camera camera; + }; - Mf::PolynomialInterpolator<5> mInterp; +private: + + void loadSceneLoader(); + void advanceScene(); + + Mf::Scalar getZCoord(const Mf::Vector2& position) const; + + void setProjection(); + void setProjection(Mf::Scalar width, Mf::Scalar height); - Mf::Camera mCamera; + State mState; + Mf::Sound mMusic; + Mf::Sound mPunchSound; - HudP mHud; + Mf::Ray<2> mRay; + Mf::Line<2> mLine; + Mf::Plane mPlane; + Mf::Sphere<2> mSphere; };