]> Dogcows Code - chaz/yoink/blobdiff - src/YoinkApp.cc
beginnings of scene rendering
[chaz/yoink] / src / YoinkApp.cc
index f0a1ad988864fa2388dac6cac0a56c7ebf9c9035..655aa3497928e5c22b6510f8725efa95d86a5368 100644 (file)
 
 #include <boost/bind.hpp>
 
+#include "math.hh"
 #include "opengl.hh"
-#include "video.hh"
 #include "settings.hh"
-
-#include "math.hh"
+#include "timer.hh"
+#include "video.hh"
 
 #include "YoinkApp.hh"
 
-#include "timer.hh"
-
 #if HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -52,12 +50,12 @@ static std::string configFiles()
 {
        std::string files;
 
-       char* configFile = getenv("YOINK_CONFIGFILE");
+       char* configFile = getenv("YOINKRC");
 
        if (configFile)
        {
                // if a config file from the environment variable is specified, we want
-               // to load it first
+               // to load it first so it has precedence
                files += configFile;
                files += ":";
        }
@@ -135,7 +133,7 @@ void YoinkApp::setupGL()
 
        glClearColor(0.0, 0.0, 1.0, 1.0);
 
-       glLineWidth(10.0f);
+       //glLineWidth(10.0f);
 }
 
 void YoinkApp::contextRecreated(const dc::notification& note)
@@ -162,21 +160,33 @@ void YoinkApp::update(dc::scalar t, dc::scalar dt)
 
 void YoinkApp::draw(dc::scalar alpha)
 {
-       dc::vector4 meh;
-       meh.random(0.0, 1.0);
-       static dc::vector4 c1(meh);
+       //dc::vector4 meh;
+       //meh.random(0.0, 1.0);
+       //static dc::vector4 c1(meh);
 
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
-       dc::scalar drawstate = cml::lerp(prevstate, state, alpha);
-       dc::scalar sinstate = std::sin(drawstate);
-       dc::scalar cosstate = std::cos(drawstate);
+       //dc::scalar drawstate = cml::lerp(prevstate, state, alpha);
+       //dc::scalar sinstate = std::sin(drawstate);
+       //dc::scalar cosstate = std::cos(drawstate);
+       
+
+       glMatrixMode(GL_PROJECTION);
+       glLoadIdentity();
+       gluPerspective(60.0, 1.33333, 1.0, 2000.0);
+       
+       glMatrixMode(GL_MODELVIEW);
+       glLoadIdentity();
 
+       glBindTexture(GL_TEXTURE_2D, 0);
+       //glRotatef(drawstate*15.0f, 0.0, 1.0, 0.0);
+       glTranslatef(x, y, z);
 
        // DRAW THE SCENE
        testScene->draw(alpha);
 
 
+       /*
        someChar->getTilemap().bind();
        glColor3f(1.0, 1.0, 1.0);
 
@@ -289,7 +299,7 @@ void YoinkApp::draw(dc::scalar alpha)
        glRectf(-1.0f, -1.0f, 1.0f, 1.0f);
 
        glDisable(GL_BLEND);
-       glEnable(GL_DEPTH_TEST);
+       glEnable(GL_DEPTH_TEST);*/
 }
 
 void YoinkApp::handleEvent(const dc::event& e)
@@ -309,6 +319,30 @@ void YoinkApp::handleEvent(const dc::event& e)
                        {
                                someChar->getAnimation().startSequence("Punch");
                        }
+                       else if (e.key.keysym.sym == SDLK_RIGHT)
+                       {
+                               x -= 50.0;
+                       }
+                       else if (e.key.keysym.sym == SDLK_LEFT)
+                       {
+                               x += 50.0;
+                       }
+                       else if (e.key.keysym.sym == SDLK_UP)
+                       {
+                               y -= 50.0;
+                       }
+                       else if (e.key.keysym.sym == SDLK_DOWN)
+                       {
+                               y += 50.0;
+                       }
+                       else if (e.key.keysym.sym == SDLK_PAGEUP)
+                       {
+                               z += 50.0;
+                       }
+                       else if (e.key.keysym.sym == SDLK_PAGEDOWN)
+                       {
+                               z -= 50.0;
+                       }
                        break;
 
                case SDL_QUIT:
This page took 0.019695 seconds and 4 git commands to generate.