anaglym/anaglym.cc

64 lines
1.2 KiB
C++

#include "Video.h"
#include "anaglym.h"
#include "Engine.h"
#include "SDL.h"
#include <stdlib.h> /* exit() */
#include <iostream>
#include <string>
using namespace std;
static void usage();
static void usage()
{
cerr << "Usage: anaglym [options] program.lua[c]" << endl;
exit(42);
}
int main(int argc, char * argv[])
{
const char * program = NULL;
for (int i = 1; i < argc; i++)
{
if (argv[i][0] != '-')
{
if (program == NULL)
{
program = argv[i];
}
else
{
cerr << "Warning: argument " << argv[i] << " ignored!" << endl;
usage();
}
}
else
{
cerr << "Warning: Unrecognized option '" << argv[i]+1
<< "'" << endl;
usage();
}
}
if (program == NULL)
{
usage();
}
Video video;
#if 1
/* start in windowed mode for debugging */
video.start(0, 0, false, false);
#else
video.start();
#endif
g_engine = new Engine(argv[0]);
if (g_engine->load(program))
g_engine->run();
delete g_engine;
video.stop();
return 0;
}