X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2FYoinkApp.cc;h=655aa3497928e5c22b6510f8725efa95d86a5368;hb=87bc17e55b0c1dc73ecc66df856d3f08fd7a7724;hp=4b024b47ec74f1e617d87b96689e7a645fbdd4c6;hpb=7d15b919681bb9ec0088b4b27c6abf62d6dfb9b1;p=chaz%2Fyoink diff --git a/src/YoinkApp.cc b/src/YoinkApp.cc index 4b024b4..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 += ":"; } @@ -76,6 +74,13 @@ YoinkApp::YoinkApp(int argc, char* argv[]) : << "Send requests, patches, and bug reports to <" PACKAGE_BUGREPORT << ">." << std::endl << std::endl; + char* dataDir = getenv("YOINK_DATADIR"); + + if (dataDir) + { + dc::resource::addSearchPath(dataDir); + } + dc::resource::addSearchPath(YOINK_DATADIR); dc::dispatcher::instance().addHandler("video.context_recreated", @@ -128,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) @@ -155,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); @@ -282,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) @@ -302,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: