std::string files;
char* configFile = getenv("YOINKRC");
+ char* dataDir = getenv("YOINK_DATADIR");
if (configFile)
{
files += ":";
}
+ // add the colon-delimited paths from configure
files += YOINK_CONFIGFILES;
+ if (dataDir)
+ {
+ // if another data directory is set in the environment, look for a
+ // config file there
+ files += ":";
+ files += dataDir;
+ files += "/yoinkrc";
+ }
+
+ // look in the configured data directory last of all
+ files += ":";
+ files += (dataDir ? dataDir : YOINK_DATADIR);
+ files += "/yoinkrc";
+
return files;
}
// first set up the search paths so we can find the icon and other resources
if (dataDir)
{
+ // look first in the data directory specified by the environment
Mf::Resource::addSearchPath(dataDir);
}
+
+ // then look in the configured data directory
Mf::Resource::addSearchPath(YOINK_DATADIR);
return Mf::Resource::getPathToResource("yoink.png");
glEnable(GL_DEPTH_TEST);
glShadeModel(GL_SMOOTH);
- glEnable(GL_POLYGON_SMOOTH);
+ //glEnable(GL_POLYGON_SMOOTH);
//int texSize;
//glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
glClearColor(1.0, 0.0, 0.0, 1.0);
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ gluPerspective(60.0, 1.33333, 1.0, 2500.0);
+
//glLineWidth(10.0f);
}
fadeIn.update(dt);
+ camera.update(t, dt);
+
someChar->getAnimation().update(t, dt);
interp.update(dt);
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- gluPerspective(60.0, 1.33333, 1.0, 2000.0);
-
glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ //glLoadIdentity();
glBindTexture(GL_TEXTURE_2D, 0);
//glRotatef(drawstate*15.0f, 0.0, 1.0, 0.0);
- glTranslatef(x, y, z);
+ //glTranslatef(x, y, z);
+ glLoadMatrix(camera.getTransformation().data());
// DRAW THE SCENE
testScene->draw(alpha);
{
someChar->getAnimation().startSequence("Punch");
}
- else if (event.key.keysym.sym == SDLK_RIGHT)
- {
- x -= 50.0;
- }
- else if (event.key.keysym.sym == SDLK_LEFT)
- {
- x += 50.0;
- }
- else if (event.key.keysym.sym == SDLK_UP)
- {
- y -= 50.0;
- }
- else if (event.key.keysym.sym == SDLK_DOWN)
+ else if (event.key.keysym.sym == SDLK_r)
{
- y += 50.0;
+ testScene->refresh();
}
- else if (event.key.keysym.sym == SDLK_PAGEUP)
+ else if (event.key.keysym.sym == SDLK_l)
{
- z += 50.0;
- }
- else if (event.key.keysym.sym == SDLK_PAGEDOWN)
- {
- z -= 50.0;
+ getVideo().toggleCursorGrab();
+ getVideo().toggleCursorVisible();
}
+ //else if (event.key.keysym.sym == SDLK_RIGHT)
+ //{
+ //x -= 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_LEFT)
+ //{
+ //x += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_UP)
+ //{
+ //y -= 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_DOWN)
+ //{
+ //y += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_PAGEUP)
+ //{
+ //z += 50.0;
+ //}
+ //else if (event.key.keysym.sym == SDLK_PAGEDOWN)
+ //{
+ //z -= 50.0;
+ //}
+
+ case SDL_MOUSEMOTION:
+ case SDL_MOUSEBUTTONDOWN:
+ camera.adjustFromInput(event);
break;
case SDL_QUIT:
case SDL_VIDEORESIZE:
glViewport(0, 0, event.resize.w, event.resize.h);
+
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+
+
+ gluPerspective(60.0, double(event.resize.w / event.resize.h), 1.0, 2500.0);
+
+ glMatrixMode(GL_MODELVIEW);
break;
}
}
+#include <Moof/Tree.hh>
int main(int argc, char* argv[])
{
int status = 0;
+ //Mf::Tree<Mf::Drawable> myTree;
+ //Mf::Tree<Mf::Drawable>::Ptr prev = myTree.previousSibling();
+ //myTree = *prev;
+
try
{
YoinkApp app(argc, argv);