X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FYoinkApp.cc;h=655aa3497928e5c22b6510f8725efa95d86a5368;hp=f0a1ad988864fa2388dac6cac0a56c7ebf9c9035;hb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724;hpb=838bc00015eb7f583c7cf4b3b1007697bf047da1 diff --git a/src/YoinkApp.cc b/src/YoinkApp.cc index f0a1ad9..655aa34 100644 --- a/src/YoinkApp.cc +++ b/src/YoinkApp.cc @@ -33,16 +33,14 @@ #include +#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: