]> Dogcows Code - chaz/yoink/blobdiff - src/GameLayer.hh
ray-scene intersection
[chaz/yoink] / src / GameLayer.hh
index a1b5d6d87f3a5dbf38922de6487d3981e5f76f1c..4692611789f7cfbc1829be8b67cf13677d94a87d 100644 (file)
 
 #include <iostream>
 #include <string>
+#include <vector>
 
 #include <boost/shared_ptr.hpp>
 
 #include <Moof/Camera.hh>
-#include <Moof/Dispatcher.hh>
 #include <Moof/Interpolator.hh>
 #include <Moof/Layer.hh>
 #include <Moof/Math.hh>
+#include <Moof/Script.hh>
 #include <Moof/Sound.hh>
 
+#include <Moof/Line.hh>
+#include <Moof/Plane.hh>
+#include <Moof/Ray.hh>
+#include <Moof/Sphere.hh>
+
 #include "Character.hh"
 #include "Heroine.hh"
-#include "Hud.hh"
 #include "Scene.hh"
 
 
@@ -58,6 +63,7 @@ typedef boost::shared_ptr<GameLayer> GameLayerP;
 class GameLayer : public Mf::Layer
 {
 public:
+
        GameLayer();
 
        static GameLayerP alloc()
@@ -66,27 +72,45 @@ 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<std::string>        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::Camera              mCamera;
+       Mf::Scalar getZCoord(const Mf::Vector2& position) const;
+
+       void setProjection();
+       void setProjection(Mf::Scalar width, Mf::Scalar height);
+
+       State                   mState;
+       Mf::SoundStream mMusic;
+       Mf::Sound               mPunchSound;
 
-       HudP                    mHud;
+       Mf::Ray<2>              mRay;
+       Mf::Ray<3>              mRay3;
+       Mf::Line<2>             mLine;
+       Mf::Plane               mPlane;
+       Mf::Sphere<2>   mSphere;
 };
 
 
This page took 0.023287 seconds and 4 git commands to generate.