blob: 17fd53508a39aa5891294d7040d82f19c461851e (
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
47
48
49
50
51
52
53
54
55
56
|
#include <stdio.h>
#include <stdlib.h>
#include "../shared/util/hashmap.h"
extern "C" {
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
//C++ things
#include <vector>
#include <thread>
#include <list>
#include <string.h> // for strstr()
#include <nn.h>
#include <tcp.h>
#include <pair.h>
#include <btBulletDynamicsCommon.h>
#include <cstdlib>
#include "../shared/lua_api/common.h"
#include "../shared/lua_api/load_net.hpp"
#include "../shared/phys/physcommon.hpp"
using namespace std;
using namespace chrono;
lua_State* L;
void gameloop(){
gameloop_phys(NULL);
gameloop_net(L);
}
int main (){
printf("Brok[en]gine Server\n");
L = luaL_newstate();
phys_genesis();
loadLLibs(L);
loadNetLibs(L);
int iErr = luaL_dofile(L,"../data/init.lua");
if(iErr != 0){
lua_error(L);
printf("Failed to open lua file:../data/init.lua\n");
}
do{
gameloop();
std::this_thread::yield();
}while(true);
phys_shutdown(NULL);
return 0;
}
|