summaryrefslogtreecommitdiff
path: root/src/main.cpp
blob: 9df79a456c6b6e6aa39fad782c245d09eaafd261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "gamebuilder.h"
#include "game.h"
#include "gamestate.h"
#include "options.h"

#include "interfaceplugger.h"

#include <stdlib.h>
#include <time.h>

#ifdef WIN32
#define srandom( x ) srand( x )
#endif

#include <bu/sio.h>
using namespace Bu;

int main( int argc, char *argv[] )
{
	Options &opt = Options::getInstance();
	opt.parse( argc, argv );

	if( opt.sFile.isEmpty() )
	{
		sio << "You must specify a stage script filename." << sio.nl;
		return 1;
	}
	srandom( time( NULL ) );

	Interface *pIface = InterfacePlugger::getInstance().instantiate(
		opt.sInterface
		);

	GameBuilder bld;
	bld.parse( opt.sFile );
	Game *pGame = bld.getGame();

	pIface->run( pGame );

	delete pGame;

	InterfacePlugger::getInstance().destroy( pIface );

	return 0;
}