summaryrefslogtreecommitdiff
path: root/src/interfaceconsole.cpp
blob: caa13bf3bd66d376a28897085dffdf31baa21385 (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
#include "interfaceconsole.h"

#include "smlnode.h"
#include "gamestate.h"

#include <bu/sio.h>

#include <bu/plugger.h>

#include "smlrenderervt100.h"

PluginInterface3( plugin_interface_console, console, InterfaceConsole,
		Interface, "Mike Buland", 1, 0 );

using namespace Bu;

InterfaceConsole::InterfaceConsole()
{
}

InterfaceConsole::~InterfaceConsole()
{
}

void InterfaceConsole::run( Game *pGame )
{
	GameState gs( pGame, this );
	gs.init();

	while( gs.isRunning() )
	{
		char buf[1024];
		sio << sio.nl << "command> " << sio.flush;
		fgets( buf, 1024, stdin );

		gs.execCommand( buf );
	}	
}

void InterfaceConsole::display( const class SmlNode *pSml )
{
	SmlRendererVt100 rend;
	rend.render( sio, pSml );
}