Many enhancements in client API

* Fix issues in item use
* Stack animated texts values
* Add utility functions for changing creature color and jumping
* Add some new extended functionality
* Improve map shader API
This commit is contained in:
Eduardo Bart
2013-01-09 17:29:58 -02:00
parent aeb31f0669
commit cce2976156
38 changed files with 832 additions and 118 deletions

View File

@@ -0,0 +1,21 @@
# Try to find the ICU library
# ICU_FOUND - system has ICU
# ICU_INCLUDE_DIR - the ICU include directory
# ICU_LIBRARY - the ICU library
FIND_PATH(ICU_INCLUDE_DIR NAMES unicode/utf8.h)
SET(_ICUI18N_STATIC_LIBS libicui18n.a)
SET(_ICUI18N_SHARED_LIBS libicui18n.dll.a icui18n)
SET(_ICUUC_STATIC_LIBS libicuuc.a)
SET(_ICUUC_SHARED_LIBS libicuuc.dll.a icuuc)
IF(USE_STATIC_LIBS)
FIND_LIBRARY(ICUI18N_LIBRARY NAMES ${_ICUI18N_STATIC_LIBS} ${_ICUI18N_SHARED_LIBS})
FIND_LIBRARY(ICUUC_LIBRARY NAMES ${_ICUUC_STATIC_LIBS} ${_ICUUC_SHARED_LIBS})
ELSE()
FIND_LIBRARY(ICUI18N_LIBRARY NAMES ${_ICUI18N_SHARED_LIBS} ${_ICUI18N_STATIC_LIBS})
FIND_LIBRARY(ICUUC_LIBRARY NAMES ${_ICUUC_SHARED_LIBS} ${_ICUUC_STATIC_LIBS})
ENDIF()
SET(ICU_LIBRARIES ${ICUI18N_LIBRARY} ${ICUUC_LIBRARY})
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(ICU DEFAULT_MSG ICU_LIBRARY ICU_INCLUDE_DIR)
MARK_AS_ADVANCED(ICU_LIBRARIES ICU_INCLUDE_DIR)

View File

@@ -32,6 +32,7 @@
#include <framework/core/resourcemanager.h>
#include <framework/graphics/texturemanager.h>
#include <framework/stdext/net.h>
#include <framework/platform/platform.h>
#ifdef FW_GRAPHICS
#include <framework/graphics/graphics.h>
@@ -68,6 +69,17 @@ void Application::registerLuaFunctions()
g_lua.bindGlobalFunction("listSubnetAddresses", [](uint32 a, uint8 b) { return stdext::listSubnetAddresses(a, b); });
g_lua.bindGlobalFunction("ucwords", [](std::string s) { return stdext::ucwords(s); });
// Platform
g_lua.registerSingletonClass("g_platform");
g_lua.bindSingletonFunction("g_platform", "spawnProcess", &Platform::spawnProcess, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getProcessId", &Platform::getProcessId, &g_platform);
g_lua.bindSingletonFunction("g_platform", "copyFile", &Platform::copyFile, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getTempPath", &Platform::getTempPath, &g_platform);
g_lua.bindSingletonFunction("g_platform", "openUrl", &Platform::openUrl, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getCPUName", &Platform::getCPUName, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getTotalSystemMemory", &Platform::getTotalSystemMemory, &g_platform);
g_lua.bindSingletonFunction("g_platform", "getOSName", &Platform::getOSName, &g_platform);
// Application
g_lua.registerSingletonClass("g_app");
g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, static_cast<Application*>(&g_app));
@@ -85,6 +97,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildArch", &Application::getBuildArch, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getOs", &Application::getOs, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getStartupOptions", &Application::getStartupOptions, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, static_cast<Application*>(&g_app));
// Crypt
@@ -160,6 +173,7 @@ void Application::registerLuaFunctions()
g_lua.bindSingletonFunction("g_resources", "getWorkDir", &ResourceManager::getWorkDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "getSearchPaths", &ResourceManager::getSearchPaths, &g_resources);
g_lua.bindSingletonFunction("g_resources", "listDirectoryFiles", &ResourceManager::listDirectoryFiles, &g_resources);
g_lua.bindSingletonFunction("g_resources", "readFileContents", &ResourceManager::readFileContents, &g_resources);
// Module
g_lua.registerClass<Module>();
@@ -212,6 +226,7 @@ void Application::registerLuaFunctions()
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", "poll", &PlatformWindow::poll, &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);
@@ -261,6 +276,8 @@ void Application::registerLuaFunctions()
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", "shouldUseShaders", &Graphics::shouldUseShaders, &g_graphics);
g_lua.bindSingletonFunction("g_graphics", "setShouldUseShaders", &Graphics::setShouldUseShaders, &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);
@@ -607,6 +624,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIGridLayout>("getNumColumns", &UIGridLayout::getNumColumns);
g_lua.bindClassMemberFunction<UIGridLayout>("getNumLines", &UIGridLayout::getNumLines);
g_lua.bindClassMemberFunction<UIGridLayout>("getCellSize", &UIGridLayout::getCellSize);
g_lua.bindClassMemberFunction<UIGridLayout>("getCellSpacing", &UIGridLayout::getCellSpacing);
g_lua.bindClassMemberFunction<UIGridLayout>("isUIGridLayout", &UIGridLayout::isUIGridLayout);
// UIAnchorLayout
@@ -756,8 +774,10 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<DBResult>("getDataInt", &DBResult::getDataInt);
g_lua.bindClassMemberFunction<DBResult>("getDataLong", &DBResult::getDataLong);
g_lua.bindClassMemberFunction<DBResult>("getDataString", &DBResult::getDataString);
g_lua.bindClassMemberFunction<DBResult>("getRowCount", &DBResult::getRowCount);
g_lua.bindClassMemberFunction<DBResult>("next", &DBResult::next);
// Mysql
g_lua.registerClass<DatabaseMySQL, Database>();
g_lua.bindClassStaticFunction<DatabaseMySQL>("create", []{ return DatabaseMySQLPtr(new DatabaseMySQL); });

View File

@@ -57,4 +57,9 @@ float random_range(float min, float max)
return min + (max - min)*dis(gen);
}
double round(double r)
{
return (r > 0.0) ? floor(r + 0.5) : ceil(r - 0.5);
}
}

View File

@@ -43,6 +43,8 @@ uint32_t adler32(const uint8_t *buffer, size_t size);
long random_range(long min, long max);
float random_range(float min, float max);
double round(double r);
}
#endif