]> Dogcows Code - chaz/yoink/blobdiff - src/GameLayer.cc
game loop tweaks; shapes hierarchy defined
[chaz/yoink] / src / GameLayer.cc
index 3a0ea09eba80e44fb81dda883975bf5bd1c66f43..331d04fbc9db98f81d02ba12a3c07c9fea618fed 100644 (file)
@@ -114,7 +114,7 @@ GameLayer::GameLayer() :
 }
 
 
-void GameLayer::pushedOntoEngine()
+void GameLayer::addedToCore()
 {
        Mf::core.push(mHud);
 
@@ -123,8 +123,8 @@ void GameLayer::pushedOntoEngine()
        mLine.a.set(20, 10);
        mLine.b.set(19, 14);
 
-       mSphere.point.set(22, 5);
-       mSphere.radius = 2;
+       mCircle.point.set(22, 5);
+       mCircle.radius = 2;
 
        mRayTimer.init(boost::bind(&GameLayer::rayTimer, this),
                                   1.0, Mf::Timer::REPEAT);
@@ -155,8 +155,8 @@ void GameLayer::thinkTimer()
 
 void GameLayer::rayTimer()
 {
-       Mf::Ray<2>::Intersection meh;
-       std::list<Mf::Ray<2>::Intersection> hits;
+       Mf::Ray2::Contact meh;
+       std::list<Mf::Ray2::Contact> hits;
        Mf::Vector2 point;
 
        bool bam = mLine.intersectRay(mRay, meh);
@@ -166,7 +166,7 @@ void GameLayer::rayTimer()
                hits.push_back(meh);
        }
 
-       bam = mSphere.intersectRay(mRay, meh);
+       bam = mCircle.intersectRay(mRay, meh);
        if (bam)
        {
                meh.normal.normalize();
@@ -177,9 +177,9 @@ void GameLayer::rayTimer()
        {
                hits.front().normal.normalize();
                mRay.solve(point, hits.front().distance);
-               //Mf::logInfo << "scene: d = " << hits.front().distance << std::endl;
-               //Mf::logInfo << "       P = " << point << std::endl;
-               //Mf::logInfo << "       n = " << hits.front().normal << std::endl;
+               Mf::logInfo << "scene: d = " << hits.front().distance << std::endl;
+               Mf::logInfo << "       P = " << point << std::endl;
+               Mf::logInfo << "       n = " << hits.front().normal << std::endl;
        }
 }
 
@@ -195,12 +195,11 @@ void GameLayer::draw(Mf::Scalar alpha) const
        glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 
        mState.scene->drawIfVisible(alpha, mState.camera.getFrustum());
-
        mState.heroine->draw(alpha);
 
        mRay.draw();
        mLine.draw();
-       mSphere.draw();
+       mCircle.draw();
 }
 
 bool GameLayer::handleEvent(const Mf::Event& event)
This page took 0.019228 seconds and 4 git commands to generate.