Пример #1
0
struct game *
ejoy2d_game() {
	struct game *G = (struct game *)malloc(sizeof(*G));
	lua_State *L = ejoy2d_lua_init();

	G->L = L;
	G->real_time = 0;
	G->logic_time = 0;

	ejoy2d_init(L);

	return G;
}
Пример #2
0
int
luaopen_ejoy2d_core(lua_State *L) {
	if ( glewInit() != GLEW_OK ) {
		return luaL_error(L, "init glew failed");
	}
	ejoy2d_init(L);
	luaL_Reg l[] = {
		{ "viewport", lviewport },
		{ "beginframe", lbeginframe },
		{ "endframe", lendframe },
		{ NULL, NULL },
	};
	luaL_newlib(L,l);

	return 1;
}