/* * Copyright (c) 2010-2012 OTClient * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #include #include #include #include #include #include #include #include #include #include #include #include #ifdef FW_GRAPHICS #include #include #include #include #include #endif void Application::registerLuaFunctions() { // conversion globals g_lua.bindGlobalFunction("torect", [](const std::string& v) { return stdext::from_string(v); }); g_lua.bindGlobalFunction("topoint", [](const std::string& v) { return stdext::from_string(v); }); g_lua.bindGlobalFunction("tocolor", [](const std::string& v) { return stdext::from_string(v); }); g_lua.bindGlobalFunction("tosize", [](const std::string& v) { return stdext::from_string(v); }); g_lua.bindGlobalFunction("recttostring", [](const Rect& v) { return stdext::to_string(v); }); g_lua.bindGlobalFunction("pointtostring", [](const Point& v) { return stdext::to_string(v); }); g_lua.bindGlobalFunction("colortostring", [](const Color& v) { return stdext::to_string(v); }); g_lua.bindGlobalFunction("sizetostring", [](const Size& v) { return stdext::to_string(v); }); g_lua.bindGlobalFunction("iptostring", [](int v) { return stdext::ip_to_string(v); }); // Application g_lua.registerSingletonClass("g_app"); g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "setCompactName", &Application::setCompactName, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "setVersion", &Application::setVersion, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "isRunning", &Application::isRunning, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "isStopping", &Application::isStopping, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getName", &Application::getName, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getCompactName", &Application::getCompactName, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getVersion", &Application::getVersion, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getBuildArch", &Application::getBuildArch, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "getOs", &Application::getOs, static_cast(&g_app)); g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, static_cast(&g_app)); // Crypt g_lua.registerSingletonClass("g_crypt"); g_lua.bindClassStaticFunction("g_crypt", "encrypt", Crypt::encrypt); g_lua.bindClassStaticFunction("g_crypt", "decrypt", Crypt::decrypt); // Clock g_lua.registerSingletonClass("g_clock"); g_lua.bindSingletonFunction("g_clock", "micros", &Clock::micros, &g_clock); g_lua.bindSingletonFunction("g_clock", "millis", &Clock::millis, &g_clock); g_lua.bindSingletonFunction("g_clock", "seconds", &Clock::seconds, &g_clock); // ConfigManager g_lua.registerSingletonClass("g_configs"); g_lua.bindSingletonFunction("g_configs", "load", &ConfigManager::load, &g_configs); g_lua.bindSingletonFunction("g_configs", "save", &ConfigManager::save, &g_configs); g_lua.bindSingletonFunction("g_configs", "set", &ConfigManager::set, &g_configs); g_lua.bindSingletonFunction("g_configs", "setList", &ConfigManager::setList, &g_configs); g_lua.bindSingletonFunction("g_configs", "get", &ConfigManager::get, &g_configs); g_lua.bindSingletonFunction("g_configs", "getList", &ConfigManager::getList, &g_configs); g_lua.bindSingletonFunction("g_configs", "exists", &ConfigManager::exists, &g_configs); g_lua.bindSingletonFunction("g_configs", "remove", &ConfigManager::remove, &g_configs); g_lua.bindSingletonFunction("g_configs", "setNode", &ConfigManager::setNode, &g_configs); g_lua.bindSingletonFunction("g_configs", "mergeNode", &ConfigManager::mergeNode, &g_configs); g_lua.bindSingletonFunction("g_configs", "getNode", &ConfigManager::getNode, &g_configs); // Logger g_lua.registerSingletonClass("g_logger"); g_lua.bindSingletonFunction("g_logger", "log", &Logger::log, &g_logger); g_lua.bindSingletonFunction("g_logger", "fireOldMessages", &Logger::fireOldMessages, &g_logger); g_lua.bindSingletonFunction("g_logger", "setLogFile", &Logger::setLogFile, &g_logger); g_lua.bindSingletonFunction("g_logger", "setOnLog", &Logger::setOnLog, &g_logger); g_lua.bindSingletonFunction("g_logger", "debug", &Logger::debug, &g_logger); g_lua.bindSingletonFunction("g_logger", "info", &Logger::info, &g_logger); g_lua.bindSingletonFunction("g_logger", "warning", &Logger::warning, &g_logger); g_lua.bindSingletonFunction("g_logger", "error", &Logger::error, &g_logger); g_lua.bindSingletonFunction("g_logger", "fatal", &Logger::fatal, &g_logger); // ModuleManager g_lua.registerSingletonClass("g_modules"); g_lua.bindSingletonFunction("g_modules", "discoverModules", &ModuleManager::discoverModules, &g_modules); g_lua.bindSingletonFunction("g_modules", "autoLoadModules", &ModuleManager::autoLoadModules, &g_modules); g_lua.bindSingletonFunction("g_modules", "discoverModule", &ModuleManager::discoverModule, &g_modules); g_lua.bindSingletonFunction("g_modules", "ensureModuleLoaded", &ModuleManager::ensureModuleLoaded, &g_modules); g_lua.bindSingletonFunction("g_modules", "unloadModules", &ModuleManager::unloadModules, &g_modules); g_lua.bindSingletonFunction("g_modules", "reloadModules", &ModuleManager::reloadModules, &g_modules); g_lua.bindSingletonFunction("g_modules", "getModule", &ModuleManager::getModule, &g_modules); g_lua.bindSingletonFunction("g_modules", "getModules", &ModuleManager::getModules, &g_modules); // EventDispatcher g_lua.registerSingletonClass("g_dispatcher"); g_lua.bindSingletonFunction("g_dispatcher", "addEvent", &EventDispatcher::addEvent, &g_dispatcher); g_lua.bindSingletonFunction("g_dispatcher", "scheduleEvent", &EventDispatcher::scheduleEvent, &g_dispatcher); g_lua.bindSingletonFunction("g_dispatcher", "cycleEvent", &EventDispatcher::cycleEvent, &g_dispatcher); // ResourceManager g_lua.registerSingletonClass("g_resources"); g_lua.bindSingletonFunction("g_resources", "addSearchPath", &ResourceManager::addSearchPath, &g_resources); g_lua.bindSingletonFunction("g_resources", "setupUserWriteDir", &ResourceManager::setupUserWriteDir, &g_resources); g_lua.bindSingletonFunction("g_resources", "setWriteDir", &ResourceManager::setWriteDir, &g_resources); g_lua.bindSingletonFunction("g_resources", "searchAndAddPackages", &ResourceManager::searchAndAddPackages, &g_resources); g_lua.bindSingletonFunction("g_resources", "removeSearchPath", &ResourceManager::removeSearchPath, &g_resources); g_lua.bindSingletonFunction("g_resources", "fileExists", &ResourceManager::fileExists, &g_resources); g_lua.bindSingletonFunction("g_resources", "getRealDir", &ResourceManager::getRealDir, &g_resources); g_lua.bindSingletonFunction("g_resources", "getWorkDir", &ResourceManager::getWorkDir, &g_resources); g_lua.bindSingletonFunction("g_resources", "getSearchPaths", &ResourceManager::getSearchPaths, &g_resources); // Module g_lua.registerClass(); g_lua.bindClassMemberFunction("load", &Module::load); g_lua.bindClassMemberFunction("unload", &Module::unload); g_lua.bindClassMemberFunction("reload", &Module::reload); g_lua.bindClassMemberFunction("canReload", &Module::canReload); g_lua.bindClassMemberFunction("canUnload", &Module::canUnload); g_lua.bindClassMemberFunction("isLoaded", &Module::isLoaded); g_lua.bindClassMemberFunction("isReloadble", &Module::isReloadable); g_lua.bindClassMemberFunction("getDescription", &Module::getDescription); g_lua.bindClassMemberFunction("getName", &Module::getName); g_lua.bindClassMemberFunction("getAuthor", &Module::getAuthor); g_lua.bindClassMemberFunction("getWebsite", &Module::getWebsite); g_lua.bindClassMemberFunction("getVersion", &Module::getVersion); g_lua.bindClassMemberFunction("isAutoLoad", &Module::isAutoLoad); g_lua.bindClassMemberFunction("getAutoLoadPriority", &Module::getAutoLoadPriority); // Event g_lua.registerClass(); g_lua.bindClassMemberFunction("cancel", &Event::cancel); g_lua.bindClassMemberFunction("execute", &Event::execute); g_lua.bindClassMemberFunction("isCanceled", &Event::isCanceled); g_lua.bindClassMemberFunction("isExecuted", &Event::isExecuted); // ScheduledEvent g_lua.registerClass(); g_lua.bindClassMemberFunction("nextCycle", &ScheduledEvent::nextCycle); g_lua.bindClassMemberFunction("ticks", &ScheduledEvent::ticks); g_lua.bindClassMemberFunction("reamaningTicks", &ScheduledEvent::reamaningTicks); g_lua.bindClassMemberFunction("delay", &ScheduledEvent::delay); g_lua.bindClassMemberFunction("cyclesExecuted", &ScheduledEvent::cyclesExecuted); g_lua.bindClassMemberFunction("maxCycles", &ScheduledEvent::maxCycles); #ifdef FW_GRAPHICS // GraphicalApplication g_lua.bindSingletonFunction("g_app", "setForegroundPaneMaxFps", &GraphicalApplication::setForegroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "setBackgroundPaneMaxFps", &GraphicalApplication::setBackgroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "isOnInputEvent", &GraphicalApplication::isOnInputEvent, &g_app); g_lua.bindSingletonFunction("g_app", "getForegroundPaneFps", &GraphicalApplication::getForegroundPaneFps, &g_app); g_lua.bindSingletonFunction("g_app", "getBackgroundPaneFps", &GraphicalApplication::getBackgroundPaneFps, &g_app); g_lua.bindSingletonFunction("g_app", "getForegroundPaneMaxFps", &GraphicalApplication::getForegroundPaneMaxFps, &g_app); g_lua.bindSingletonFunction("g_app", "getBackgroundPaneMaxFps", &GraphicalApplication::getBackgroundPaneMaxFps, &g_app); // PlatformWindow g_lua.registerSingletonClass("g_window"); g_lua.bindSingletonFunction("g_window", "move", &PlatformWindow::move, &g_window); g_lua.bindSingletonFunction("g_window", "resize", &PlatformWindow::resize, &g_window); g_lua.bindSingletonFunction("g_window", "show", &PlatformWindow::show, &g_window); g_lua.bindSingletonFunction("g_window", "hide", &PlatformWindow::hide, &g_window); g_lua.bindSingletonFunction("g_window", "maximize", &PlatformWindow::maximize, &g_window); g_lua.bindSingletonFunction("g_window", "restoreMouseCursor", &PlatformWindow::restoreMouseCursor, &g_window); g_lua.bindSingletonFunction("g_window", "showMouse", &PlatformWindow::showMouse, &g_window); g_lua.bindSingletonFunction("g_window", "hideMouse", &PlatformWindow::hideMouse, &g_window); g_lua.bindSingletonFunction("g_window", "setTitle", &PlatformWindow::setTitle, &g_window); g_lua.bindSingletonFunction("g_window", "setMouseCursor", &PlatformWindow::setMouseCursor, &g_window); g_lua.bindSingletonFunction("g_window", "setMinimumSize", &PlatformWindow::setMinimumSize, &g_window); g_lua.bindSingletonFunction("g_window", "setFullscreen", &PlatformWindow::setFullscreen, &g_window); g_lua.bindSingletonFunction("g_window", "setVerticalSync", &PlatformWindow::setVerticalSync, &g_window); g_lua.bindSingletonFunction("g_window", "setIcon", &PlatformWindow::setIcon, &g_window); g_lua.bindSingletonFunction("g_window", "setClipboardText", &PlatformWindow::setClipboardText, &g_window); g_lua.bindSingletonFunction("g_window", "getDisplaySize", &PlatformWindow::getDisplaySize, &g_window); g_lua.bindSingletonFunction("g_window", "getClipboardText", &PlatformWindow::getClipboardText, &g_window); g_lua.bindSingletonFunction("g_window", "getPlatformType", &PlatformWindow::getPlatformType, &g_window); g_lua.bindSingletonFunction("g_window", "getDisplayWidth", &PlatformWindow::getDisplayWidth, &g_window); g_lua.bindSingletonFunction("g_window", "getDisplayHeight", &PlatformWindow::getDisplayHeight, &g_window); g_lua.bindSingletonFunction("g_window", "getUnmaximizedSize", &PlatformWindow::getUnmaximizedSize, &g_window); g_lua.bindSingletonFunction("g_window", "getSize", &PlatformWindow::getSize, &g_window); g_lua.bindSingletonFunction("g_window", "getWidth", &PlatformWindow::getWidth, &g_window); g_lua.bindSingletonFunction("g_window", "getHeight", &PlatformWindow::getHeight, &g_window); g_lua.bindSingletonFunction("g_window", "getUnmaximizedPos", &PlatformWindow::getUnmaximizedPos, &g_window); g_lua.bindSingletonFunction("g_window", "getPosition", &PlatformWindow::getPosition, &g_window); g_lua.bindSingletonFunction("g_window", "getX", &PlatformWindow::getX, &g_window); g_lua.bindSingletonFunction("g_window", "getY", &PlatformWindow::getY, &g_window); g_lua.bindSingletonFunction("g_window", "getMousePosition", &PlatformWindow::getMousePosition, &g_window); g_lua.bindSingletonFunction("g_window", "getKeyboardModifiers", &PlatformWindow::getKeyboardModifiers, &g_window); g_lua.bindSingletonFunction("g_window", "isKeyPressed", &PlatformWindow::isKeyPressed, &g_window); g_lua.bindSingletonFunction("g_window", "isMouseButtonPressed", &PlatformWindow::isMouseButtonPressed, &g_window); g_lua.bindSingletonFunction("g_window", "isVisible", &PlatformWindow::isVisible, &g_window); g_lua.bindSingletonFunction("g_window", "isFullscreen", &PlatformWindow::isFullscreen, &g_window); g_lua.bindSingletonFunction("g_window", "isMaximized", &PlatformWindow::isMaximized, &g_window); g_lua.bindSingletonFunction("g_window", "hasFocus", &PlatformWindow::hasFocus, &g_window); // Graphics g_lua.registerSingletonClass("g_graphics"); g_lua.bindSingletonFunction("g_graphics", "isPainterEngineAvailable", &Graphics::isPainterEngineAvailable, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "selectPainterEngine", &Graphics::selectPainterEngine, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "canCacheBackbuffer", &Graphics::canCacheBackbuffer, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "canUseShaders", &Graphics::canUseShaders, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getPainterEngine", &Graphics::getPainterEngine, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getViewportSize", &Graphics::getViewportSize, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getVendor", &Graphics::getVendor, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getRenderer", &Graphics::getRenderer, &g_graphics); g_lua.bindSingletonFunction("g_graphics", "getVersion", &Graphics::getVersion, &g_graphics); // Textures g_lua.registerSingletonClass("g_textures"); g_lua.bindSingletonFunction("g_textures", "clearTexturesCache", &TextureManager::clearTexturesCache, &g_textures); // UI g_lua.registerSingletonClass("g_ui"); g_lua.bindSingletonFunction("g_ui", "clearStyles", &UIManager::clearStyles, &g_ui); g_lua.bindSingletonFunction("g_ui", "importStyle", &UIManager::importStyle, &g_ui); g_lua.bindSingletonFunction("g_ui", "getStyle", &UIManager::getStyle, &g_ui); g_lua.bindSingletonFunction("g_ui", "getStyleClass", &UIManager::getStyleClass, &g_ui); g_lua.bindSingletonFunction("g_ui", "loadUI", &UIManager::loadUI, &g_ui); g_lua.bindSingletonFunction("g_ui", "displayUI", &UIManager::displayUI, &g_ui); g_lua.bindSingletonFunction("g_ui", "createWidget", &UIManager::createWidget, &g_ui); g_lua.bindSingletonFunction("g_ui", "createWidgetFromOTML", &UIManager::createWidgetFromOTML, &g_ui); g_lua.bindSingletonFunction("g_ui", "getRootWidget", &UIManager::getRootWidget, &g_ui); g_lua.bindSingletonFunction("g_ui", "getDraggingWidget", &UIManager::getDraggingWidget, &g_ui); g_lua.bindSingletonFunction("g_ui", "getPressedWidget", &UIManager::getPressedWidget, &g_ui); g_lua.bindSingletonFunction("g_ui", "setDebugBoxesDrawing", &UIManager::setDebugBoxesDrawing, &g_ui); g_lua.bindSingletonFunction("g_ui", "isDrawingDebugBoxes", &UIManager::setDebugBoxesDrawing, &g_ui); // FontManager g_lua.registerSingletonClass("g_fonts"); g_lua.bindSingletonFunction("g_fonts", "clearFonts", &FontManager::clearFonts, &g_fonts); g_lua.bindSingletonFunction("g_fonts", "importFont", &FontManager::importFont, &g_fonts); g_lua.bindSingletonFunction("g_fonts", "fontExists", &FontManager::fontExists, &g_fonts); g_lua.bindSingletonFunction("g_fonts", "setDefaultFont", &FontManager::setDefaultFont, &g_fonts); // ParticleManager g_lua.registerSingletonClass("g_particles"); g_lua.bindSingletonFunction("g_particles", "importParticle", &ParticleManager::importParticle, &g_particles); g_lua.bindSingletonFunction("g_particles", "getEffectsTypes", &ParticleManager::getEffectsTypes, &g_particles); // UIWidget g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return UIWidgetPtr(new UIWidget); }); g_lua.bindClassMemberFunction("addChild", &UIWidget::addChild); g_lua.bindClassMemberFunction("insertChild", &UIWidget::insertChild); g_lua.bindClassMemberFunction("removeChild", &UIWidget::removeChild); g_lua.bindClassMemberFunction("focusChild", &UIWidget::focusChild); g_lua.bindClassMemberFunction("focusNextChild", &UIWidget::focusNextChild); g_lua.bindClassMemberFunction("focusPreviousChild", &UIWidget::focusPreviousChild); g_lua.bindClassMemberFunction("lowerChild", &UIWidget::lowerChild); g_lua.bindClassMemberFunction("raiseChild", &UIWidget::raiseChild); g_lua.bindClassMemberFunction("moveChildToIndex", &UIWidget::moveChildToIndex); g_lua.bindClassMemberFunction("lockChild", &UIWidget::lockChild); g_lua.bindClassMemberFunction("unlockChild", &UIWidget::unlockChild); g_lua.bindClassMemberFunction("mergeStyle", &UIWidget::mergeStyle); g_lua.bindClassMemberFunction("applyStyle", &UIWidget::applyStyle); g_lua.bindClassMemberFunction("addAnchor", &UIWidget::addAnchor); g_lua.bindClassMemberFunction("removeAnchor", &UIWidget::removeAnchor); g_lua.bindClassMemberFunction("fill", &UIWidget::fill); g_lua.bindClassMemberFunction("centerIn", &UIWidget::centerIn); g_lua.bindClassMemberFunction("breakAnchors", &UIWidget::breakAnchors); g_lua.bindClassMemberFunction("updateParentLayout", &UIWidget::updateParentLayout); g_lua.bindClassMemberFunction("updateLayout", &UIWidget::updateLayout); g_lua.bindClassMemberFunction("lock", &UIWidget::lock); g_lua.bindClassMemberFunction("unlock", &UIWidget::unlock); g_lua.bindClassMemberFunction("focus", &UIWidget::focus); g_lua.bindClassMemberFunction("lower", &UIWidget::lower); g_lua.bindClassMemberFunction("raise", &UIWidget::raise); g_lua.bindClassMemberFunction("grabMouse", &UIWidget::grabMouse); g_lua.bindClassMemberFunction("ungrabMouse", &UIWidget::ungrabMouse); g_lua.bindClassMemberFunction("grabKeyboard", &UIWidget::grabKeyboard); g_lua.bindClassMemberFunction("ungrabKeyboard", &UIWidget::ungrabKeyboard); g_lua.bindClassMemberFunction("bindRectToParent", &UIWidget::bindRectToParent); g_lua.bindClassMemberFunction("destroy", &UIWidget::destroy); g_lua.bindClassMemberFunction("destroyChildren", &UIWidget::destroyChildren); g_lua.bindClassMemberFunction("setId", &UIWidget::setId); g_lua.bindClassMemberFunction("setParent", &UIWidget::setParent); g_lua.bindClassMemberFunction("setLayout", &UIWidget::setLayout); g_lua.bindClassMemberFunction("setRect", &UIWidget::setRect); g_lua.bindClassMemberFunction("setStyle", &UIWidget::setStyle); g_lua.bindClassMemberFunction("setStyleFromNode", &UIWidget::setStyleFromNode); g_lua.bindClassMemberFunction("setEnabled", &UIWidget::setEnabled); g_lua.bindClassMemberFunction("setVisible", &UIWidget::setVisible); g_lua.bindClassMemberFunction("setOn", &UIWidget::setOn); g_lua.bindClassMemberFunction("setChecked", &UIWidget::setChecked); g_lua.bindClassMemberFunction("setFocusable", &UIWidget::setFocusable); g_lua.bindClassMemberFunction("setPhantom", &UIWidget::setPhantom); g_lua.bindClassMemberFunction("setDragable", &UIWidget::setDragable); g_lua.bindClassMemberFunction("setFixedSize", &UIWidget::setFixedSize); g_lua.bindClassMemberFunction("setClipping", &UIWidget::setClipping); g_lua.bindClassMemberFunction("setLastFocusReason", &UIWidget::setLastFocusReason); g_lua.bindClassMemberFunction("setAutoRepeatDelay", &UIWidget::setAutoRepeatDelay); g_lua.bindClassMemberFunction("setVirtualOffset", &UIWidget::setVirtualOffset); g_lua.bindClassMemberFunction("isVisible", &UIWidget::isVisible); g_lua.bindClassMemberFunction("isChildLocked", &UIWidget::isChildLocked); g_lua.bindClassMemberFunction("hasChild", &UIWidget::hasChild); g_lua.bindClassMemberFunction("getChildIndex", &UIWidget::getChildIndex); g_lua.bindClassMemberFunction("getMarginRect", &UIWidget::getMarginRect); g_lua.bindClassMemberFunction("getPaddingRect", &UIWidget::getPaddingRect); g_lua.bindClassMemberFunction("getChildrenRect", &UIWidget::getChildrenRect); g_lua.bindClassMemberFunction("getAnchoredLayout", &UIWidget::getAnchoredLayout); g_lua.bindClassMemberFunction("getRootParent", &UIWidget::getRootParent); g_lua.bindClassMemberFunction("getChildAfter", &UIWidget::getChildAfter); g_lua.bindClassMemberFunction("getChildBefore", &UIWidget::getChildBefore); g_lua.bindClassMemberFunction("getChildById", &UIWidget::getChildById); g_lua.bindClassMemberFunction("getChildByPos", &UIWidget::getChildByPos); g_lua.bindClassMemberFunction("getChildByIndex", &UIWidget::getChildByIndex); g_lua.bindClassMemberFunction("recursiveGetChildById", &UIWidget::recursiveGetChildById); g_lua.bindClassMemberFunction("recursiveGetChildByPos", &UIWidget::recursiveGetChildByPos); g_lua.bindClassMemberFunction("recursiveGetChildrenByPos", &UIWidget::recursiveGetChildrenByPos); g_lua.bindClassMemberFunction("recursiveGetChildrenByMarginPos", &UIWidget::recursiveGetChildrenByMarginPos); g_lua.bindClassMemberFunction("backwardsGetWidgetById", &UIWidget::backwardsGetWidgetById); g_lua.bindClassMemberFunction("asUIWidget", &UIWidget::asUIWidget); g_lua.bindClassMemberFunction("resize", &UIWidget::resize); g_lua.bindClassMemberFunction("move", &UIWidget::move); g_lua.bindClassMemberFunction("hide", &UIWidget::hide); g_lua.bindClassMemberFunction("show", &UIWidget::show); g_lua.bindClassMemberFunction("disable", &UIWidget::disable); g_lua.bindClassMemberFunction("enable", &UIWidget::enable); g_lua.bindClassMemberFunction("isActive", &UIWidget::isActive); g_lua.bindClassMemberFunction("isEnabled", &UIWidget::isEnabled); g_lua.bindClassMemberFunction("isDisabled", &UIWidget::isDisabled); g_lua.bindClassMemberFunction("isFocused", &UIWidget::isFocused); g_lua.bindClassMemberFunction("isHovered", &UIWidget::isHovered); g_lua.bindClassMemberFunction("isPressed", &UIWidget::isPressed); g_lua.bindClassMemberFunction("isFirst", &UIWidget::isFirst); g_lua.bindClassMemberFunction("isMiddle", &UIWidget::isMiddle); g_lua.bindClassMemberFunction("isLast", &UIWidget::isLast); g_lua.bindClassMemberFunction("isAlternate", &UIWidget::isAlternate); g_lua.bindClassMemberFunction("isChecked", &UIWidget::isChecked); g_lua.bindClassMemberFunction("isOn", &UIWidget::isOn); g_lua.bindClassMemberFunction("isDragging", &UIWidget::isDragging); g_lua.bindClassMemberFunction("isHidden", &UIWidget::isHidden); g_lua.bindClassMemberFunction("isExplicitlyEnabled", &UIWidget::isExplicitlyEnabled); g_lua.bindClassMemberFunction("isExplicitlyVisible", &UIWidget::isExplicitlyVisible); g_lua.bindClassMemberFunction("isFocusable", &UIWidget::isFocusable); g_lua.bindClassMemberFunction("isPhantom", &UIWidget::isPhantom); g_lua.bindClassMemberFunction("isDragable", &UIWidget::isDragable); g_lua.bindClassMemberFunction("isFixedSize", &UIWidget::isFixedSize); g_lua.bindClassMemberFunction("isClipping", &UIWidget::isClipping); g_lua.bindClassMemberFunction("isDestroyed", &UIWidget::isDestroyed); g_lua.bindClassMemberFunction("hasChildren", &UIWidget::hasChildren); g_lua.bindClassMemberFunction("containsMarginPoint", &UIWidget::containsMarginPoint); g_lua.bindClassMemberFunction("containsPaddingPoint", &UIWidget::containsPaddingPoint); g_lua.bindClassMemberFunction("containsPoint", &UIWidget::containsPoint); g_lua.bindClassMemberFunction("getId", &UIWidget::getId); g_lua.bindClassMemberFunction("getParent", &UIWidget::getParent); g_lua.bindClassMemberFunction("getFocusedChild", &UIWidget::getFocusedChild); g_lua.bindClassMemberFunction("getChildren", &UIWidget::getChildren); g_lua.bindClassMemberFunction("getFirstChild", &UIWidget::getFirstChild); g_lua.bindClassMemberFunction("getLastChild", &UIWidget::getLastChild); g_lua.bindClassMemberFunction("getLayout", &UIWidget::getLayout); g_lua.bindClassMemberFunction("getStyle", &UIWidget::getStyle); g_lua.bindClassMemberFunction("getChildCount", &UIWidget::getChildCount); g_lua.bindClassMemberFunction("getLastFocusReason", &UIWidget::getLastFocusReason); g_lua.bindClassMemberFunction("getAutoRepeatDelay", &UIWidget::getAutoRepeatDelay); g_lua.bindClassMemberFunction("getVirtualOffset", &UIWidget::getVirtualOffset); g_lua.bindClassMemberFunction("getStyleName", &UIWidget::getStyleName); g_lua.bindClassMemberFunction("getLastClickPosition", &UIWidget::getLastClickPosition); g_lua.bindClassMemberFunction("setX", &UIWidget::setX); g_lua.bindClassMemberFunction("setY", &UIWidget::setY); g_lua.bindClassMemberFunction("setWidth", &UIWidget::setWidth); g_lua.bindClassMemberFunction("setHeight", &UIWidget::setHeight); g_lua.bindClassMemberFunction("setSize", &UIWidget::setSize); g_lua.bindClassMemberFunction("setPosition", &UIWidget::setPosition); g_lua.bindClassMemberFunction("setColor", &UIWidget::setColor); g_lua.bindClassMemberFunction("setBackgroundColor", &UIWidget::setBackgroundColor); g_lua.bindClassMemberFunction("setBackgroundOffsetX", &UIWidget::setBackgroundOffsetX); g_lua.bindClassMemberFunction("setBackgroundOffsetY", &UIWidget::setBackgroundOffsetY); g_lua.bindClassMemberFunction("setBackgroundOffset", &UIWidget::setBackgroundOffset); g_lua.bindClassMemberFunction("setBackgroundWidth", &UIWidget::setBackgroundWidth); g_lua.bindClassMemberFunction("setBackgroundHeight", &UIWidget::setBackgroundHeight); g_lua.bindClassMemberFunction("setBackgroundSize", &UIWidget::setBackgroundSize); g_lua.bindClassMemberFunction("setBackgroundRect", &UIWidget::setBackgroundRect); g_lua.bindClassMemberFunction("setIcon", &UIWidget::setIcon); g_lua.bindClassMemberFunction("setIconColor", &UIWidget::setIconColor); g_lua.bindClassMemberFunction("setIconOffsetX", &UIWidget::setIconOffsetX); g_lua.bindClassMemberFunction("setIconOffsetY", &UIWidget::setIconOffsetY); g_lua.bindClassMemberFunction("setIconOffset", &UIWidget::setIconOffset); g_lua.bindClassMemberFunction("setIconWidth", &UIWidget::setIconWidth); g_lua.bindClassMemberFunction("setIconHeight", &UIWidget::setIconHeight); g_lua.bindClassMemberFunction("setIconSize", &UIWidget::setIconSize); g_lua.bindClassMemberFunction("setIconRect", &UIWidget::setIconRect); g_lua.bindClassMemberFunction("setIconClip", &UIWidget::setIconClip); g_lua.bindClassMemberFunction("setBorderWidth", &UIWidget::setBorderWidth); g_lua.bindClassMemberFunction("setBorderWidthTop", &UIWidget::setBorderWidthTop); g_lua.bindClassMemberFunction("setBorderWidthRight", &UIWidget::setBorderWidthRight); g_lua.bindClassMemberFunction("setBorderWidthBottom", &UIWidget::setBorderWidthBottom); g_lua.bindClassMemberFunction("setBorderWidthLeft", &UIWidget::setBorderWidthLeft); g_lua.bindClassMemberFunction("setBorderColor", &UIWidget::setBorderColor); g_lua.bindClassMemberFunction("setBorderColorTop", &UIWidget::setBorderColorTop); g_lua.bindClassMemberFunction("setBorderColorRight", &UIWidget::setBorderColorRight); g_lua.bindClassMemberFunction("setBorderColorBottom", &UIWidget::setBorderColorBottom); g_lua.bindClassMemberFunction("setBorderColorLeft", &UIWidget::setBorderColorLeft); g_lua.bindClassMemberFunction("setMargin", &UIWidget::setMargin); g_lua.bindClassMemberFunction("setMarginHorizontal", &UIWidget::setMarginHorizontal); g_lua.bindClassMemberFunction("setMarginVertical", &UIWidget::setMarginVertical); g_lua.bindClassMemberFunction("setMarginTop", &UIWidget::setMarginTop); g_lua.bindClassMemberFunction("setMarginRight", &UIWidget::setMarginRight); g_lua.bindClassMemberFunction("setMarginBottom", &UIWidget::setMarginBottom); g_lua.bindClassMemberFunction("setMarginLeft", &UIWidget::setMarginLeft); g_lua.bindClassMemberFunction("setPadding", &UIWidget::setPadding); g_lua.bindClassMemberFunction("setPaddingHorizontal", &UIWidget::setPaddingHorizontal); g_lua.bindClassMemberFunction("setPaddingVertical", &UIWidget::setPaddingVertical); g_lua.bindClassMemberFunction("setPaddingTop", &UIWidget::setPaddingTop); g_lua.bindClassMemberFunction("setPaddingRight", &UIWidget::setPaddingRight); g_lua.bindClassMemberFunction("setPaddingBottom", &UIWidget::setPaddingBottom); g_lua.bindClassMemberFunction("setPaddingLeft", &UIWidget::setPaddingLeft); g_lua.bindClassMemberFunction("setOpacity", &UIWidget::setOpacity); g_lua.bindClassMemberFunction("getX", &UIWidget::getX); g_lua.bindClassMemberFunction("getY", &UIWidget::getY); g_lua.bindClassMemberFunction("getPosition", &UIWidget::getPosition); g_lua.bindClassMemberFunction("getWidth", &UIWidget::getWidth); g_lua.bindClassMemberFunction("getHeight", &UIWidget::getHeight); g_lua.bindClassMemberFunction("getSize", &UIWidget::getSize); g_lua.bindClassMemberFunction("getRect", &UIWidget::getRect); g_lua.bindClassMemberFunction("getColor", &UIWidget::getColor); g_lua.bindClassMemberFunction("getBackgroundColor", &UIWidget::getBackgroundColor); g_lua.bindClassMemberFunction("getBackgroundOffsetX", &UIWidget::getBackgroundOffsetX); g_lua.bindClassMemberFunction("getBackgroundOffsetY", &UIWidget::getBackgroundOffsetY); g_lua.bindClassMemberFunction("getBackgroundOffset", &UIWidget::getBackgroundOffset); g_lua.bindClassMemberFunction("getBackgroundWidth", &UIWidget::getBackgroundWidth); g_lua.bindClassMemberFunction("getBackgroundHeight", &UIWidget::getBackgroundHeight); g_lua.bindClassMemberFunction("getBackgroundSize", &UIWidget::getBackgroundSize); g_lua.bindClassMemberFunction("getBackgroundRect", &UIWidget::getBackgroundRect); g_lua.bindClassMemberFunction("getIconColor", &UIWidget::getIconColor); g_lua.bindClassMemberFunction("getIconOffsetX", &UIWidget::getIconOffsetX); g_lua.bindClassMemberFunction("getIconOffsetY", &UIWidget::getIconOffsetY); g_lua.bindClassMemberFunction("getIconOffset", &UIWidget::getIconOffset); g_lua.bindClassMemberFunction("getIconWidth", &UIWidget::getIconWidth); g_lua.bindClassMemberFunction("getIconHeight", &UIWidget::getIconHeight); g_lua.bindClassMemberFunction("getIconSize", &UIWidget::getIconSize); g_lua.bindClassMemberFunction("getIconRect", &UIWidget::getIconRect); g_lua.bindClassMemberFunction("getIconClip", &UIWidget::getIconClip); g_lua.bindClassMemberFunction("getBorderTopColor", &UIWidget::getBorderTopColor); g_lua.bindClassMemberFunction("getBorderRightColor", &UIWidget::getBorderRightColor); g_lua.bindClassMemberFunction("getBorderBottomColor", &UIWidget::getBorderBottomColor); g_lua.bindClassMemberFunction("getBorderLeftColor", &UIWidget::getBorderLeftColor); g_lua.bindClassMemberFunction("getBorderTopWidth", &UIWidget::getBorderTopWidth); g_lua.bindClassMemberFunction("getBorderRightWidth", &UIWidget::getBorderRightWidth); g_lua.bindClassMemberFunction("getBorderBottomWidth", &UIWidget::getBorderBottomWidth); g_lua.bindClassMemberFunction("getBorderLeftWidth", &UIWidget::getBorderLeftWidth); g_lua.bindClassMemberFunction("getMarginTop", &UIWidget::getMarginTop); g_lua.bindClassMemberFunction("getMarginRight", &UIWidget::getMarginRight); g_lua.bindClassMemberFunction("getMarginBottom", &UIWidget::getMarginBottom); g_lua.bindClassMemberFunction("getMarginLeft", &UIWidget::getMarginLeft); g_lua.bindClassMemberFunction("getPaddingTop", &UIWidget::getPaddingTop); g_lua.bindClassMemberFunction("getPaddingRight", &UIWidget::getPaddingRight); g_lua.bindClassMemberFunction("getPaddingBottom", &UIWidget::getPaddingBottom); g_lua.bindClassMemberFunction("getPaddingLeft", &UIWidget::getPaddingLeft); g_lua.bindClassMemberFunction("getOpacity", &UIWidget::getOpacity); g_lua.bindClassMemberFunction("setImageSource", &UIWidget::setImageSource); g_lua.bindClassMemberFunction("setImageClip", &UIWidget::setImageClip); g_lua.bindClassMemberFunction("setImageOffsetX", &UIWidget::setImageOffsetX); g_lua.bindClassMemberFunction("setImageOffsetY", &UIWidget::setImageOffsetY); g_lua.bindClassMemberFunction("setImageOffset", &UIWidget::setImageOffset); g_lua.bindClassMemberFunction("setImageWidth", &UIWidget::setImageWidth); g_lua.bindClassMemberFunction("setImageHeight", &UIWidget::setImageHeight); g_lua.bindClassMemberFunction("setImageSize", &UIWidget::setImageSize); g_lua.bindClassMemberFunction("setImageRect", &UIWidget::setImageRect); g_lua.bindClassMemberFunction("setImageColor", &UIWidget::setImageColor); g_lua.bindClassMemberFunction("setImageFixedRatio", &UIWidget::setImageFixedRatio); g_lua.bindClassMemberFunction("setImageRepeated", &UIWidget::setImageRepeated); g_lua.bindClassMemberFunction("setImageSmooth", &UIWidget::setImageSmooth); g_lua.bindClassMemberFunction("setImageBorderTop", &UIWidget::setImageBorderTop); g_lua.bindClassMemberFunction("setImageBorderRight", &UIWidget::setImageBorderRight); g_lua.bindClassMemberFunction("setImageBorderBottom", &UIWidget::setImageBorderBottom); g_lua.bindClassMemberFunction("setImageBorderLeft", &UIWidget::setImageBorderLeft); g_lua.bindClassMemberFunction("setImageBorder", &UIWidget::setImageBorder); g_lua.bindClassMemberFunction("getImageClip", &UIWidget::getImageClip); g_lua.bindClassMemberFunction("getImageOffsetX", &UIWidget::getImageOffsetX); g_lua.bindClassMemberFunction("getImageOffsetY", &UIWidget::getImageOffsetY); g_lua.bindClassMemberFunction("getImageOffset", &UIWidget::getImageOffset); g_lua.bindClassMemberFunction("getImageWidth", &UIWidget::getImageWidth); g_lua.bindClassMemberFunction("getImageHeight", &UIWidget::getImageHeight); g_lua.bindClassMemberFunction("getImageSize", &UIWidget::getImageSize); g_lua.bindClassMemberFunction("getImageRect", &UIWidget::getImageRect); g_lua.bindClassMemberFunction("getImageColor", &UIWidget::getImageColor); g_lua.bindClassMemberFunction("isImageFixedRatio", &UIWidget::isImageFixedRatio); g_lua.bindClassMemberFunction("isImageSmooth", &UIWidget::isImageSmooth); g_lua.bindClassMemberFunction("getImageBorderTop", &UIWidget::getImageBorderTop); g_lua.bindClassMemberFunction("getImageBorderRight", &UIWidget::getImageBorderRight); g_lua.bindClassMemberFunction("getImageBorderBottom", &UIWidget::getImageBorderBottom); g_lua.bindClassMemberFunction("getImageBorderLeft", &UIWidget::getImageBorderLeft); g_lua.bindClassMemberFunction("resizeToText", &UIWidget::resizeToText); g_lua.bindClassMemberFunction("clearText", &UIWidget::clearText); g_lua.bindClassMemberFunction("setText", &UIWidget::setText); g_lua.bindClassMemberFunction("setTextAlign", &UIWidget::setTextAlign); g_lua.bindClassMemberFunction("setTextOffset", &UIWidget::setTextOffset); g_lua.bindClassMemberFunction("setTextWrap", &UIWidget::setTextWrap); g_lua.bindClassMemberFunction("setTextAutoResize", &UIWidget::setTextAutoResize); g_lua.bindClassMemberFunction("setFont", &UIWidget::setFont); g_lua.bindClassMemberFunction("getText", &UIWidget::getText); g_lua.bindClassMemberFunction("getDrawText", &UIWidget::getDrawText); g_lua.bindClassMemberFunction("getTextAlign", &UIWidget::getTextAlign); g_lua.bindClassMemberFunction("getTextOffset", &UIWidget::getTextOffset); g_lua.bindClassMemberFunction("getTextWrap", &UIWidget::getTextWrap); g_lua.bindClassMemberFunction("getFont", &UIWidget::getFont); g_lua.bindClassMemberFunction("getTextSize", &UIWidget::getTextSize); // UILayout g_lua.registerClass(); g_lua.bindClassMemberFunction("update", &UILayout::update); g_lua.bindClassMemberFunction("updateLater", &UILayout::updateLater); g_lua.bindClassMemberFunction("applyStyle", &UILayout::applyStyle); g_lua.bindClassMemberFunction("addWidget", &UILayout::addWidget); g_lua.bindClassMemberFunction("removeWidget", &UILayout::removeWidget); g_lua.bindClassMemberFunction("disableUpdates", &UILayout::disableUpdates); g_lua.bindClassMemberFunction("enableUpdates", &UILayout::enableUpdates); g_lua.bindClassMemberFunction("setParent", &UILayout::setParent); g_lua.bindClassMemberFunction("getParentWidget", &UILayout::getParentWidget); g_lua.bindClassMemberFunction("isUpdateDisabled", &UILayout::isUpdateDisabled); g_lua.bindClassMemberFunction("isUpdating", &UILayout::isUpdating); g_lua.bindClassMemberFunction("asUILayout", &UILayout::asUILayout); g_lua.bindClassMemberFunction("asUIAnchorLayout", &UILayout::asUIAnchorLayout); g_lua.bindClassMemberFunction("asUIBoxLayout", &UILayout::asUIBoxLayout); g_lua.bindClassMemberFunction("asUIHorizontalLayout", &UILayout::asUIHorizontalLayout); g_lua.bindClassMemberFunction("asUIVerticalLayout", &UILayout::asUIVerticalLayout); g_lua.bindClassMemberFunction("asUIGridLayout", &UILayout::asUIGridLayout); // UIBoxLayout g_lua.registerClass(); g_lua.bindClassMemberFunction("setSpacing", &UIBoxLayout::setSpacing); g_lua.bindClassMemberFunction("setFitChildren", &UIBoxLayout::setFitChildren); // UIVerticalLayout g_lua.registerClass(); g_lua.bindClassStaticFunction("create", [](UIWidgetPtr parent){ return UIVerticalLayoutPtr(new UIVerticalLayout(parent)); } ); g_lua.bindClassMemberFunction("setAlignBottom", &UIVerticalLayout::setAlignBottom); // UIHorizontalLayout g_lua.registerClass(); g_lua.bindClassStaticFunction("create", [](UIWidgetPtr parent){ return UIHorizontalLayoutPtr(new UIHorizontalLayout(parent)); } ); g_lua.bindClassMemberFunction("setAlignRight", &UIHorizontalLayout::setAlignRight); // UIGridLayout g_lua.registerClass(); g_lua.bindClassStaticFunction("create", [](UIWidgetPtr parent){ return UIGridLayoutPtr(new UIGridLayout(parent)); }); g_lua.bindClassMemberFunction("setCellSize", &UIGridLayout::setCellSize); g_lua.bindClassMemberFunction("setCellWidth", &UIGridLayout::setCellWidth); g_lua.bindClassMemberFunction("setCellHeight", &UIGridLayout::setCellHeight); g_lua.bindClassMemberFunction("setCellSpacing", &UIGridLayout::setCellSpacing); g_lua.bindClassMemberFunction("setFlow", &UIGridLayout::setFlow); g_lua.bindClassMemberFunction("setNumColumns", &UIGridLayout::setNumColumns); g_lua.bindClassMemberFunction("setNumLines", &UIGridLayout::setNumLines); g_lua.bindClassMemberFunction("asUIGridLayout", &UIGridLayout::asUIGridLayout); // UIAnchorLayout g_lua.registerClass(); g_lua.bindClassStaticFunction("create", [](UIWidgetPtr parent){ return UIAnchorLayoutPtr(new UIAnchorLayout(parent)); } ); g_lua.bindClassMemberFunction("removeAnchors", &UIAnchorLayout::removeAnchors); g_lua.bindClassMemberFunction("centerIn", &UIAnchorLayout::centerIn); g_lua.bindClassMemberFunction("fill", &UIAnchorLayout::fill); // UITextEdit g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return UITextEditPtr(new UITextEdit); } ); g_lua.bindClassMemberFunction("setTextHorizontalMargin", &UITextEdit::setTextHorizontalMargin); g_lua.bindClassMemberFunction("setCursorPos", &UITextEdit::setCursorPos); g_lua.bindClassMemberFunction("setCursorEnabled", &UITextEdit::setCursorEnabled); g_lua.bindClassMemberFunction("setTextHidden", &UITextEdit::setTextHidden); g_lua.bindClassMemberFunction("setValidCharacters", &UITextEdit::setValidCharacters); g_lua.bindClassMemberFunction("setShiftNavigation", &UITextEdit::setShiftNavigation); g_lua.bindClassMemberFunction("setMultiline", &UITextEdit::setMultiline); g_lua.bindClassMemberFunction("setMaxLength", &UITextEdit::setMaxLength); g_lua.bindClassMemberFunction("moveCursor", &UITextEdit::moveCursor); g_lua.bindClassMemberFunction("appendText", &UITextEdit::appendText); g_lua.bindClassMemberFunction("removeCharacter", &UITextEdit::removeCharacter); g_lua.bindClassMemberFunction("getDisplayedText", &UITextEdit::getDisplayedText); g_lua.bindClassMemberFunction("getTextPos", &UITextEdit::getTextPos); g_lua.bindClassMemberFunction("getTextHorizontalMargin", &UITextEdit::getTextHorizontalMargin); g_lua.bindClassMemberFunction("getCursorPos", &UITextEdit::getCursorPos); g_lua.bindClassMemberFunction("getMaxLength", &UITextEdit::getMaxLength); g_lua.bindClassMemberFunction("isCursorEnabled", &UITextEdit::isCursorEnabled); g_lua.bindClassMemberFunction("isTextHidden", &UITextEdit::isTextHidden); g_lua.bindClassMemberFunction("isShiftNavigation", &UITextEdit::isShiftNavigation); g_lua.bindClassMemberFunction("isMultiline", &UITextEdit::isMultiline); g_lua.registerClass(); g_lua.registerClass(); g_lua.bindClassMemberFunction("addMultiTexture", &PainterShaderProgram::addMultiTexture); // ParticleEffect g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return ParticleEffectTypePtr(new ParticleEffectType); }); g_lua.bindClassMemberFunction("getName", &ParticleEffectType::getName); g_lua.bindClassMemberFunction("getFile", &ParticleEffectType::getFile); g_lua.bindClassMemberFunction("getDescription", &ParticleEffectType::getDescription); // UIParticles g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return UIParticlesPtr(new UIParticles); } ); g_lua.bindClassMemberFunction("addEffect", &UIParticles::addEffect); #endif #ifdef FW_NET // Protocol g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return ProtocolPtr(new Protocol); }); g_lua.bindClassMemberFunction("connect", &Protocol::connect); g_lua.bindClassMemberFunction("disconnect", &Protocol::disconnect); g_lua.bindClassMemberFunction("isConnected", &Protocol::isConnected); g_lua.bindClassMemberFunction("isConnecting", &Protocol::isConnecting); g_lua.bindClassMemberFunction("send", &Protocol::send); // must change to safeSend g_lua.bindClassMemberFunction("recv", &Protocol::recv); g_lua.bindClassMemberFunction("getXteaKey", &Protocol::getXteaKey); g_lua.bindClassMemberFunction("generateXteaKey", &Protocol::generateXteaKey); g_lua.bindClassMemberFunction("enableXteaEncryption", &Protocol::enableXteaEncryption); g_lua.bindClassMemberFunction("enableChecksum", &Protocol::enableChecksum); // InputMessage g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return InputMessagePtr(new InputMessage); }); g_lua.bindClassMemberFunction("setBuffer", &InputMessage::setBuffer); g_lua.bindClassMemberFunction("skipBytes", &InputMessage::skipBytes); g_lua.bindClassMemberFunction("getU8", &InputMessage::getU8); g_lua.bindClassMemberFunction("getU16", &InputMessage::getU16); g_lua.bindClassMemberFunction("getU32", &InputMessage::getU32); g_lua.bindClassMemberFunction("getU64", &InputMessage::getU64); g_lua.bindClassMemberFunction("getString", &InputMessage::getString); g_lua.bindClassMemberFunction("peekU8", &InputMessage::peekU8); g_lua.bindClassMemberFunction("peekU16", &InputMessage::peekU16); g_lua.bindClassMemberFunction("peekU32", &InputMessage::peekU32); g_lua.bindClassMemberFunction("peekU64", &InputMessage::peekU64); g_lua.bindClassMemberFunction("decryptRsa", &InputMessage::decryptRsa); g_lua.bindClassMemberFunction("getReadSize", &InputMessage::getReadSize); g_lua.bindClassMemberFunction("getUnreadSize", &InputMessage::getUnreadSize); g_lua.bindClassMemberFunction("getMessageSize", &InputMessage::getMessageSize); g_lua.bindClassMemberFunction("eof", &InputMessage::eof); // OutputMessage g_lua.registerClass(); g_lua.bindClassStaticFunction("create", []{ return OutputMessagePtr(new OutputMessage); }); g_lua.bindClassMemberFunction("getBuffer", &OutputMessage::getBuffer); g_lua.bindClassMemberFunction("reset", &OutputMessage::reset); g_lua.bindClassMemberFunction("addU8", &OutputMessage::addU8); g_lua.bindClassMemberFunction("addU16", &OutputMessage::addU16); g_lua.bindClassMemberFunction("addU32", &OutputMessage::addU32); g_lua.bindClassMemberFunction("addU64", &OutputMessage::addU64); g_lua.bindClassMemberFunction("addString", &OutputMessage::addString); g_lua.bindClassMemberFunction("addPaddingBytes", &OutputMessage::addPaddingBytes); g_lua.bindClassMemberFunction("encryptRsa", &OutputMessage::encryptRsa); g_lua.bindClassMemberFunction("getMessageSize", &OutputMessage::getMessageSize); #endif #ifdef FW_SOUND // SoundManager g_lua.registerSingletonClass("g_sounds"); g_lua.bindSingletonFunction("g_sounds", "preload", &SoundManager::preload, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "enableSound", &SoundManager::enableSound, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "play", &SoundManager::play, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "enableMusic", &SoundManager::enableMusic, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "playMusic", &SoundManager::playMusic, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "stopMusic", &SoundManager::stopMusic, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "isMusicEnabled", &SoundManager::isMusicEnabled, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "isSoundEnabled", &SoundManager::isSoundEnabled, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "isAudioEnabled", &SoundManager::isAudioEnabled, &g_sounds); g_lua.bindSingletonFunction("g_sounds", "getCurrentMusic", &SoundManager::getCurrentMusic, &g_sounds); #endif }