summaryrefslogtreecommitdiff
path: root/main.cpp
blob: 98ea6ac5077cdb541ab1a551c1d129b64a3d2492 (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
#include <iostream>
#include <cstring>
#include <memory>
#include "object_base.h"
#include "global.h"
#include "build/objects.h"

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_draw.H>

using namespace std;

Global global;

shared_ptr<Object> objectfromname(const char *name){

#define X(objname) if(strcmp(name,#objname)==0)return make_shared<objname>();
OBJECT_CLASSES_XLIST
#undef X

	return NULL; //no object with that name
}

void stepcallback(void*){
	Fl::repeat_timeout(1.0/30,stepcallback);
}

int main(int argc,char **argv){
	Fl_Window *window=new Fl_Window(640,480,GAME_NAME);

	global.objects.push_back(objectfromname("obj_control"));
	global.objects[0]->create();

	window->end();
	Fl::visual(FL_RGB);
	window->show(argc,argv);
	Fl::add_timeout(1.0/30,stepcallback);
	return Fl::run();
}