]> Dogcows Code - chaz/yoink/blobdiff - src/MainLayer.cc
moved log level from configure to setting
[chaz/yoink] / src / MainLayer.cc
index 568f0cd0ebe84b2185945895692d5045c89c7454..ad2dbbc5f22d9a607f69327783032eee338c4236 100644 (file)
@@ -142,11 +142,13 @@ void MainLayer::setupGL()
 
        glClearColor(0.0, 0.0, 0.0, 1.0);
 
-       glMatrixMode(GL_PROJECTION);
-       glLoadIdentity();
-       gluPerspective(60.0, 1.33333, 1.0, 2500.0);
+       //glMatrixMode(GL_PROJECTION);
+       //glLoadIdentity();
+       //Mf::Scalar ratio = Mf::engine.getVideo()->getWidth() /
+               //Mf::engine.getVideo()->getHeight();
+       //gluPerspective(60.0, ratio, 1.0, 250.0);
 
-       glMatrixMode(GL_MODELVIEW);
+       //glMatrixMode(GL_MODELVIEW);
 }
 
 void MainLayer::contextRecreated()
@@ -272,30 +274,21 @@ int main(int argc, char* argv[])
 
 
        // make sure the engine started up okay
-       if (Mf::engine.getError().isError())
+       const Mf::Error& error = Mf::engine.getError();
+       if (error.isError())
        {
                Mf::ModalDialog dialog;
                dialog.title = PACKAGE_STRING;
-               dialog.text1 = "Fatal Error";
-               dialog.text2 = getErrorString(Mf::engine.getError());
+               dialog.text1 = "Uh oh!";
+               dialog.text2 = getErrorString(error);
                dialog.type = Mf::ModalDialog::CRITICAL;
                dialog.run();
 
-               return 1;
+               // openal errors are not fatal
+               if (error.code() != Mf::Error::OPENAL_INIT) return 1;
        }
 
 
-#if        YOINK_LOGLEVEL >= 3
-       Mf::Log::setLevel(Mf::Log::INFO);
-#elif  YOINK_LOGLEVEL >= 2
-       Mf::Log::setLevel(Mf::Log::WARNING);
-#elif  YOINK_LOGLEVEL >= 1
-       Mf::Log::setLevel(Mf::Log::ERROR);
-#elif  YOINK_LOGLEVEL
-       Mf::Log::setLevel(Mf::Log::NONE);
-#endif
-
-
        // Add search paths; they should be searched in this order:
        // 1. YOINK_DATADIR (environment)
        // 2. YOINK_DATADIR (configure)
@@ -315,9 +308,7 @@ int main(int argc, char* argv[])
        // 3. $HOME/.yoinkrc
        // 4. YOINKRC (environment)
 
-       std::string configFiles;
-
-       configFiles += Mf::Resource::getPath("yoinkrc");
+       std::string configFiles = Mf::Resource::getPath("yoinkrc");
 #if !defined(_WIN32) && !defined(__WIN32__)
        configFiles += ":/etc/yoinkrc";
 #endif
@@ -334,6 +325,11 @@ int main(int argc, char* argv[])
        settings.loadFromFile(configFiles);
        settings.parseArgs(argc, argv);
 
+       Mf::Log::Level logLevel;
+       if (settings.get("loglevel", logLevel)) Mf::Log::setLevel(logLevel);
+
+       Mf::engine.initWithSettings(settings);
+
        std::string iconFile = Mf::Resource::getPath(PACKAGE".png");
 
 
This page took 0.022347 seconds and 4 git commands to generate.