static int registerSystemString(lua_State *L) { beginPackage(L, "system") .beginClass<LSString> ("String") .addStaticLuaFunction("fromCharCode", &LSString::fromCharCode) // transforms static calls .addStaticLuaFunction("_charAt", &LSString::_charAt) .addStaticLuaFunction("_charCodeAt", &LSString::_charCodeAt) .addStaticLuaFunction("_length", &LSString::_length) .addStaticLuaFunction("_toUpperCase", &LSString::_toUpperCase) .addStaticLuaFunction("_toLowerCase", &LSString::_toLowerCase) .addStaticLuaFunction("_toLocaleUpperCase", &LSString::_toUpperCase) .addStaticLuaFunction("_toLocaleLowerCase", &LSString::_toLowerCase) .addStaticLuaFunction("_indexOf", &LSString::_indexOf) .addStaticLuaFunction("_lastIndexOf", &LSString::_lastIndexOf) .addStaticLuaFunction("_concat", &LSString::_concat) .addStaticLuaFunction("_slice", &LSString::_slice) .addStaticLuaFunction("_substr", &LSString::_substr) .addStaticLuaFunction("_substring", &LSString::_substring) .addStaticLuaFunction("_toNumber", &LSString::_toNumber) .addStaticLuaFunction("_toBoolean", &LSString::_toBoolean) .addStaticLuaFunction("_find", &LSString::_find) .addStaticLuaFunction("_split", &LSString::_split) .addStaticLuaFunction("format", &LSString::format) .endClass() .endPackage(); return 0; }
static int registerLoomGraphics(lua_State *L) { beginPackage(L, "loom.graphics") .beginClass<Texture> ("Texture2D") .addStaticMethod("initFromAsset", &Texture::initFromAssetManager) .addStaticMethod("dispose", &Texture::dispose) .addStaticMethod("scaleImageOnDisk", &scaleImageOnDisk) .addStaticMethod("pollScaling", &pollScaling) .addStaticProperty("imageScaleProgress", &getImageScaleProgressDelegate) .endClass() .beginClass<Graphics> ("Graphics") .addStaticMethod("handleContextLoss", &Graphics::handleContextLoss) .addStaticMethod("screenshot", &Graphics::screenshot) .addStaticMethod("setDebug", &Graphics::setDebug) .addStaticMethod("setFillColor", &Graphics::setFillColor) .endClass() .beginClass<TextureInfo> ("TextureInfo") .addVar("width", &TextureInfo::width) .addVar("height", &TextureInfo::height) .addVar("id", &TextureInfo::id) .addVarAccessor("update", &TextureInfo::getUpdateDelegate) .endClass() .endPackage(); return 0; }
static int registerCCUserDefault(lua_State *L) { beginPackage(L, "loom.platform") .beginClass<DummyDefaults>("UserDefault") .addMethod("getBoolForKey", &DummyDefaults::getBoolForKey) .addMethod("getIntegerForKey", &DummyDefaults::getIntegerForKey) .addMethod("getFloatForKey", &DummyDefaults::getFloatForKey) .addMethod("getStringForKey", &DummyDefaults::getStringForKey) .addMethod("getDoubleForKey", &DummyDefaults::getDoubleForKey) .addMethod("setBoolForKey", &DummyDefaults::setBoolForKey) .addMethod("setIntegerForKey", &DummyDefaults::setIntegerForKey) .addMethod("setFloatForKey", &DummyDefaults::setFloatForKey) .addMethod("setStringForKey", &DummyDefaults::setStringForKey) .addMethod("setDoubleForKey", &DummyDefaults::setIntegerForKey) .addStaticMethod("sharedUserDefault", &DummyDefaults::sharedUserDefault) .addStaticMethod("purgeSharedUserDefault", &DummyDefaults::purgeSharedUserDefault) .endClass() .endPackage(); return 0; }
static int registerSystemByteArray(lua_State *L) { beginPackage(L, "system") .beginClass<utByteArray> ("ByteArray") .addConstructor<void (*)(void)>() .addMethod("clear", &utByteArray::clear) .addProperty("position", &utByteArray::getPosition, &utByteArray::setPosition) .addProperty("bytesAvailable", &utByteArray::bytesAvailable) .addMethod("toString", &utByteArray::toString) .addMethod("setPosition", &utByteArray::setPosition) .addMethod("readInt", &utByteArray::readInt) .addMethod("writeInt", &utByteArray::writeInt) .addMethod("readUnsignedInt", &utByteArray::readUnsignedInt) .addMethod("writeUnsignedInt", &utByteArray::writeUnsignedInt) .addMethod("readShort", &utByteArray::readShort) .addMethod("writeShort", &utByteArray::writeShort) .addMethod("readUnsignedShort", &utByteArray::readUnsignedShort) .addMethod("writeUnsignedShort", &utByteArray::writeUnsignedShort) .addMethod("readFloat", &utByteArray::readFloat) .addMethod("writeFloat", &utByteArray::writeFloat) .addMethod("readDouble", &utByteArray::readDouble) .addMethod("writeDouble", &utByteArray::writeDouble) .addMethod("readString", &utByteArray::readString) .addMethod("writeString", &utByteArray::writeString) .addMethod("readUTF", &utByteArray::readUTF) .addMethod("readUTFBytes", &utByteArray::readUTFBytes) .addMethod("writeUTF", &utByteArray::writeUTF) .addMethod("writeUTFBytes", &utByteArray::writeUTFBytes) .addMethod("readBoolean", &utByteArray::readBoolean) .addMethod("writeBoolean", &utByteArray::writeBoolean) .addMethod("readByte", &utByteArray::readByte) .addMethod("writeByte", &utByteArray::writeByte) .addMethod("readUnsignedByte", &utByteArray::readUnsignedByte) .addMethod("writeUnsignedByte", &utByteArray::writeUnsignedByte) .addMethod("readBytes", &utByteArray::readBytes) .addMethod("writeBytes", &utByteArray::writeBytes) .addMethod("reserve", &utByteArray::reserve) .addMethod("compress", &utByteArray::compress) .addMethod("uncompress", &utByteArray::uncompress) .addVarAccessor("length", &utByteArray::getSize, &utByteArray::resize) .endClass() .endPackage(); return 0; }
static int registerSystemProcess(lua_State *L) { beginPackage(L, "system") .beginClass<Process> ("Process") .addStaticMethod("exit", &Process::_exit) .endClass() .endPackage(); return 0; }
static int registerSystemPlatform(lua_State *L) { beginPackage(L, "system.platform") .beginClass<Platform> ("Platform") .addStaticLuaFunction("getTime", &Platform::getTime) .addStaticMethod("getEpochTime", &Platform::getEpochTime) .addStaticMethod("getPlatform", &Platform::getPlatform) .addStaticMethod("getProfile", &Platform::getProfile) .addStaticMethod("getDPI", &Platform::getDPI) .addStaticMethod("forceDPI", &Platform::forceDPI) .addStaticMethod("isForcingDPI", &Platform::isForcingDPI) .endClass() .endPackage(); return 0; }
static int registerLoomSystem(lua_State* L) { beginPackage(L, "loom") .beginClass<System>("System") .addConstructor <void(*)(void) >() .addMethod("run", &System::run) .addMethod("close", &System::close) .addVarAccessor("onData", &System::getOnDataDelegate) .addVarAccessor("onFinish", &System::getOnFinishDelegate) .endClass() .endPackage(); return 0; }
static int registerCocos2D(lua_State *L) { beginPackage(L, "loom2d.display") .beginClass<LoomCocos2d>("Cocos2D") .addStaticProperty("onDisplayStatsChanged", &LoomCocos2d::getDisplayStatsChangedDelegate) .addStaticProperty("onOrientationChanged", &LoomCocos2d::getOrientationChangedDelegate) .addStaticProperty("onDisplaySizeChanged", &LoomCocos2d::getDisplaySizeChangedDelegate) .addStaticMethod("getOrientation", &LoomCocos2d::getOrientation) .addStaticMethod("toggleFullscreen", &LoomCocos2d::toggleFullscreen) .addStaticMethod("getDisplayCaption", &LoomCocos2d::getDisplayCaption) .addStaticMethod("setDisplayCaption", &LoomCocos2d::setDisplayCaption) .addStaticMethod("getDisplayOrientation", &LoomCocos2d::getDisplayOrientation) .addStaticMethod("setDisplayOrientation", &LoomCocos2d::setDisplayOrientation) .addStaticMethod("getDisplayWidth", &LoomCocos2d::getDisplayWidth) .addStaticMethod("getDisplayHeight", &LoomCocos2d::getDisplayHeight) .addStaticMethod("getDisplayStats", &LoomCocos2d::getDisplayStats) .addStaticMethod("setDisplayWidth", &LoomCocos2d::setDisplayWidth) .addStaticMethod("setDisplayHeight", &LoomCocos2d::setDisplayHeight) .addStaticMethod("setDisplayStats", &LoomCocos2d::setDisplayStats) .addStaticMethod("cleanup", &LoomCocos2d::cleanup) .addStaticMethod("shutdown", &LoomCocos2d::shutdown) // .addStaticMethod("addLayer", &LoomCocos2d::addLayer) // .addStaticMethod("removeLayer", &LoomCocos2d::removeLayer) .endClass() .endPackage(); return 0; }