void Kernel::initialize(const std::string &configPath) { registerDrivers(); registerScriptLangs(); loadConfig(configPath); m_archBackend->connect(); registerModules(); registerDevices(); registerTasks(); }
static int bindAll(lua_State* L) { Application* application = static_cast<Application*>(lua_touserdata(L, 1)); lua_pop(L, 1); StackChecker checker(L, "bindAll", 0); setEnvironTable(L); { lua_newtable(L); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_touches); lua_newtable(L); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_eventClosures); lua_newtable(L); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_events); luaL_newweaktable(L); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_b2); lua_newtable(L); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_timers); } luaL_newmetatable(L, "Object"); lua_setglobal(L, "Object"); EventBinder eventBinder(L); EventDispatcherBinder eventDispatcherBinder(L); TimerBinder timerBinder(L); MatrixBinder matrixBinder(L); SpriteBinder spriteBinder(L); TextureBaseBinder textureBaseBinder(L); TextureBinder textureBinder(L); TexturePackBinder texturePackBinder(L); BitmapDataBinder bitmapDataBinder(L); BitmapBinder bitmapBinder(L); StageBinder stageBinder(L, application); FontBaseBinder fontBaseBinder(L); FontBinder fontBinder(L); TTFontBinder ttfontBinder(L); TextFieldBinder textFieldBinder(L); AccelerometerBinder accelerometerBinder(L); Box2DBinder2 box2DBinder2(L); DibBinder dibBinder(L); TileMapBinder tileMapBinder(L); ApplicationBinder applicationBinder(L); ShapeBinder shapeBinder(L); MovieClipBinder movieClipBinder(L); UrlLoaderBinder urlLoaderBinder(L); GeolocationBinder geolocationBinder(L); GyroscopeBinder gyroscopeBinder(L); AlertDialogBinder alertDialogBinder(L); TextInputDialogBinder textInputDialogBinder(L); MeshBinder meshBinder(L); AudioBinder audioBinder(L); RenderTargetBinder renderTargetBinder(L); PluginManager& pluginManager = PluginManager::instance(); for (size_t i = 0; i < pluginManager.plugins.size(); ++i) pluginManager.plugins[i].main(L, 0); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_Event); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_EnterFrameEvent); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_MouseEvent); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_TouchEvent); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_TimerEvent); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_KeyboardEvent); lua_getglobal(L, "Event"); lua_getfield(L, -1, "new"); lua_pushlightuserdata(L, NULL); lua_call(L, 1, 1); lua_remove(L, -2); luaL_rawsetptr(L, LUA_REGISTRYINDEX, &key_CompleteEvent); #include "property.c.in" #include "texturepack.c.in" #include "sprite.c.in" #include "compatibility.c.in" lua_newtable(L); lua_pushinteger(L, GINPUT_KEY_BACK); lua_setfield(L, -2, "BACK"); lua_pushinteger(L, GINPUT_KEY_SEARCH); lua_setfield(L, -2, "SEARCH"); lua_pushinteger(L, GINPUT_KEY_MENU); lua_setfield(L, -2, "MENU"); lua_pushinteger(L, GINPUT_KEY_CENTER); lua_setfield(L, -2, "CENTER"); lua_pushinteger(L, GINPUT_KEY_SELECT); lua_setfield(L, -2, "SELECT"); lua_pushinteger(L, GINPUT_KEY_START); lua_setfield(L, -2, "START"); lua_pushinteger(L, GINPUT_KEY_L1); lua_setfield(L, -2, "L1"); lua_pushinteger(L, GINPUT_KEY_R1); lua_setfield(L, -2, "R1"); lua_pushinteger(L, GINPUT_KEY_LEFT); lua_setfield(L, -2, "LEFT"); lua_pushinteger(L, GINPUT_KEY_UP); lua_setfield(L, -2, "UP"); lua_pushinteger(L, GINPUT_KEY_RIGHT); lua_setfield(L, -2, "RIGHT"); lua_pushinteger(L, GINPUT_KEY_DOWN); lua_setfield(L, -2, "DOWN"); lua_pushinteger(L, GINPUT_KEY_A); lua_setfield(L, -2, "A"); lua_pushinteger(L, GINPUT_KEY_B); lua_setfield(L, -2, "B"); lua_pushinteger(L, GINPUT_KEY_C); lua_setfield(L, -2, "C"); lua_pushinteger(L, GINPUT_KEY_D); lua_setfield(L, -2, "D"); lua_pushinteger(L, GINPUT_KEY_E); lua_setfield(L, -2, "E"); lua_pushinteger(L, GINPUT_KEY_F); lua_setfield(L, -2, "F"); lua_pushinteger(L, GINPUT_KEY_G); lua_setfield(L, -2, "G"); lua_pushinteger(L, GINPUT_KEY_H); lua_setfield(L, -2, "H"); lua_pushinteger(L, GINPUT_KEY_I); lua_setfield(L, -2, "I"); lua_pushinteger(L, GINPUT_KEY_J); lua_setfield(L, -2, "J"); lua_pushinteger(L, GINPUT_KEY_K); lua_setfield(L, -2, "K"); lua_pushinteger(L, GINPUT_KEY_L); lua_setfield(L, -2, "L"); lua_pushinteger(L, GINPUT_KEY_M); lua_setfield(L, -2, "M"); lua_pushinteger(L, GINPUT_KEY_N); lua_setfield(L, -2, "N"); lua_pushinteger(L, GINPUT_KEY_O); lua_setfield(L, -2, "O"); lua_pushinteger(L, GINPUT_KEY_P); lua_setfield(L, -2, "P"); lua_pushinteger(L, GINPUT_KEY_Q); lua_setfield(L, -2, "Q"); lua_pushinteger(L, GINPUT_KEY_R); lua_setfield(L, -2, "R"); lua_pushinteger(L, GINPUT_KEY_S); lua_setfield(L, -2, "S"); lua_pushinteger(L, GINPUT_KEY_T); lua_setfield(L, -2, "T"); lua_pushinteger(L, GINPUT_KEY_U); lua_setfield(L, -2, "U"); lua_pushinteger(L, GINPUT_KEY_V); lua_setfield(L, -2, "V"); lua_pushinteger(L, GINPUT_KEY_W); lua_setfield(L, -2, "W"); lua_pushinteger(L, GINPUT_KEY_X); lua_setfield(L, -2, "X"); lua_pushinteger(L, GINPUT_KEY_Y); lua_setfield(L, -2, "Y"); lua_pushinteger(L, GINPUT_KEY_Z); lua_setfield(L, -2, "Z"); lua_pushinteger(L, GINPUT_KEY_0); lua_setfield(L, -2, "NUM_0"); lua_pushinteger(L, GINPUT_KEY_1); lua_setfield(L, -2, "NUM_1"); lua_pushinteger(L, GINPUT_KEY_2); lua_setfield(L, -2, "NUM_2"); lua_pushinteger(L, GINPUT_KEY_3); lua_setfield(L, -2, "NUM_3"); lua_pushinteger(L, GINPUT_KEY_4); lua_setfield(L, -2, "NUM_4"); lua_pushinteger(L, GINPUT_KEY_5); lua_setfield(L, -2, "NUM_5"); lua_pushinteger(L, GINPUT_KEY_6); lua_setfield(L, -2, "NUM_6"); lua_pushinteger(L, GINPUT_KEY_7); lua_setfield(L, -2, "NUM_7"); lua_pushinteger(L, GINPUT_KEY_8); lua_setfield(L, -2, "NUM_8"); lua_pushinteger(L, GINPUT_KEY_9); lua_setfield(L, -2, "NUM_9"); lua_setglobal(L, "KeyCode"); // correct clock function which is wrong in iphone lua_getglobal(L, "os"); lua_pushcfunction(L, os_timer); lua_setfield(L, -2, "timer"); lua_pop(L, 1); // register collectgarbagelater // lua_pushcfunction(L, ::collectgarbagelater); // lua_setglobal(L, "collectgarbagelater"); registerModules(L); return 0; }