Rework application class and framework

Make otclient's framework flexible enough to run console apps like
servers, so this mean is possible to build otclient versions without
graphical interface and use it's framework to code servers
This commit is contained in:
Eduardo Bart 2012-07-13 22:10:24 -03:00
parent 099716fe03
commit e3298d561c
131 changed files with 1228 additions and 1016 deletions

View File

@ -1,46 +1,49 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(otclient)
cmake_minimum_required(VERSION 2.6)
project(otclient)
ADD_DEFINITIONS(-DFW_WINDOW)
INCLUDE(src/framework/CMakeLists.txt)
INCLUDE(src/otclient/CMakeLists.txt)
set(FRAMEWORK_SOUND ON)
set(FRAMEWORK_GRAPHICS ON)
set(FRAMEWORK_XML ON)
set(FRAMEWORK_NET ON)
include(src/framework/CMakeLists.txt)
include(src/otclient/CMakeLists.txt)
# functions map for reading backtraces
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-Map=otclient.map")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,-Map=otclient.map")
OPTION(USE_PCH "Use precompiled header (speed up compile)" OFF)
option(USE_PCH "Use precompiled header (speed up compile)" OFF)
SET(executable_SOURCES
set(executable_SOURCES
src/main.cpp
)
# add executable icon for win32 platforms
IF(WIN32)
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
if(WIN32)
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o
COMMAND ${CMAKE_RC_COMPILER}
-I${CMAKE_CURRENT_SOURCE_DIR}/src
-i${CMAKE_CURRENT_SOURCE_DIR}/src/otcicon.rc
-o ${CMAKE_CURRENT_BINARY_DIR}/otcicon.o)
SET(executable_SOURCES ${executable_SOURCES} otcicon.o)
ENDIF(WIN32)
endif(WIN32)
# add otclient executable
ADD_EXECUTABLE(otclient ${framework_SOURCES} ${otclient_SOURCES} ${executable_SOURCES})
add_executable(otclient ${framework_SOURCES} ${otclient_SOURCES} ${executable_SOURCES})
# target link libraries
TARGET_LINK_LIBRARIES(otclient ${framework_LIBRARIES})
target_link_libraries(otclient ${framework_LIBRARIES})
IF(USE_PCH)
if(USE_PCH)
include(cotire)
cotire(otclient)
MESSAGE(STATUS "Use precompiled header: ON")
ELSE()
MESSAGE(STATUS "Use precompiled header: OFF")
ENDIF()
message(STATUS "Use precompiled header: ON")
else()
message(STATUS "Use precompiled header: OFF")
endif()
# installation
SET(DATA_INSTALL_DIR share/otclient)
INSTALL(TARGETS otclient RUNTIME DESTINATION bin)
INSTALL(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR}
set(DATA_INSTALL_DIR share/otclient)
install(TARGETS otclient RUNTIME DESTINATION bin)
install(FILES README.md BUGS LICENSE AUTHORS init.lua DESTINATION ${DATA_INSTALL_DIR})
install(DIRECTORY modules DESTINATION ${DATA_INSTALL_DIR}
PATTERN ".git" EXCLUDE)

View File

@ -1,7 +1,6 @@
BugReportWindow < MainWindow
!text: tr('Report Bug')
size: 280 250
&onEnter: BugReport.doReport
@onEscape: self:hide()
Label

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

View File

@ -1,173 +1,54 @@
# framework flags
# FRAMEWORK_SOUND
# FRAMEWORK_GRAPHICS
# FRAMEWORK_NET
# FRAMEWORK_XML
# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatiblity
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
GET_FILENAME_COMPONENT(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
# add framework cmake modules
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
ADD_DEFINITIONS(-DFRAMEWORK)
OPTION(CRASH_HANDLER "Generate crash reports" ON)
OPTION(LUAJIT "Use lua jit" OFF)
OPTION(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
SET(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING)
SET(BUILD_COMMIT "custom" CACHE "Git commit string (intended for releases)" STRING)
SET(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "RelWithDebInfo")
ENDIF()
##IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
## SET(ARCH_FLAGS "-m64 -march=x86-64 -mtune=generic")
##ELSE()
## SET(ARCH_FLAGS "-m32 -march=i686 -mtune=generic")
##ENDIF()
SET(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=gnu++0x -pipe")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -ggdb -fno-omit-frame-pointer")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_PERFORMANCE "-Ofast -mmxx -msee -msee2")
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
IF(USE_STATIC_LIBS)
SET(CMAKE_CXX_LINK_FLAGS "-static-libgcc -static-libstdc++")
MESSAGE(STATUS "Link to static libraries: ON")
ELSE()
MESSAGE(STATUS "Link to static libraries: OFF")
ENDIF()
MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
ADD_DEFINITIONS(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"")
MESSAGE(STATUS "Build commit: ${BUILD_COMMIT}")
ADD_DEFINITIONS(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"")
MESSAGE(STATUS "Build revision: ${BUILD_REVISION}")
ADD_DEFINITIONS(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
# find needed libraries
IF(WIN32)
SET(Boost_THREADAPI win32)
ENDIF()
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_LIBS ON)
FIND_PACKAGE(Boost COMPONENTS system REQUIRED)
IF(OPENGLES STREQUAL "2.0")
FIND_PACKAGE(OpenGLES2 REQUIRED)
FIND_PACKAGE(EGL REQUIRED)
ADD_DEFINITIONS(-DOPENGL_ES=2)
SET(OPENGL_INCLUDE_DIR ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
SET(OPENGL_LIBRARIES ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
ELSEIF(OPENGLES STREQUAL "1.0")
FIND_PACKAGE(OpenGLES1 REQUIRED)
FIND_PACKAGE(EGL REQUIRED)
ADD_DEFINITIONS(-DOPENGL_ES=1)
SET(OPENGL_INCLUDE_DIR ${EGL_INCLUDE_DIR} ${OPENGLES1_INCLUDE_DIR})
SET(OPENGL_LIBRARIES ${EGL_LIBRARY} ${OPENGLES1_LIBRARY})
ELSE()
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
SET(OPENGL_LIBRARIES ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
ENDIF()
MESSAGE(STATUS "OpenGL ES: " ${OPENGLES})
IF(LUAJIT)
FIND_PACKAGE(LuaJIT REQUIRED)
SET(LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR})
SET(LUA_LIBRARY ${LUAJIT_LIBRARY})
ELSE()
FIND_PACKAGE(Lua REQUIRED)
ENDIF()
MESSAGE(STATUS "LuaJIT: " ${LUAJIT})
FIND_PACKAGE(PhysFS REQUIRED)
FIND_PACKAGE(GMP REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)
FIND_PACKAGE(OpenAL REQUIRED)
FIND_PACKAGE(VorbisFile REQUIRED)
FIND_PACKAGE(Vorbis REQUIRED)
FIND_PACKAGE(Ogg REQUIRED)
IF(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
MESSAGE(STATUS "Debug information: ON")
ADD_DEFINITIONS(-DDEBUG)
ELSE()
MESSAGE(STATUS "Debug information: OFF")
# NDEBUG disable asserts
ADD_DEFINITIONS(-DNDEBUG)
# strip all debug information
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed -Wl,-s")
ENDIF()
IF(CRASH_HANDLER)
ADD_DEFINITIONS(-DCRASH_HANDLER)
MESSAGE(STATUS "Crash handler: ON")
ELSE()
MESSAGE(STATUS "Crash handler: OFF")
ENDIF()
IF(WIN32)
OPTION(WINDOWS_CONSOLE "Enables console window on Windows platform" OFF)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
SET(ADDITIONAL_LIBRARIES ws2_32 mswsock imagehlp winmm)
# fix boost thread linkage
ADD_DEFINITIONS(-DBOOST_THREAD_USE_LIB)
IF(WINDOWS_CONSOLE)
MESSAGE(STATUS "Windows console: ON")
ELSE()
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
MESSAGE(STATUS "Windows console: OFF")
ENDIF()
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
SET(ADDITIONAL_LIBRARIES X11 dl rt)
ENDIF()
INCLUDE_DIRECTORIES(
${Boost_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${OPENAL_INCLUDE_DIR} ${VORBISFILE_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${GMP_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
"${CMAKE_CURRENT_LIST_DIR}/.."
)
SET(framework_LIBRARIES
${Boost_LIBRARIES}
${LUA_LIBRARY}
${PHYSFS_LIBRARY}
${GMP_LIBRARY}
${ZLIB_LIBRARY}
${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY}
${OPENGL_LIBRARIES}
${OPENAL_LIBRARY}
${ADDITIONAL_LIBRARIES}
)
SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/application.cpp
${CMAKE_CURRENT_LIST_DIR}/application.h
set(framework_LIBRARIES "")
set(framework_DEFINITIONS "")
set(framework_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/..")
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/const.h
${CMAKE_CURRENT_LIST_DIR}/global.h
${CMAKE_CURRENT_LIST_DIR}/pch.h
${CMAKE_CURRENT_LIST_DIR}/luafunctions.cpp
${CMAKE_CURRENT_LIST_DIR}/util/boolean.h
${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
${CMAKE_CURRENT_LIST_DIR}/util/color.h
${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
${CMAKE_CURRENT_LIST_DIR}/util/crypt.h
${CMAKE_CURRENT_LIST_DIR}/util/databuffer.h
${CMAKE_CURRENT_LIST_DIR}/util/matrix.h
${CMAKE_CURRENT_LIST_DIR}/util/point.h
${CMAKE_CURRENT_LIST_DIR}/util/rect.h
${CMAKE_CURRENT_LIST_DIR}/util/rsa.cpp
${CMAKE_CURRENT_LIST_DIR}/util/rsa.h
${CMAKE_CURRENT_LIST_DIR}/util/size.h
# stdext
${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
${CMAKE_CURRENT_LIST_DIR}/stdext/compiler.h
${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.h
${CMAKE_CURRENT_LIST_DIR}/stdext/dumper.h
${CMAKE_CURRENT_LIST_DIR}/stdext/exception.h
${CMAKE_CURRENT_LIST_DIR}/stdext/math.h
${CMAKE_CURRENT_LIST_DIR}/stdext/stdext.h
${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
${CMAKE_CURRENT_LIST_DIR}/stdext/types.h
# core
${CMAKE_CURRENT_LIST_DIR}/core/application.cpp
${CMAKE_CURRENT_LIST_DIR}/core/application.h
${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.cpp
${CMAKE_CURRENT_LIST_DIR}/core/adaptativeframecounter.h
${CMAKE_CURRENT_LIST_DIR}/core/binarytree.cpp
@ -197,84 +78,19 @@ SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
${CMAKE_CURRENT_LIST_DIR}/core/timer.h
# graphics
${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.h
${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.h
${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/declarations.h
${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.h
${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/glutil.h
${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.h
${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/image.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/image.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painter.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painter.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2_shadersources.h
${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particle.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particle.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.h
${CMAKE_CURRENT_LIST_DIR}/graphics/shader.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/shader.h
${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.h
${CMAKE_CURRENT_LIST_DIR}/graphics/texture.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/texture.h
${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/vertexarray.h
# luascript
${CMAKE_CURRENT_LIST_DIR}/luascript/declarations.h
${CMAKE_CURRENT_LIST_DIR}/luascript/luabinder.h
${CMAKE_CURRENT_LIST_DIR}/luascript/luaexception.cpp
${CMAKE_CURRENT_LIST_DIR}/luascript/luaexception.h
${CMAKE_CURRENT_LIST_DIR}/luascript/luainterface.cpp
${CMAKE_CURRENT_LIST_DIR}/luascript/luainterface.h
${CMAKE_CURRENT_LIST_DIR}/luascript/luaobject.cpp
${CMAKE_CURRENT_LIST_DIR}/luascript/luaobject.h
${CMAKE_CURRENT_LIST_DIR}/luascript/luavaluecasts.cpp
${CMAKE_CURRENT_LIST_DIR}/luascript/luavaluecasts.h
# net
${CMAKE_CURRENT_LIST_DIR}/net/connection.cpp
${CMAKE_CURRENT_LIST_DIR}/net/connection.h
${CMAKE_CURRENT_LIST_DIR}/net/declarations.h
${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.cpp
${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.h
${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.cpp
${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.h
${CMAKE_CURRENT_LIST_DIR}/net/protocol.cpp
${CMAKE_CURRENT_LIST_DIR}/net/protocol.h
${CMAKE_CURRENT_LIST_DIR}/net/server.cpp
${CMAKE_CURRENT_LIST_DIR}/net/server.h
# luaengine
${CMAKE_CURRENT_LIST_DIR}/luaengine/declarations.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/luabinder.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.cpp
${CMAKE_CURRENT_LIST_DIR}/luaengine/luaexception.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.cpp
${CMAKE_CURRENT_LIST_DIR}/luaengine/luainterface.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.cpp
${CMAKE_CURRENT_LIST_DIR}/luaengine/luaobject.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.cpp
${CMAKE_CURRENT_LIST_DIR}/luaengine/luavaluecasts.h
${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.cpp
${CMAKE_CURRENT_LIST_DIR}/luaengine/lbitlib.h
# otml
${CMAKE_CURRENT_LIST_DIR}/otml/declarations.h
@ -290,100 +106,322 @@ SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h
# platform
# crash handler
${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.h
${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.h
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.h
# sound
${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.h
${CMAKE_CURRENT_LIST_DIR}/sound/declarations.h
${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.h
${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.h
# stdext
${CMAKE_CURRENT_LIST_DIR}/stdext/cast.h
${CMAKE_CURRENT_LIST_DIR}/stdext/compiler.h
${CMAKE_CURRENT_LIST_DIR}/stdext/demangle.h
${CMAKE_CURRENT_LIST_DIR}/stdext/dumper.h
${CMAKE_CURRENT_LIST_DIR}/stdext/exception.h
${CMAKE_CURRENT_LIST_DIR}/stdext/math.h
${CMAKE_CURRENT_LIST_DIR}/stdext/stdext.h
${CMAKE_CURRENT_LIST_DIR}/stdext/string.h
${CMAKE_CURRENT_LIST_DIR}/stdext/time.h
${CMAKE_CURRENT_LIST_DIR}/stdext/types.h
# third party
${CMAKE_CURRENT_LIST_DIR}/thirdparty/apngloader.cpp
${CMAKE_CURRENT_LIST_DIR}/thirdparty/apngloader.h
${CMAKE_CURRENT_LIST_DIR}/thirdparty/lbitlib-5.2.0-backport4.cpp
${CMAKE_CURRENT_LIST_DIR}/thirdparty/lbitlib-5.2.0-backport4.h
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinyxml.cpp
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinyxml.h
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinystr.cpp
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinystr.h
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinyxmlerror.cpp
${CMAKE_CURRENT_LIST_DIR}/thirdparty/tinyxmlparser.cpp
# ui
${CMAKE_CURRENT_LIST_DIR}/ui/declarations.h
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/ui.h
${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.h
${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.h
${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.h
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetbasestyle.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetimage.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgettext.cpp
# util
${CMAKE_CURRENT_LIST_DIR}/util/boolean.h
${CMAKE_CURRENT_LIST_DIR}/util/color.cpp
${CMAKE_CURRENT_LIST_DIR}/util/color.h
${CMAKE_CURRENT_LIST_DIR}/util/crypt.cpp
${CMAKE_CURRENT_LIST_DIR}/util/crypt.h
${CMAKE_CURRENT_LIST_DIR}/util/databuffer.h
${CMAKE_CURRENT_LIST_DIR}/util/matrix.h
${CMAKE_CURRENT_LIST_DIR}/util/point.h
${CMAKE_CURRENT_LIST_DIR}/util/rect.h
${CMAKE_CURRENT_LIST_DIR}/util/rsa.cpp
${CMAKE_CURRENT_LIST_DIR}/util/rsa.h
${CMAKE_CURRENT_LIST_DIR}/util/size.h
)
# some build options
option(CRASH_HANDLER "Generate crash reports" ON)
option(LUAJIT "Use lua jit" OFF)
option(USE_STATIC_LIBS "Don't use shared libraries (dlls)" ON)
set(BUILD_COMMIT "custom" CACHE "Git commit string (intended for releases)" STRING)
set(BUILD_REVISION "0" CACHE "Git revision string (intended for releases)" STRING)
# default build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
# gcc compile flags
set(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} -std=gnu++0x -pipe")
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O1 -ggdb -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_PERFORMANCE "-Ofast -mmxx -msee -msee2")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os")
# process options
if(USE_STATIC_LIBS)
set(CMAKE_CXX_LINK_FLAGS "-static-libgcc -static-libstdc++")
message(STATUS "Link to static libraries: ON")
else()
message(STATUS "Link to static libraries: OFF")
endif()
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
add_definitions(-D"BUILD_TYPE=\\\"${CMAKE_BUILD_TYPE}\\\"")
message(STATUS "Build commit: ${BUILD_COMMIT}")
add_definitions(-D"BUILD_COMMIT=\\\"${BUILD_COMMIT}\\\"")
message(STATUS "Build revision: ${BUILD_REVISION}")
add_definitions(-D"BUILD_REVISION=\\\"${BUILD_REVISION}\\\"")
# find boost
if(WIN32)
set(Boost_THREADAPI win32)
endif()
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost COMPONENTS system REQUIRED)
#find lua
if(LUAJIT)
find_package(LuaJIT REQUIRED)
set(LUA_INCLUDE_DIR ${LUAJIT_INCLUDE_DIR})
set(LUA_LIBRARY ${LUAJIT_LIBRARY})
else()
find_package(Lua REQUIRED)
endif()
message(STATUS "LuaJIT: " ${LUAJIT})
find_package(PhysFS REQUIRED)
find_package(GMP REQUIRED)
find_package(ZLIB REQUIRED)
set(framework_LIBRARIES ${framework_LIBRARIES}
${Boost_LIBRARIES}
${LUA_LIBRARY}
${PHYSFS_LIBRARY}
${GMP_LIBRARY}
${ZLIB_LIBRARY}
)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${LUA_INCLUDE_DIR}
${PHYSFS_INCLUDE_DIR}
${GMP_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
)
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
message(STATUS "Debug information: ON")
add_definitions(-DDEBUG)
else()
message(STATUS "Debug information: OFF")
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DNDEBUG) # NDEBUG disable asserts
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -Wl,--as-needed -Wl,-s") # strip all debug information
endif()
if(CRASH_HANDLER)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DCRASH_HANDLER)
message(STATUS "Crash handler: ON")
if(WIN32)
set(framework_LIBRARIES ${framework_LIBRARIES} imagehlp)
endif()
else()
message(STATUS "Crash handler: OFF")
endif()
if(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mthreads")
set(framework_DEFINITIONS ${framework_DEFINITIONS} -D_WIN32_WINNT=0x0501)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DBOOST_THREAD_USE_LIB) # fix boost thread linkage
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -rdynamic")
set(framework_LIBRARIES ${framework_LIBRARIES} dl)
endif()
if(FRAMEWORK_GRAPHICS)
set(OPENGLES "OFF" CACHE "Use OpenGL ES 1.0 or 2.0 (for mobiles devices)" STRING)
if(OPENGLES STREQUAL "2.0")
find_package(OpenGLES2 REQUIRED)
find_package(EGL REQUIRED)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=2)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES2_INCLUDE_DIR})
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES2_LIBRARY})
ELSEif(OPENGLES STREQUAL "1.0")
find_package(OpenGLES1 REQUIRED)
find_package(EGL REQUIRED)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DOPENGL_ES=1)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${EGL_INCLUDE_DIR} ${OPENGLES1_INCLUDE_DIR})
set(framework_LIBRARIES ${framework_LIBRARIES} ${EGL_LIBRARY} ${OPENGLES1_LIBRARY})
else()
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
set(framework_LIBRARIES ${framework_LIBRARIES} ${GLEW_LIBRARY} ${OPENGL_LIBRARIES})
endif()
message(STATUS "OpenGL ES: " ${OPENGLES})
if(WIN32)
option(WINDOWS_CONSOLE "Enables console window on Windows platform" OFF)
if(WINDOWS_CONSOLE)
message(STATUS "Windows console: ON")
else()
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
message(STATUS "Windows console: OFF")
endif()
else()
set(framework_LIBRARIES ${framework_LIBRARIES} X11)
endif()
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/animatedtexture.h
${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/cachedtext.h
${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/coordsbuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/declarations.h
${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/bitmapfont.h
${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/fontmanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/framebuffermanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/glutil.h
${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/graphics.h
${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/hardwarebuffer.h
${CMAKE_CURRENT_LIST_DIR}/graphics/image.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/image.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painter.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painter.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl1.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2.h
${CMAKE_CURRENT_LIST_DIR}/graphics/painterogl2_shadersources.h
${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/paintershaderprogram.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleaffector.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particle.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleemitter.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particleeffect.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particle.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particlemanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/particlesystem.h
${CMAKE_CURRENT_LIST_DIR}/graphics/shader.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/shader.h
${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/shaderprogram.h
${CMAKE_CURRENT_LIST_DIR}/graphics/texture.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/texture.h
${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/texturemanager.h
${CMAKE_CURRENT_LIST_DIR}/graphics/vertexarray.h
${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.h
# ui
${CMAKE_CURRENT_LIST_DIR}/ui/declarations.h
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uianchorlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiboxlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uigridlayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/ui.h
${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uihorizontallayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uilayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.h
${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.h
${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.h
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiverticallayout.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetbasestyle.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidget.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgetimage.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiwidgettext.cpp
# platform window
${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/platformwindow.h
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/win32window.h
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/x11window.h
${CMAKE_CURRENT_LIST_DIR}/core/graphicalapplication.cpp
${CMAKE_CURRENT_LIST_DIR}/core/graphicalapplication.h
)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_GRAPHICS)
else()
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/consoleapplication.cpp
${CMAKE_CURRENT_LIST_DIR}/core/consoleapplication.h
)
endif()
if(FRAMEWORK_SOUND)
find_package(OpenAL REQUIRED)
find_package(VorbisFile REQUIRED)
find_package(Vorbis REQUIRED)
find_package(Ogg REQUIRED)
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR} ${VORBISFILE_INCLUDE_DIR})
set(framework_LIBRARIES ${framework_LIBRARIES} ${OPENAL_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBIS_LIBRARY} ${OGG_LIBRARY})
if(WIN32)
set(framework_LIBRARIES ${framework_LIBRARIES} winmm)
else()
set(framework_LIBRARIES ${framework_LIBRARIES} rt)
endif()
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/combinedsoundsource.h
${CMAKE_CURRENT_LIST_DIR}/sound/declarations.h
${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/oggsoundfile.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundbuffer.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundfile.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundmanager.h
${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/soundsource.h
${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.cpp
${CMAKE_CURRENT_LIST_DIR}/sound/streamsoundsource.h
)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_SOUND)
endif()
if(FRAMEWORK_NET)
if(WIN32)
set(framework_LIBRARIES ${framework_LIBRARIES} ws2_32 mswsock)
endif()
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/net/connection.cpp
${CMAKE_CURRENT_LIST_DIR}/net/connection.h
${CMAKE_CURRENT_LIST_DIR}/net/declarations.h
${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.cpp
${CMAKE_CURRENT_LIST_DIR}/net/inputmessage.h
${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.cpp
${CMAKE_CURRENT_LIST_DIR}/net/outputmessage.h
${CMAKE_CURRENT_LIST_DIR}/net/protocol.cpp
${CMAKE_CURRENT_LIST_DIR}/net/protocol.h
${CMAKE_CURRENT_LIST_DIR}/net/server.cpp
${CMAKE_CURRENT_LIST_DIR}/net/server.h
)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_NET)
endif()
if(FRAMEWORK_XML)
set(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/xml/tinyxml.cpp
${CMAKE_CURRENT_LIST_DIR}/xml/tinyxml.h
${CMAKE_CURRENT_LIST_DIR}/xml/tinystr.cpp
${CMAKE_CURRENT_LIST_DIR}/xml/tinystr.h
${CMAKE_CURRENT_LIST_DIR}/xml/tinyxmlerror.cpp
${CMAKE_CURRENT_LIST_DIR}/xml/tinyxmlparser.cpp
)
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DFW_XML)
endif()
include_directories(${framework_INCLUDE_DIRS})
add_definitions(${framework_DEFINITIONS})

View File

@ -0,0 +1,143 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/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 "application.h"
#include <framework/core/clock.h>
#include <framework/core/resourcemanager.h>
#include <framework/core/modulemanager.h>
#include <framework/core/eventdispatcher.h>
#include <framework/core/configmanager.h>
#include <framework/luaengine/luainterface.h>
#include <framework/platform/crashhandler.h>
#ifdef FW_NET
#include <framework/net/connection.h>
#endif
void exitSignalHandler(int sig)
{
static bool signaled = false;
switch(sig) {
case SIGTERM:
case SIGINT:
if(!signaled) {
signaled = true;
g_dispatcher.addEvent(std::bind(&Application::close, &g_app));
}
break;
}
}
Application::Application()
{
m_appName = "application";
m_appCompactName = "app";
m_appVersion = "none";
m_stopping = false;
}
void Application::init(const std::vector<std::string>& args)
{
// capture exit signals
signal(SIGTERM, exitSignalHandler);
signal(SIGINT, exitSignalHandler);
#ifdef CRASH_HANDLER
installCrashHandler();
#endif
std::string startupOptions;
for(uint i=1;i<args.size();++i) {
const std::string& arg = args[i];
startupOptions += " ";
startupOptions += arg;
}
if(startupOptions.length() > 0)
g_logger.info(stdext::format("Startup options: %s", startupOptions));
m_startupOptions = startupOptions;
// initialize resources
g_resources.init(args[0].c_str());
// initialize lua
g_lua.init();
registerLuaFunctions();
}
void Application::deinit()
{
g_lua.callGlobalField("g_app", "onTerminate");
// run modules unload events
g_modules.unloadModules();
g_modules.clear();
// release remaining lua object references
g_lua.collectGarbage();
// poll remaining events
poll();
}
void Application::terminate()
{
#ifdef FW_NET
// terminate network
Connection::terminate();
#endif
// save configurations
g_configs.save();
// release resources
g_resources.terminate();
// terminate script environment
g_lua.terminate();
// flush remaining dispatcher events
g_dispatcher.flush();
m_terminated = true;
}
void Application::poll()
{
#ifdef FW_NET
Connection::poll();
#endif
g_dispatcher.poll();
}
void Application::exit()
{
g_logger.info("Exiting application..");
m_stopping = true;
}
void Application::close()
{
if(!g_lua.callGlobalField<bool>("g_app", "onClose"))
exit();
}

View File

@ -23,49 +23,35 @@
#ifndef APPLICATION_H
#define APPLICATION_H
#include <framework/core/inputevent.h>
#include <framework/global.h>
#include <framework/core/adaptativeframecounter.h>
#include <framework/graphics/declarations.h>
//@bindsingleton g_app
class Application
{
enum {
POLL_CYCLE_DELAY = 10
};
public:
Application();
virtual ~Application() {}
void init(const std::string& compactName, const std::vector<std::string>& args);
void deinit();
void terminate();
void run();
void exit();
void poll();
void close();
virtual void init(const std::vector<std::string>& args);
virtual void deinit();
virtual void terminate();
virtual void run() = 0;
virtual void poll();
virtual void exit();
virtual void close();
bool willRepaint() { return m_mustRepaint; }
void repaint() { m_mustRepaint = true; }
void setForegroundPaneMaxFps(int maxFps) { m_foregroundFrameCounter.setMaxFps(maxFps); }
void setBackgroundPaneMaxFps(int maxFps) { m_backgroundFrameCounter.setMaxFps(maxFps); }
void setName(const std::string& name) { m_appName = name; }
void setCompactName(const std::string& compactName) { m_appCompactName = compactName; }
void setVersion(const std::string& version) { m_appVersion = version; }
bool isRunning() { return m_running; }
bool isStopping() { return m_stopping; }
bool isTermianted() { return m_terminated; }
bool isOnInputEvent() { return m_onInputEvent; }
bool isTerminated() { return m_terminated; }
const std::string& getName() { return m_appName; }
const std::string& getCompactName() { return m_appCompactName; }
const std::string& getVersion() { return m_appVersion; }
int getForegroundPaneFps() { return m_foregroundFrameCounter.getLastFps(); }
int getBackgroundPaneFps() { return m_backgroundFrameCounter.getLastFps(); }
int getForegroundPaneMaxFps() { return m_foregroundFrameCounter.getMaxFps(); }
int getBackgroundPaneMaxFps() { return m_backgroundFrameCounter.getMaxFps(); }
std::string getBuildCompiler() { return BUILD_COMPILER; }
std::string getBuildDate() { return BUILD_DATE; }
std::string getBuildRevision() { return BUILD_REVISION; }
@ -74,26 +60,21 @@ public:
std::string getStartupOptions() { return m_startupOptions; }
protected:
void resize(const Size& size);
void inputEvent(const InputEvent& event);
void registerLuaFunctions();
std::string m_appName;
std::string m_appCompactName;
std::string m_appVersion;
std::string m_startupOptions;
Boolean<false> m_initialized;
Boolean<false> m_running;
Boolean<false> m_stopping;
Boolean<false> m_terminated;
Boolean<false> m_onInputEvent;
Boolean<false> m_mustRepaint;
AdaptativeFrameCounter m_backgroundFrameCounter;
AdaptativeFrameCounter m_foregroundFrameCounter;
TexturePtr m_foreground;
};
extern Application g_app;
#ifdef FW_GRAPHICS
#include "graphicalapplication.h"
#else
#include "consoleapplication.h"
#endif
#endif

View File

@ -20,20 +20,41 @@
* THE SOFTWARE.
*/
#ifndef OTCLIENT_UI_DECLARATIONS_H
#define OTCLIENT_UI_DECLARATIONS_H
#include <otclient/global.h>
#include <framework/ui/declarations.h>
class UIItem;
class UICreature;
class UIMap;
class UIProgressRect;
typedef std::shared_ptr<UIItem> UIItemPtr;
typedef std::shared_ptr<UICreature> UICreaturePtr;
typedef std::shared_ptr<UIMap> UIMapPtr;
typedef std::shared_ptr<UIProgressRect> UIProgressRectPtr;
#include "consoleapplication.h"
#include <framework/core/clock.h>
#include <framework/luaengine/luainterface.h>
#ifdef FW_NET
#include <framework/net/connection.h>
#endif
ConsoleApplication g_app;
void ConsoleApplication::run()
{
m_running = true;
// run the first poll
poll();
// first clock update
g_clock.update();
g_lua.callGlobalField("g_app", "onRun");
while(!m_stopping) {
poll();
#ifdef FW_NET
Connection::poll();
#endif
stdext::millisleep(1);
g_clock.update();
m_frameCounter.update();
}
m_stopping = false;
m_running = false;
}

View File

@ -20,17 +20,23 @@
* THE SOFTWARE.
*/
#ifndef OTCLIENT_NET_DECLARATIONS_H
#define OTCLIENT_NET_DECLARATIONS_H
#include <otclient/global.h>
#include <framework/net/declarations.h>
#include "protocolcodes.h"
#ifndef CONSOLEAPPLICATION_H
#define CONSOLEAPPLICATION_H
class ProtocolLogin;
class ProtocolGame;
#include "application.h"
typedef std::shared_ptr<ProtocolGame> ProtocolGamePtr;
typedef std::shared_ptr<ProtocolLogin> ProtocolLoginPtr;
class ConsoleApplication : public Application
{
public:
void run();
int getFps() { return m_frameCounter.getLastFps(); }
protected:
AdaptativeFrameCounter m_frameCounter;
};
extern ConsoleApplication g_app;
#endif

View File

@ -23,7 +23,7 @@
#ifndef EVENT_H
#define EVENT_H
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class Event : public LuaObject

View File

@ -22,7 +22,7 @@
#include "filestream.h"
#include "binarytree.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <physfs.h>
@ -37,7 +37,7 @@ FileStream::FileStream(const std::string& name, PHYSFS_File *fileHandle, bool wr
FileStream::~FileStream()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
close();
}

View File

@ -24,7 +24,7 @@
#define FILESTREAM_H
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/util/databuffer.h>
struct PHYSFS_File;

View File

@ -20,174 +20,97 @@
* THE SOFTWARE.
*/
#include "application.h"
#include "graphicalapplication.h"
#include <framework/core/clock.h>
#include <framework/core/resourcemanager.h>
#include <framework/core/modulemanager.h>
#include <framework/core/eventdispatcher.h>
#include <framework/core/configmanager.h>
#include <framework/net/connection.h>
#include <framework/platform/platformwindow.h>
#include <framework/ui/uimanager.h>
#include <framework/ui/uiwidget.h>
#include <framework/graphics/graphics.h>
#include <framework/graphics/particlemanager.h>
#include <framework/graphics/painter.h>
#ifdef FW_SOUND
#include <framework/sound/soundmanager.h>
#include <framework/luascript/luainterface.h>
#include <framework/platform/crashhandler.h>
Application g_app;
void exitSignalHandler(int sig)
{
static bool signaled = false;
switch(sig) {
case SIGTERM:
case SIGINT:
if(!signaled) {
signaled = true;
g_dispatcher.addEvent(std::bind(&Application::close, &g_app));
}
break;
}
}
Application::Application()
{
m_appName = "application";
m_appCompactName = "app";
m_appVersion = "none";
m_foregroundFrameCounter.setMaxFps(60);
m_stopping = false;
}
void Application::init(const std::string& compactName, const std::vector<std::string>& args)
{
// capture exit signals
signal(SIGTERM, exitSignalHandler);
signal(SIGINT, exitSignalHandler);
#ifdef CRASH_HANDLER
installCrashHandler();
#endif
m_appCompactName = compactName;
GraphicalApplication g_app;
std::string startupOptions;
for(uint i=1;i<args.size();++i) {
const std::string& arg = args[i];
startupOptions += " ";
startupOptions += arg;
}
if(startupOptions.length() > 0)
g_logger.info(stdext::format("Startup options: %s", startupOptions));
m_startupOptions = startupOptions;
// initialize resources
g_resources.init(args[0].c_str());
// initialize lua
g_lua.init();
registerLuaFunctions();
// initialize ui
g_ui.init();
void GraphicalApplication::init(const std::vector<std::string>& args)
{
Application::init(args);
// setup platform window
g_window.init();
g_window.hide();
g_window.setOnResize(std::bind(&Application::resize, this, std::placeholders::_1));
g_window.setOnInputEvent(std::bind(&Application::inputEvent, this, std::placeholders::_1));
g_window.setOnClose(std::bind(&Application::close, this));
g_window.setOnResize(std::bind(&GraphicalApplication::resize, this, std::placeholders::_1));
g_window.setOnInputEvent(std::bind(&GraphicalApplication::inputEvent, this, std::placeholders::_1));
g_window.setOnClose(std::bind(&GraphicalApplication::close, this));
// initialize ui
g_ui.init();
// initialize graphics
g_graphics.init();
// initialize sound
g_sounds.init();
// fire first resize event
resize(g_window.getSize());
m_initialized = true;
#ifdef FW_SOUND
// initialize sound
g_sounds.init();
#endif
}
void Application::deinit()
void GraphicalApplication::deinit()
{
// hide the window because there is no render anymore
g_window.hide();
g_lua.callGlobalField("g_app", "onTerminate");
// run modules unload events
g_modules.unloadModules();
g_modules.clear();
// release remaining lua object references
g_lua.collectGarbage();
// poll remaining events
poll();
Application::deinit();
}
void Application::terminate()
void GraphicalApplication::terminate()
{
assert(m_initialized);
// destroy particles
g_particles.terminate();
// destroy any remaining widget
g_ui.terminate();
// terminate network
Connection::terminate();
#ifdef FW_SOUND
// terminate sound
g_sounds.terminate();
#endif
// save configurations
g_configs.save();
// release resources
g_resources.terminate();
// terminate script environment
g_lua.terminate();
// flush remaining dispatcher events
g_dispatcher.flush();
Application::terminate();
m_terminated = false;
// terminate graphics
m_foreground = nullptr;
g_graphics.terminate();
g_window.terminate();
g_logger.debug("Application ended successfully.");
m_terminated = true;
}
void Application::run()
void GraphicalApplication::run()
{
assert(m_initialized);
m_running = true;
// run the first poll
poll();
g_lua.callGlobalField("g_app", "onRun");
// first clock update
g_clock.update();
// run the first poll
poll();
g_clock.update();
g_lua.callGlobalField("g_app", "onRun");
// show the application only after we draw some frames
g_dispatcher.scheduleEvent([] { g_window.show(); }, 10);
while(!m_stopping) {
// poll all events before rendering
poll();
@ -269,33 +192,27 @@ void Application::run()
m_running = false;
}
void Application::exit()
{
g_logger.info("Exiting application..");
m_stopping = true;
}
void Application::poll()
void GraphicalApplication::poll()
{
#ifdef FW_SOUND
g_sounds.poll();
#endif
// poll input events
// poll window input events
g_window.poll();
//g_particles.update();
g_particles.update();
Connection::poll();
g_dispatcher.poll();
Application::poll();
}
void Application::close()
void GraphicalApplication::close()
{
m_onInputEvent = true;
if(!g_lua.callGlobalField<bool>("g_app", "onClose"))
exit();
Application::close();
m_onInputEvent = false;
}
void Application::resize(const Size& size)
void GraphicalApplication::resize(const Size& size)
{
m_onInputEvent = true;
g_graphics.resize(size);
@ -309,7 +226,7 @@ void Application::resize(const Size& size)
m_mustRepaint = true;
}
void Application::inputEvent(const InputEvent& event)
void GraphicalApplication::inputEvent(const InputEvent& event)
{
m_onInputEvent = true;
g_ui.inputEvent(event);

View File

@ -0,0 +1,72 @@
/*
* Copyright (c) 2010-2012 OTClient <https://github.com/edubart/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.
*/
#ifndef GRAPHICALAPPLICATION_H
#define GRAPHICALAPPLICATION_H
#include "application.h"
#include <framework/graphics/declarations.h>
#include <framework/core/inputevent.h>
class GraphicalApplication : public Application
{
enum {
POLL_CYCLE_DELAY = 10
};
public:
void init(const std::vector< std::string >& args);
void deinit();
void terminate();
void run();
void poll();
void close();
bool willRepaint() { return m_mustRepaint; }
void repaint() { m_mustRepaint = true; }
void setForegroundPaneMaxFps(int maxFps) { m_foregroundFrameCounter.setMaxFps(maxFps); }
void setBackgroundPaneMaxFps(int maxFps) { m_backgroundFrameCounter.setMaxFps(maxFps); }
int getForegroundPaneFps() { return m_foregroundFrameCounter.getLastFps(); }
int getBackgroundPaneFps() { return m_backgroundFrameCounter.getLastFps(); }
int getForegroundPaneMaxFps() { return m_foregroundFrameCounter.getMaxFps(); }
int getBackgroundPaneMaxFps() { return m_backgroundFrameCounter.getMaxFps(); }
bool isOnInputEvent() { return m_onInputEvent; }
protected:
void resize(const Size& size);
void inputEvent(const InputEvent& event);
private:
Boolean<false> m_onInputEvent;
Boolean<false> m_mustRepaint;
AdaptativeFrameCounter m_backgroundFrameCounter;
AdaptativeFrameCounter m_foregroundFrameCounter;
TexturePtr m_foreground;
};
extern GraphicalApplication g_app;
#endif

View File

@ -22,7 +22,10 @@
#include "logger.h"
#include "eventdispatcher.h"
#ifdef FW_GRAPHICS
#include <framework/platform/platformwindow.h>
#endif
Logger g_logger;
@ -61,7 +64,7 @@ void Logger::log(Fw::LogLevel level, const std::string& message)
}
if(level == Fw::LogFatal) {
#ifdef FW_WINDOW
#ifdef FW_GRAPHICS
g_window.displayFatalError(message);
#endif
ignoreLogs = true;

View File

@ -24,7 +24,7 @@
#include "modulemanager.h"
#include <framework/otml/otml.h>
#include <framework/luascript/luainterface.h>
#include <framework/luaengine/luainterface.h>
Module::Module(const std::string& name)
{

View File

@ -26,7 +26,7 @@
#include "declarations.h"
#include <framework/otml/declarations.h>
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class Module : public LuaObject

View File

@ -24,7 +24,7 @@
#include "resourcemanager.h"
#include <framework/otml/otml.h>
#include <framework/application.h>
#include <framework/core/application.h>
ModuleManager g_modules;

View File

@ -23,8 +23,8 @@
#include "resourcemanager.h"
#include "filestream.h"
#include <framework/application.h>
#include <framework/luascript/luainterface.h>
#include <framework/core/application.h>
#include <framework/luaengine/luainterface.h>
#include <physfs.h>

View File

@ -25,7 +25,7 @@
#include "texture.h"
#include <framework/platform/platformwindow.h>
#include <framework/application.h>
#include <framework/core/application.h>
uint FrameBuffer::boundFbo = 0;
@ -47,7 +47,7 @@ void FrameBuffer::internalCreate()
FrameBuffer::~FrameBuffer()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok() && m_fbo != 0)
glDeleteFramebuffers(1, &m_fbo);
}

View File

@ -23,7 +23,7 @@
#include "hardwarebuffer.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <framework/core/logger.h>
HardwareBuffer::HardwareBuffer(Type type)
@ -37,7 +37,7 @@ HardwareBuffer::HardwareBuffer(Type type)
HardwareBuffer::~HardwareBuffer()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteBuffers(1, &m_id);
}

View File

@ -24,7 +24,7 @@
#include "image.h"
#include <framework/core/resourcemanager.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/graphics/apngloader.h>
Image::Image(const Size& size, int bpp, uint8 *pixels)
{

View File

@ -25,7 +25,7 @@
#include "declarations.h"
#include "particlesystem.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/otml/otml.h>
class ParticleEffectType : public LuaObject

View File

@ -23,7 +23,7 @@
#include "shader.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <framework/core/resourcemanager.h>
Shader::Shader(Shader::ShaderType shaderType)
@ -44,7 +44,7 @@ Shader::Shader(Shader::ShaderType shaderType)
Shader::~Shader()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteShader(m_shaderId);
}

View File

@ -23,7 +23,7 @@
#include "shaderprogram.h"
#include "graphics.h"
#include <framework/application.h>
#include <framework/core/application.h>
uint ShaderProgram::m_currentProgram = 0;
@ -38,7 +38,7 @@ ShaderProgram::ShaderProgram()
ShaderProgram::~ShaderProgram()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
if(g_graphics.ok())
glDeleteProgram(m_programId);
}

View File

@ -24,7 +24,7 @@
#define SHADERPROGRAM_H
#include "shader.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class ShaderProgram : public LuaObject

View File

@ -25,7 +25,7 @@
#include "framebuffer.h"
#include "image.h"
#include <framework/application.h>
#include <framework/core/application.h>
Texture::Texture()
{
@ -79,7 +79,7 @@ Texture::Texture(const ImagePtr& image, bool buildMipmaps)
Texture::~Texture()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
// free texture from gl memory
if(g_graphics.ok() && m_id != 0)
glDeleteTextures(1, &m_id);

View File

@ -26,7 +26,7 @@
#include "image.h"
#include <framework/core/resourcemanager.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/graphics/apngloader.h>
TextureManager g_textures;

View File

@ -26,7 +26,7 @@
#include <framework/core/resourcemanager.h>
#include <lua.hpp>
#include <framework/thirdparty/lbitlib-5.2.0-backport4.h>
#include "lbitlib.h"
LuaInterface g_lua;

View File

@ -23,7 +23,7 @@
#include "luaobject.h"
#include "luainterface.h"
#include <framework/application.h>
#include <framework/core/application.h>
LuaObject::LuaObject() :
m_fieldsTableRef(-1),
@ -33,7 +33,7 @@ LuaObject::LuaObject() :
LuaObject::~LuaObject()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
releaseLuaFieldsTable();
if(m_metatableRef != -1) {

View File

@ -20,8 +20,8 @@
* THE SOFTWARE.
*/
#include "application.h"
#include <framework/luascript/luainterface.h>
#include <framework/core/application.h>
#include <framework/luaengine/luainterface.h>
#include <framework/graphics/fontmanager.h>
#include <framework/ui/ui.h>
#include <framework/net/protocol.h>
@ -50,15 +50,103 @@ void Application::registerLuaFunctions()
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<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "setCompactName", &Application::setCompactName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "setVersion", &Application::setVersion, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "isRunning", &Application::isRunning, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "isStopping", &Application::isStopping, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getName", &Application::getName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getCompactName", &Application::getCompactName, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getVersion", &Application::getVersion, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, static_cast<Application*>(&g_app));
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, static_cast<Application*>(&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", "addToSearchPath", &ResourceManager::addToSearchPath, &g_resources);
g_lua.bindSingletonFunction("g_resources", "setupWriteDir", &ResourceManager::setupWriteDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "removeFromSearchPath", &ResourceManager::removeFromSearchPath, &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);
// Module
g_lua.registerClass<Module>();
g_lua.bindClassMemberFunction<Module>("load", &Module::load);
g_lua.bindClassMemberFunction<Module>("unload", &Module::unload);
g_lua.bindClassMemberFunction<Module>("reload", &Module::reload);
g_lua.bindClassMemberFunction<Module>("canReload", &Module::canReload);
g_lua.bindClassMemberFunction<Module>("canUnload", &Module::canUnload);
g_lua.bindClassMemberFunction<Module>("isLoaded", &Module::isLoaded);
g_lua.bindClassMemberFunction<Module>("isReloadble", &Module::isReloadable);
g_lua.bindClassMemberFunction<Module>("getDescription", &Module::getDescription);
g_lua.bindClassMemberFunction<Module>("getName", &Module::getName);
g_lua.bindClassMemberFunction<Module>("getAuthor", &Module::getAuthor);
g_lua.bindClassMemberFunction<Module>("getWebsite", &Module::getWebsite);
g_lua.bindClassMemberFunction<Module>("getVersion", &Module::getVersion);
g_lua.bindClassMemberFunction<Module>("isAutoLoad", &Module::isAutoLoad);
g_lua.bindClassMemberFunction<Module>("getAutoLoadPriority", &Module::getAutoLoadPriority);
// Event
g_lua.registerClass<Event>();
g_lua.bindClassMemberFunction<Event>("cancel", &Event::cancel);
@ -75,6 +163,95 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
g_lua.bindClassMemberFunction<ScheduledEvent>("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);
// 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<UIWidget>();
g_lua.bindClassStaticFunction<UIWidget>("create", []{ return UIWidgetPtr(new UIWidget); });
@ -412,6 +589,24 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UITextEdit>("isShiftNavigation", &UITextEdit::isShiftNavigation);
g_lua.bindClassMemberFunction<UITextEdit>("isMultiline", &UITextEdit::isMultiline);
g_lua.registerClass<ShaderProgram>();
g_lua.registerClass<PainterShaderProgram>();
g_lua.bindClassMemberFunction<PainterShaderProgram>("addMultiTexture", &PainterShaderProgram::addMultiTexture);
// ParticleEffect
g_lua.registerClass<ParticleEffectType>();
g_lua.bindClassStaticFunction<ParticleEffectType>("create", []{ return ParticleEffectTypePtr(new ParticleEffectType); });
g_lua.bindClassMemberFunction<ParticleEffectType>("getName", &ParticleEffectType::getName);
g_lua.bindClassMemberFunction<ParticleEffectType>("getFile", &ParticleEffectType::getFile);
g_lua.bindClassMemberFunction<ParticleEffectType>("getDescription", &ParticleEffectType::getDescription);
// UIParticles
g_lua.registerClass<UIParticles, UIWidget>();
g_lua.bindClassStaticFunction<UIParticles>("create", []{ return UIParticlesPtr(new UIParticles); } );
g_lua.bindClassMemberFunction<UIParticles>("addEffect", &UIParticles::addEffect);
#endif
#ifdef FW_NET
// Protocol
g_lua.registerClass<Protocol>();
g_lua.bindClassStaticFunction<Protocol>("create", []{ return ProtocolPtr(new Protocol); });
@ -426,23 +621,6 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<Protocol>("enableXteaEncryption", &Protocol::enableXteaEncryption);
g_lua.bindClassMemberFunction<Protocol>("enableChecksum", &Protocol::enableChecksum);
// Module
g_lua.registerClass<Module>();
g_lua.bindClassMemberFunction<Module>("load", &Module::load);
g_lua.bindClassMemberFunction<Module>("unload", &Module::unload);
g_lua.bindClassMemberFunction<Module>("reload", &Module::reload);
g_lua.bindClassMemberFunction<Module>("canReload", &Module::canReload);
g_lua.bindClassMemberFunction<Module>("canUnload", &Module::canUnload);
g_lua.bindClassMemberFunction<Module>("isLoaded", &Module::isLoaded);
g_lua.bindClassMemberFunction<Module>("isReloadble", &Module::isReloadable);
g_lua.bindClassMemberFunction<Module>("getDescription", &Module::getDescription);
g_lua.bindClassMemberFunction<Module>("getName", &Module::getName);
g_lua.bindClassMemberFunction<Module>("getAuthor", &Module::getAuthor);
g_lua.bindClassMemberFunction<Module>("getWebsite", &Module::getWebsite);
g_lua.bindClassMemberFunction<Module>("getVersion", &Module::getVersion);
g_lua.bindClassMemberFunction<Module>("isAutoLoad", &Module::isAutoLoad);
g_lua.bindClassMemberFunction<Module>("getAutoLoadPriority", &Module::getAutoLoadPriority);
// InputMessage
g_lua.registerClass<InputMessage>();
g_lua.bindClassStaticFunction<InputMessage>("create", []{ return InputMessagePtr(new InputMessage); });
@ -476,146 +654,9 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<OutputMessage>("addPaddingBytes", &OutputMessage::addPaddingBytes);
g_lua.bindClassMemberFunction<OutputMessage>("encryptRSA", &OutputMessage::encryptRSA);
g_lua.bindClassMemberFunction<OutputMessage>("getMessageSize", &OutputMessage::getMessageSize);
#endif
g_lua.registerClass<ShaderProgram>();
g_lua.registerClass<PainterShaderProgram>();
g_lua.bindClassMemberFunction<PainterShaderProgram>("addMultiTexture", &PainterShaderProgram::addMultiTexture);
// Application
g_lua.registerSingletonClass("g_app");
g_lua.bindSingletonFunction("g_app", "setForegroundPaneMaxFps", &Application::setForegroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "setBackgroundPaneMaxFps", &Application::setBackgroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "setName", &Application::setName, &g_app);
g_lua.bindSingletonFunction("g_app", "setCompactName", &Application::setCompactName, &g_app);
g_lua.bindSingletonFunction("g_app", "setVersion", &Application::setVersion, &g_app);
g_lua.bindSingletonFunction("g_app", "isRunning", &Application::isRunning, &g_app);
g_lua.bindSingletonFunction("g_app", "isStopping", &Application::isStopping, &g_app);
g_lua.bindSingletonFunction("g_app", "isOnInputEvent", &Application::isOnInputEvent, &g_app);
g_lua.bindSingletonFunction("g_app", "getName", &Application::getName, &g_app);
g_lua.bindSingletonFunction("g_app", "getCompactName", &Application::getCompactName, &g_app);
g_lua.bindSingletonFunction("g_app", "getVersion", &Application::getVersion, &g_app);
g_lua.bindSingletonFunction("g_app", "getForegroundPaneFps", &Application::getForegroundPaneFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getBackgroundPaneFps", &Application::getBackgroundPaneFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getForegroundPaneMaxFps", &Application::getForegroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getBackgroundPaneMaxFps", &Application::getBackgroundPaneMaxFps, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildCompiler", &Application::getBuildCompiler, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildDate", &Application::getBuildDate, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildRevision", &Application::getBuildRevision, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildCommit", &Application::getBuildCommit, &g_app);
g_lua.bindSingletonFunction("g_app", "getBuildType", &Application::getBuildType, &g_app);
g_lua.bindSingletonFunction("g_app", "exit", &Application::exit, &g_app);
// 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);
// 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);
// 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);
// 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);
// 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);
// 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);
#ifdef FW_SOUND
// SoundManager
g_lua.registerSingletonClass("g_sounds");
g_lua.bindSingletonFunction("g_sounds", "preload", &SoundManager::preload, &g_sounds);
@ -628,36 +669,5 @@ void Application::registerLuaFunctions()
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);
// 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", "addToSearchPath", &ResourceManager::addToSearchPath, &g_resources);
g_lua.bindSingletonFunction("g_resources", "setupWriteDir", &ResourceManager::setupWriteDir, &g_resources);
g_lua.bindSingletonFunction("g_resources", "removeFromSearchPath", &ResourceManager::removeFromSearchPath, &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);
// 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);
// ParticleEffect
g_lua.registerClass<ParticleEffectType>();
g_lua.bindClassStaticFunction<ParticleEffectType>("create", []{ return ParticleEffectTypePtr(new ParticleEffectType); });
g_lua.bindClassMemberFunction<ParticleEffectType>("getName", &ParticleEffectType::getName);
g_lua.bindClassMemberFunction<ParticleEffectType>("getFile", &ParticleEffectType::getFile);
g_lua.bindClassMemberFunction<ParticleEffectType>("getDescription", &ParticleEffectType::getDescription);
// UIParticles
g_lua.registerClass<UIParticles, UIWidget>();
g_lua.bindClassStaticFunction<UIParticles>("create", []{ return UIParticlesPtr(new UIParticles); } );
g_lua.bindClassMemberFunction<UIParticles>("addEffect", &UIParticles::addEffect);
#endif
}

View File

@ -22,7 +22,7 @@
#include "connection.h"
#include <framework/application.h>
#include <framework/core/application.h>
#include <framework/core/eventdispatcher.h>
#include <boost/asio.hpp>
@ -41,7 +41,7 @@ Connection::Connection() :
Connection::~Connection()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
close();
}

View File

@ -24,7 +24,7 @@
#define INPUTMESSAGE_H
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class InputMessage : public LuaObject

View File

@ -24,7 +24,7 @@
#define OUTPUTMESSAGE_H
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class OutputMessage : public LuaObject

View File

@ -22,7 +22,7 @@
#include "protocol.h"
#include "connection.h"
#include <framework/application.h>
#include <framework/core/application.h>
Protocol::Protocol()
{
@ -33,7 +33,7 @@ Protocol::Protocol()
Protocol::~Protocol()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
disconnect();
}

View File

@ -27,7 +27,7 @@
#include "inputmessage.h"
#include "outputmessage.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class Protocol : public LuaObject

View File

@ -59,6 +59,7 @@
#include <thread>
#include <mutex>
#include <atomic>
#include <thread>
// boost utilities
#include <boost/algorithm/string.hpp>

View File

@ -24,7 +24,7 @@
#include "crashhandler.h"
#include <framework/global.h>
#include <framework/application.h>
#include <framework/core/application.h>
#ifndef __USE_GNU
#define __USE_GNU

View File

@ -24,7 +24,7 @@
#include "crashhandler.h"
#include <framework/global.h>
#include <framework/application.h>
#include <framework/core/application.h>
#include <windows.h>
#include <process.h>

View File

@ -24,8 +24,8 @@
#include "win32window.h"
#include <framework/application.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/core/application.h>
#include <framework/graphics/apngloader.h>
#include <framework/core/resourcemanager.h>
#define HSB_BIT_SET(p, n) (p[(n)/8] |= (128 >>((n)%8)))

View File

@ -24,7 +24,7 @@
#include "x11window.h"
#include <framework/core/resourcemanager.h>
#include <framework/thirdparty/apngloader.h>
#include <framework/graphics/apngloader.h>
#define LSB_BIT_SET(p, n) (p[(n)/8] |= (1 <<((n)%8)))

View File

@ -24,7 +24,7 @@
#define UILAYOUT_H
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/otml/otml.h>
// @bindclass

View File

@ -27,7 +27,7 @@
#include <framework/graphics/graphics.h>
#include <framework/platform/platformwindow.h>
#include <framework/core/eventdispatcher.h>
#include <framework/application.h>
#include <framework/core/application.h>
UIManager g_ui;

View File

@ -26,7 +26,7 @@
#include <framework/platform/platformwindow.h>
#include <framework/core/clock.h>
#include <framework/otml/otmlnode.h>
#include <framework/application.h>
#include <framework/core/application.h>
UITextEdit::UITextEdit()
{

View File

@ -30,7 +30,7 @@
#include <framework/graphics/graphics.h>
#include <framework/platform/platformwindow.h>
#include <framework/graphics/texturemanager.h>
#include <framework/application.h>
#include <framework/core/application.h>
UIWidget::UIWidget()
{
@ -46,7 +46,7 @@ UIWidget::UIWidget()
UIWidget::~UIWidget()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
#ifdef DEBUG
if(!m_destroyed)
g_logger.warning(stdext::format("widget '%s' was not explicitly destroyed", m_id));

View File

@ -24,7 +24,7 @@
#define UIWIDGET_H
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/graphics/declarations.h>
#include <framework/otml/otmlnode.h>
#include <framework/graphics/bitmapfont.h>

View File

@ -25,7 +25,7 @@
#include <framework/graphics/fontmanager.h>
#include <framework/graphics/painter.h>
#include <framework/graphics/framebuffer.h>
#include <framework/application.h>
#include <framework/core/application.h>
void UIWidget::initText()
{

View File

@ -26,6 +26,8 @@ distribution.
#ifndef TINYXML_INCLUDED
#define TINYXML_INCLUDED
#define TIXML_USE_STL // use STL strings instead
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable : 4530 )
@ -78,7 +80,7 @@ distribution.
#define TIXML_SNPRINTF snprintf
#define TIXML_SSCANF sscanf
#endif
#endif
#endif
class TiXmlDocument;
class TiXmlElement;
@ -93,7 +95,7 @@ const int TIXML_MAJOR_VERSION = 2;
const int TIXML_MINOR_VERSION = 6;
const int TIXML_PATCH_VERSION = 2;
/* Internal structure for tracking location of items
/* Internal structure for tracking location of items
in the XML file.
*/
struct TiXmlCursor
@ -116,7 +118,7 @@ struct TiXmlCursor
If you return 'true' from a Visit method, recursive parsing will continue. If you return
false, <b>no children of this node or its sibilings</b> will be Visited.
All flavors of Visit methods have a default implementation that returns 'true' (continue
All flavors of Visit methods have a default implementation that returns 'true' (continue
visiting). You need to only override methods that are interesting to you.
Generally Accept() is called on the TiXmlDocument, although all nodes suppert Visiting.
@ -151,8 +153,8 @@ public:
};
// Only used by Attribute::Query functions
enum
{
enum
{
TIXML_SUCCESS,
TIXML_NO_ATTRIBUTE,
TIXML_WRONG_TYPE
@ -204,10 +206,10 @@ public:
/** All TinyXml classes can print themselves to a filestream
or the string class (TiXmlString in non-STL mode, std::string
in STL mode.) Either or both cfile and str can be null.
This is a formatted print, and will insert
This is a formatted print, and will insert
tabs and newlines.
(For an unformatted stream, use the << operator.)
*/
virtual void Print( FILE* cfile, int depth ) const = 0;
@ -252,11 +254,11 @@ public:
// in the UTF-8 sequence.
static const int utf8ByteTable[256];
virtual const char* Parse( const char* p,
TiXmlParsingData* data,
virtual const char* Parse( const char* p,
TiXmlParsingData* data,
TiXmlEncoding encoding /*= TIXML_ENCODING_UNKNOWN */ ) = 0;
/** Expands entities in a string. Note this should not contian the tag's '<', '>', etc,
/** Expands entities in a string. Note this should not contian the tag's '<', '>', etc,
or they will be transformed into entities!
*/
static void EncodeString( const TIXML_STRING& str, TIXML_STRING* out );
@ -287,9 +289,9 @@ protected:
static const char* SkipWhiteSpace( const char*, TiXmlEncoding encoding );
inline static bool IsWhiteSpace( char c )
{
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
inline static bool IsWhiteSpace( char c )
{
return ( isspace( (unsigned char) c ) || c == '\n' || c == '\r' );
}
inline static bool IsWhiteSpace( int c )
{
@ -374,7 +376,7 @@ protected:
/// Field containing a generic user pointer
void* userData;
// None of these methods are reliable for any language except English.
// Good for approximation, not great for accuracy.
static int IsAlpha( unsigned char anyByte, TiXmlEncoding encoding );
@ -426,7 +428,7 @@ class TiXmlNode : public TiXmlBase
friend class TiXmlElement;
public:
#ifdef TIXML_USE_STL
#ifdef TIXML_USE_STL
/** An input stream operator, for every class. Tolerant of newlines and
formatting, but doesn't expect them.
@ -440,7 +442,7 @@ public:
The operator<< and operator>> are not completely symmetric. Writing
a node to a stream is very well defined. You'll get a nice stream
of output, without any extra whitespace or newlines.
But reading is not as well defined. (As it always is.) If you create
a TiXmlElement (for example) and read that from an input stream,
the text needs to define an element or junk will result. This is
@ -448,7 +450,7 @@ public:
A TiXmlDocument will read nodes until it reads a root element, and
all the children of that root element.
*/
*/
friend std::ostream& operator<< (std::ostream& out, const TiXmlNode& base);
/// Appends the XML node or attribute to a std::string.
@ -530,7 +532,7 @@ public:
}
const TiXmlNode* LastChild() const { return lastChild; } /// The last child of this node. Will be null if there are no children.
TiXmlNode* LastChild() { return lastChild; }
const TiXmlNode* LastChild( const char * value ) const; /// The last child of this node matching 'value'. Will be null if there are no children.
TiXmlNode* LastChild( const char * _value ) {
return const_cast< TiXmlNode* > ((const_cast< const TiXmlNode* >(this))->LastChild( _value ));
@ -709,11 +711,11 @@ public:
virtual TiXmlDeclaration* ToDeclaration() { return 0; } ///< Cast to a more defined type. Will return null if not of the requested type.
/** Create an exact duplicate of this node and return it. The memory must be deleted
by the caller.
by the caller.
*/
virtual TiXmlNode* Clone() const = 0;
/** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
/** Accept a hierchical visit the nodes in the TinyXML DOM. Every node in the
XML tree will be conditionally visited and the host will be called back
via the TiXmlVisitor interface.
@ -724,7 +726,7 @@ public:
The interface has been based on ideas from:
- http://www.saxproject.org/
- http://c2.com/cgi/wiki?HierarchicalVisitorPattern
- http://c2.com/cgi/wiki?HierarchicalVisitorPattern
Which are both good references for "visiting".
@ -821,7 +823,7 @@ public:
/** QueryIntValue examines the value string. It is an alternative to the
IntValue() method with richer error checking.
If the value is an integer, it is stored in 'value' and
If the value is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE.
@ -840,21 +842,21 @@ public:
#ifdef TIXML_USE_STL
/// STL std::string form.
void SetName( const std::string& _name ) { name = _name; }
/// STL std::string form.
void SetName( const std::string& _name ) { name = _name; }
/// STL std::string form.
void SetValue( const std::string& _value ) { value = _value; }
#endif
/// Get the next sibling attribute in the DOM. Returns null at end.
const TiXmlAttribute* Next() const;
TiXmlAttribute* Next() {
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Next() );
}
/// Get the previous sibling attribute in the DOM. Returns null at beginning.
const TiXmlAttribute* Previous() const;
TiXmlAttribute* Previous() {
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
return const_cast< TiXmlAttribute* >( (const_cast< const TiXmlAttribute* >(this))->Previous() );
}
bool operator==( const TiXmlAttribute& rhs ) const { return rhs.name == name; }
@ -890,7 +892,7 @@ private:
/* A class used to manage a group of attributes.
It is only used internally, both by the ELEMENT and the DECLARATION.
The set can be changed transparent to the Element and Declaration
classes that use it, but NOT transparent to the Attribute
which has to implement a next() and previous() method. Which makes
@ -977,15 +979,15 @@ public:
/** QueryIntAttribute examines the attribute - it is an alternative to the
Attribute() method with richer error checking.
If the attribute is an integer, it is stored in 'value' and
If the attribute is an integer, it is stored in 'value' and
the call returns TIXML_SUCCESS. If it is not
an integer, it returns TIXML_WRONG_TYPE. If the attribute
does not exist, then TIXML_NO_ATTRIBUTE is returned.
*/
*/
int QueryIntAttribute( const char* name, int* _value ) const;
/// QueryUnsignedAttribute examines the attribute - see QueryIntAttribute().
int QueryUnsignedAttribute( const char* name, unsigned* _value ) const;
/** QueryBoolAttribute examines the attribute - see QueryIntAttribute().
/** QueryBoolAttribute examines the attribute - see QueryIntAttribute().
Note that '1', 'true', or 'yes' are considered true, while '0', 'false'
and 'no' are considered false.
*/
@ -1016,7 +1018,7 @@ public:
/** Template form of the attribute query which will try to read the
attribute into the specified type. Very easy, very powerful, but
be careful to make sure to call this with the correct type.
NOTE: This method doesn't work correctly for 'string' types that contain spaces.
@return TIXML_SUCCESS, TIXML_WRONG_TYPE, or TIXML_NO_ATTRIBUTE
@ -1089,7 +1091,7 @@ public:
/** Convenience function for easy access to the text inside an element. Although easy
and concise, GetText() is limited compared to getting the TiXmlText child
and accessing it directly.
If the first child of 'this' is a TiXmlText, the GetText()
returns the character string of the Text node, else null is returned.
@ -1099,23 +1101,23 @@ public:
const char* str = fooElement->GetText();
@endverbatim
'str' will be a pointer to "This is text".
'str' will be a pointer to "This is text".
Note that this function can be misleading. If the element foo was created from
this XML:
@verbatim
<foo><b>This is text</b></foo>
<foo><b>This is text</b></foo>
@endverbatim
then the value of str would be null. The first child node isn't a text node, it is
another element. From this XML:
@verbatim
<foo>This is <b>text</b></foo>
<foo>This is <b>text</b></foo>
@endverbatim
GetText() will return "This is ".
WARNING: GetText() accesses a child node - don't become confused with the
similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
WARNING: GetText() accesses a child node - don't become confused with the
similarly named TiXmlHandle::Text() and TiXmlNode::ToText() which are
safe type casts on the referenced node.
*/
const char* GetText() const;
@ -1133,7 +1135,7 @@ public:
virtual const TiXmlElement* ToElement() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlElement* ToElement() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1186,7 +1188,7 @@ public:
virtual const TiXmlComment* ToComment() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlComment* ToComment() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1204,16 +1206,16 @@ private:
};
/** XML text. A text node can have 2 ways to output the next. "normal" output
/** XML text. A text node can have 2 ways to output the next. "normal" output
and CDATA. It will default to the mode it was parsed from the XML file and
you generally want to leave it alone, but you can change the output mode with
you generally want to leave it alone, but you can change the output mode with
SetCDATA() and query it with CDATA().
*/
class TiXmlText : public TiXmlNode
{
friend class TiXmlElement;
public:
/** Constructor for text element. By default, it is treated as
/** Constructor for text element. By default, it is treated as
normal, encoded text. If you want it be output as a CDATA text
element, set the parameter _cdata to 'true'
*/
@ -1249,7 +1251,7 @@ public:
virtual const TiXmlText* ToText() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlText* ToText() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1325,7 +1327,7 @@ public:
virtual const TiXmlDeclaration* ToDeclaration() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlDeclaration* ToDeclaration() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* visitor ) const;
@ -1370,7 +1372,7 @@ public:
virtual const TiXmlUnknown* ToUnknown() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlUnknown* ToUnknown() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1456,7 +1458,7 @@ public:
- The ErrorId() will contain the integer identifier of the error (not generally useful)
- The ErrorDesc() method will return the name of the error. (very useful)
- The ErrorRow() and ErrorCol() will return the location of the error (if known)
*/
*/
bool Error() const { return error; }
/// Contains a textual (english) description of the error if one occurs.
@ -1467,7 +1469,7 @@ public:
*/
int ErrorId() const { return errorId; }
/** Returns the location (if known) of the error. The first column is column 1,
/** Returns the location (if known) of the error. The first column is column 1,
and the first row is row 1. A value of 0 means the row and column wasn't applicable
(memory errors, for example, have no row/column) or the parser lost the error. (An
error in the error reporting, in that case.)
@ -1480,7 +1482,7 @@ public:
/** SetTabSize() allows the error reporting functions (ErrorRow() and ErrorCol())
to report the correct values for row and column. It does not change the output
or input in any way.
By calling this method, with a tab size
greater than 0, the row and column of each node and attribute is stored
when the file is loaded. Very useful for tracking the DOM back in to
@ -1508,11 +1510,11 @@ public:
/** If you have handled the error, it can be reset with this call. The error
state is automatically cleared if you Parse a new XML block.
*/
void ClearError() { error = false;
errorId = 0;
errorDesc = "";
errorLocation.row = errorLocation.col = 0;
//errorLocation.last = 0;
void ClearError() { error = false;
errorId = 0;
errorDesc = "";
errorLocation.row = errorLocation.col = 0;
//errorLocation.last = 0;
}
/** Write the document to standard out using formatted printing ("pretty print"). */
@ -1522,7 +1524,7 @@ public:
will allocate a character array (new char[]) and return it as a pointer. The
calling code pust call delete[] on the return char* to avoid a memory leak.
*/
//char* PrintToMemory() const;
//char* PrintToMemory() const;
/// Print this Document to a FILE stream.
virtual void Print( FILE* cfile, int depth = 0 ) const;
@ -1532,7 +1534,7 @@ public:
virtual const TiXmlDocument* ToDocument() const { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
virtual TiXmlDocument* ToDocument() { return this; } ///< Cast to a more defined type. Will return null not of the requested type.
/** Walk the XML tree visiting this node and all of its children.
/** Walk the XML tree visiting this node and all of its children.
*/
virtual bool Accept( TiXmlVisitor* content ) const;
@ -1570,7 +1572,7 @@ private:
<Document>
@endverbatim
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very
easy to write a *lot* of code that looks like:
@verbatim
@ -1590,7 +1592,7 @@ private:
@endverbatim
And that doesn't even cover "else" cases. TiXmlHandle addresses the verbosity
of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
of such code. A TiXmlHandle checks for null pointers so it is perfectly safe
and correct to use:
@verbatim
@ -1611,7 +1613,7 @@ private:
What they should not be used for is iteration:
@verbatim
int i=0;
int i=0;
while ( true )
{
TiXmlElement* child = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", i ).ToElement();
@ -1622,8 +1624,8 @@ private:
}
@endverbatim
It seems reasonable, but it is in fact two embedded while loops. The Child method is
a linear walk to find the element, so this code would iterate much more than it needs
It seems reasonable, but it is in fact two embedded while loops. The Child method is
a linear walk to find the element, so this code would iterate much more than it needs
to. Instead, prefer:
@verbatim
@ -1653,20 +1655,20 @@ public:
/// Return a handle to the first child element with the given name.
TiXmlHandle FirstChildElement( const char * value ) const;
/** Return a handle to the "index" child with the given name.
/** Return a handle to the "index" child with the given name.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( const char* value, int index ) const;
/** Return a handle to the "index" child.
/** Return a handle to the "index" child.
The first child is 0, the second 1, etc.
*/
TiXmlHandle Child( int index ) const;
/** Return a handle to the "index" child element with the given name.
/** Return a handle to the "index" child element with the given name.
The first child element is 0, the second 1, etc. Note that only TiXmlElements
are indexed: other types are not counted.
*/
TiXmlHandle ChildElement( const char* value, int index ) const;
/** Return a handle to the "index" child element.
/** Return a handle to the "index" child element.
The first child element is 0, the second 1, etc. Note that only TiXmlElements
are indexed: other types are not counted.
*/
@ -1682,7 +1684,7 @@ public:
/** Return the handle as a TiXmlNode. This may return null.
*/
TiXmlNode* ToNode() const { return node; }
TiXmlNode* ToNode() const { return node; }
/** Return the handle as a TiXmlElement. This may return null.
*/
TiXmlElement* ToElement() const { return ( ( node && node->ToElement() ) ? node->ToElement() : 0 ); }
@ -1693,11 +1695,11 @@ public:
*/
TiXmlUnknown* ToUnknown() const { return ( ( node && node->ToUnknown() ) ? node->ToUnknown() : 0 ); }
/** @deprecated use ToNode.
/** @deprecated use ToNode.
Return the handle as a TiXmlNode. This may return null.
*/
TiXmlNode* Node() const { return ToNode(); }
/** @deprecated use ToElement.
TiXmlNode* Node() const { return ToNode(); }
/** @deprecated use ToElement.
Return the handle as a TiXmlElement. This may return null.
*/
TiXmlElement* Element() const { return ToElement(); }
@ -1757,7 +1759,7 @@ public:
void SetIndent( const char* _indent ) { indent = _indent ? _indent : "" ; }
/// Query the indention string.
const char* Indent() { return indent.c_str(); }
/** Set the line breaking string. By default set to newline (\n).
/** Set the line breaking string. By default set to newline (\n).
Some operating systems prefer other characters, or can be
set to the null/empty string for no indenation.
*/
@ -1765,12 +1767,12 @@ public:
/// Query the current line breaking string.
const char* LineBreak() { return lineBreak.c_str(); }
/** Switch over to "stream printing" which is the most dense formatting without
/** Switch over to "stream printing" which is the most dense formatting without
linebreaks. Common when the XML is needed for network transmission.
*/
void SetStreamPrinting() { indent = "";
lineBreak = "";
}
}
/// Return the result.
const char* CStr() { return buffer.c_str(); }
/// Return the length of the result string.

View File

@ -20,10 +20,10 @@
* THE SOFTWARE.
*/
#include "framework/application.h"
#include "framework/luascript/luainterface.h"
#include "framework/core/resourcemanager.h"
#include "otclient/otclient.h"
#include <framework/core/application.h>
#include <framework/core/resourcemanager.h>
#include <framework/luaengine/luainterface.h>
#include <otclient/otclient.h>
int main(int argc, const char* argv[])
{
@ -35,7 +35,7 @@ int main(int argc, const char* argv[])
g_app.setVersion("0.5.0_dev");
// initialize application framework and otclient
g_app.init("otclient", args);
g_app.init(args);
g_otclient.init(args);
// find script init.lua and run it

View File

@ -1,31 +1,31 @@
# CMAKE_CURRENT_LIST_DIR cmake 2.6 compatiblity
IF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
GET_FILENAME_COMPONENT(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
if(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
get_filename_component(CMAKE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
endif(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
# otclient options
ADD_DEFINITIONS(-DOTCLIENT)
OPTION(BOT_PROTECTION "Enable bot protection" ON)
SET(PROTOCOL 860 CACHE "Protocol version" STRING)
OPTION(CIPSOFT_RSA "Use cipsoft RSA to login into original tibia" OFF)
ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL})
MESSAGE(STATUS "Protocol: " ${PROTOCOL})
add_definitions(-DOTCLIENT)
option(BOT_PROTECTION "Enable bot protection" ON)
set(PROTOCOL 860 CACHE "Protocol version" STRING)
option(CIPSOFT_RSA "Use cipsoft RSA to login into original tibia" OFF)
add_definitions(-DPROTOCOL=${PROTOCOL})
message(STATUS "Protocol: " ${PROTOCOL})
IF(CIPSOFT_RSA)
ADD_DEFINITIONS(-DCIPSOFT_RSA -DOSTYPE=2)
MESSAGE(STATUS "RSA: CipSoft")
ELSE()
MESSAGE(STATUS "RSA: OTServ")
ENDIF()
if(CIPSOFT_RSA)
add_definitions(-DCIPSOFT_RSA -DOSTYPE=2)
message(STATUS "RSA: CipSoft")
else()
message(STATUS "RSA: OTServ")
endif()
IF(BOT_PROTECTION)
ADD_DEFINITIONS(-DBOT_PROTECTION)
MESSAGE(STATUS "Bot protection: ON")
ELSE(BOT_PROTECTION)
MESSAGE(STATUS "Bot protection: OFF")
ENDIF(BOT_PROTECTION)
if(BOT_PROTECTION)
add_definitions(-DBOT_PROTECTION)
message(STATUS "Bot protection: ON")
else(BOT_PROTECTION)
message(STATUS "Bot protection: OFF")
endif(BOT_PROTECTION)
SET(otclient_SOURCES ${otclient_SOURCES}
set(otclient_SOURCES ${otclient_SOURCES}
# otclient
${CMAKE_CURRENT_LIST_DIR}/const.h
${CMAKE_CURRENT_LIST_DIR}/global.h
@ -34,71 +34,69 @@ SET(otclient_SOURCES ${otclient_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/otclient.h
# core
${CMAKE_CURRENT_LIST_DIR}/core/animatedtext.cpp
${CMAKE_CURRENT_LIST_DIR}/core/animatedtext.h
${CMAKE_CURRENT_LIST_DIR}/core/container.cpp
${CMAKE_CURRENT_LIST_DIR}/core/container.h
${CMAKE_CURRENT_LIST_DIR}/core/creature.cpp
${CMAKE_CURRENT_LIST_DIR}/core/creature.h
${CMAKE_CURRENT_LIST_DIR}/core/declarations.h
${CMAKE_CURRENT_LIST_DIR}/core/effect.cpp
${CMAKE_CURRENT_LIST_DIR}/core/effect.h
${CMAKE_CURRENT_LIST_DIR}/core/game.cpp
${CMAKE_CURRENT_LIST_DIR}/core/game.h
${CMAKE_CURRENT_LIST_DIR}/core/shadermanager.cpp
${CMAKE_CURRENT_LIST_DIR}/core/shadermanager.h
${CMAKE_CURRENT_LIST_DIR}/core/item.cpp
${CMAKE_CURRENT_LIST_DIR}/core/item.h
${CMAKE_CURRENT_LIST_DIR}/core/localplayer.cpp
${CMAKE_CURRENT_LIST_DIR}/core/localplayer.h
${CMAKE_CURRENT_LIST_DIR}/core/map.cpp
${CMAKE_CURRENT_LIST_DIR}/core/map.h
${CMAKE_CURRENT_LIST_DIR}/core/mapview.cpp
${CMAKE_CURRENT_LIST_DIR}/core/mapview.h
${CMAKE_CURRENT_LIST_DIR}/core/missile.cpp
${CMAKE_CURRENT_LIST_DIR}/core/missile.h
${CMAKE_CURRENT_LIST_DIR}/core/outfit.cpp
${CMAKE_CURRENT_LIST_DIR}/core/outfit.h
${CMAKE_CURRENT_LIST_DIR}/core/player.cpp
${CMAKE_CURRENT_LIST_DIR}/core/player.h
${CMAKE_CURRENT_LIST_DIR}/core/spritemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/core/spritemanager.h
${CMAKE_CURRENT_LIST_DIR}/core/statictext.cpp
${CMAKE_CURRENT_LIST_DIR}/core/statictext.h
${CMAKE_CURRENT_LIST_DIR}/core/thing.cpp
${CMAKE_CURRENT_LIST_DIR}/core/thing.h
${CMAKE_CURRENT_LIST_DIR}/core/thingtypemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/core/thingtypemanager.h
${CMAKE_CURRENT_LIST_DIR}/core/thingtypedat.cpp
${CMAKE_CURRENT_LIST_DIR}/core/thingtypedat.h
${CMAKE_CURRENT_LIST_DIR}/core/thingtypeotb.cpp
${CMAKE_CURRENT_LIST_DIR}/core/thingtypeotb.h
${CMAKE_CURRENT_LIST_DIR}/core/tile.cpp
${CMAKE_CURRENT_LIST_DIR}/core/tile.h
${CMAKE_CURRENT_LIST_DIR}/animatedtext.cpp
${CMAKE_CURRENT_LIST_DIR}/animatedtext.h
${CMAKE_CURRENT_LIST_DIR}/container.cpp
${CMAKE_CURRENT_LIST_DIR}/container.h
${CMAKE_CURRENT_LIST_DIR}/creature.cpp
${CMAKE_CURRENT_LIST_DIR}/creature.h
${CMAKE_CURRENT_LIST_DIR}/declarations.h
${CMAKE_CURRENT_LIST_DIR}/effect.cpp
${CMAKE_CURRENT_LIST_DIR}/effect.h
${CMAKE_CURRENT_LIST_DIR}/game.cpp
${CMAKE_CURRENT_LIST_DIR}/game.h
${CMAKE_CURRENT_LIST_DIR}/shadermanager.cpp
${CMAKE_CURRENT_LIST_DIR}/shadermanager.h
${CMAKE_CURRENT_LIST_DIR}/item.cpp
${CMAKE_CURRENT_LIST_DIR}/item.h
${CMAKE_CURRENT_LIST_DIR}/localplayer.cpp
${CMAKE_CURRENT_LIST_DIR}/localplayer.h
${CMAKE_CURRENT_LIST_DIR}/map.cpp
${CMAKE_CURRENT_LIST_DIR}/map.h
${CMAKE_CURRENT_LIST_DIR}/mapview.cpp
${CMAKE_CURRENT_LIST_DIR}/mapview.h
${CMAKE_CURRENT_LIST_DIR}/missile.cpp
${CMAKE_CURRENT_LIST_DIR}/missile.h
${CMAKE_CURRENT_LIST_DIR}/outfit.cpp
${CMAKE_CURRENT_LIST_DIR}/outfit.h
${CMAKE_CURRENT_LIST_DIR}/player.cpp
${CMAKE_CURRENT_LIST_DIR}/player.h
${CMAKE_CURRENT_LIST_DIR}/spritemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/spritemanager.h
${CMAKE_CURRENT_LIST_DIR}/statictext.cpp
${CMAKE_CURRENT_LIST_DIR}/statictext.h
${CMAKE_CURRENT_LIST_DIR}/thing.cpp
${CMAKE_CURRENT_LIST_DIR}/thing.h
${CMAKE_CURRENT_LIST_DIR}/thingtypemanager.cpp
${CMAKE_CURRENT_LIST_DIR}/thingtypemanager.h
${CMAKE_CURRENT_LIST_DIR}/thingtypedat.cpp
${CMAKE_CURRENT_LIST_DIR}/thingtypedat.h
${CMAKE_CURRENT_LIST_DIR}/thingtypeotb.cpp
${CMAKE_CURRENT_LIST_DIR}/thingtypeotb.h
${CMAKE_CURRENT_LIST_DIR}/tile.cpp
${CMAKE_CURRENT_LIST_DIR}/tile.h
# lua
${CMAKE_CURRENT_LIST_DIR}/luascript/luavaluecasts.cpp
${CMAKE_CURRENT_LIST_DIR}/luascript/luavaluecasts.h
${CMAKE_CURRENT_LIST_DIR}/luavaluecasts.cpp
${CMAKE_CURRENT_LIST_DIR}/luavaluecasts.h
# net
${CMAKE_CURRENT_LIST_DIR}/net/declarations.h
${CMAKE_CURRENT_LIST_DIR}/net/protocolcodes.h
${CMAKE_CURRENT_LIST_DIR}/net/protocolgame.cpp
${CMAKE_CURRENT_LIST_DIR}/net/protocolgame.h
${CMAKE_CURRENT_LIST_DIR}/net/protocolgameparse.cpp
${CMAKE_CURRENT_LIST_DIR}/net/protocolgamesend.cpp
${CMAKE_CURRENT_LIST_DIR}/protocolcodes.h
${CMAKE_CURRENT_LIST_DIR}/protocolgame.cpp
${CMAKE_CURRENT_LIST_DIR}/protocolgame.h
${CMAKE_CURRENT_LIST_DIR}/protocolgameparse.cpp
${CMAKE_CURRENT_LIST_DIR}/protocolgamesend.cpp
# ui
${CMAKE_CURRENT_LIST_DIR}/ui/declarations.h
${CMAKE_CURRENT_LIST_DIR}/ui/uicreature.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uicreature.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiitem.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiitem.h
${CMAKE_CURRENT_LIST_DIR}/ui/uimap.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uimap.h
${CMAKE_CURRENT_LIST_DIR}/ui/uiprogressrect.cpp
${CMAKE_CURRENT_LIST_DIR}/ui/uiprogressrect.h
${CMAKE_CURRENT_LIST_DIR}/uicreature.cpp
${CMAKE_CURRENT_LIST_DIR}/uicreature.h
${CMAKE_CURRENT_LIST_DIR}/uiitem.cpp
${CMAKE_CURRENT_LIST_DIR}/uiitem.h
${CMAKE_CURRENT_LIST_DIR}/uimap.cpp
${CMAKE_CURRENT_LIST_DIR}/uimap.h
${CMAKE_CURRENT_LIST_DIR}/uiprogressrect.cpp
${CMAKE_CURRENT_LIST_DIR}/uiprogressrect.h
# util
${CMAKE_CURRENT_LIST_DIR}/util/position.h
${CMAKE_CURRENT_LIST_DIR}/position.h
)

View File

@ -25,7 +25,7 @@
#include "declarations.h"
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
// @bindclass
class Container : public LuaObject

View File

@ -20,11 +20,14 @@
* THE SOFTWARE.
*/
#ifndef OTCLIENT_CORE_DECLARATIONS_H
#define OTCLIENT_CORE_DECLARATIONS_H
#ifndef OTCLIENT_DECLARATIONS_H
#define OTCLIENT_DECLARATIONS_H
#include <otclient/global.h>
#include "global.h"
#include <framework/net/declarations.h>
#include <framework/ui/declarations.h>
// core
class Map;
class Game;
class MapView;
@ -65,4 +68,22 @@ typedef std::vector<ThingPtr> ThingList;
typedef std::vector<ThingTypeDatPtr> ThingTypeDatList;
typedef std::vector<ThingTypeOtbPtr> ThingTypeOtbList;
// net
class ProtocolLogin;
class ProtocolGame;
typedef std::shared_ptr<ProtocolGame> ProtocolGamePtr;
typedef std::shared_ptr<ProtocolLogin> ProtocolLoginPtr;
// ui
class UIItem;
class UICreature;
class UIMap;
class UIProgressRect;
typedef std::shared_ptr<UIItem> UIItemPtr;
typedef std::shared_ptr<UICreature> UICreaturePtr;
typedef std::shared_ptr<UIMap> UIMapPtr;
typedef std::shared_ptr<UIProgressRect> UIProgressRectPtr;
#endif

View File

@ -29,9 +29,9 @@
#include "statictext.h"
#include <framework/core/eventdispatcher.h>
#include <framework/ui/uimanager.h>
#include <framework/application.h>
#include <otclient/luascript/luavaluecasts.h>
#include <otclient/net/protocolgame.h>
#include <framework/core/application.h>
#include "luavaluecasts.h"
#include "protocolgame.h"
Game g_game;

View File

@ -24,9 +24,8 @@
#define GAME_H
#include "declarations.h"
#include <otclient/net/declarations.h>
#include <otclient/core/item.h>
#include <otclient/core/outfit.h>
#include "item.h"
#include "outfit.h"
#include <framework/core/timer.h>
typedef std::tuple<std::string, bool> Vip;

View File

@ -27,6 +27,6 @@
// widely used headers
#include "const.h"
#include "util/position.h"
#include "position.h"
#endif

View File

@ -21,29 +21,29 @@
*/
#include "otclient.h"
#include <framework/luascript/luainterface.h>
#include <otclient/luascript/luavaluecasts.h>
#include <otclient/core/game.h>
#include <otclient/core/tile.h>
#include <otclient/core/container.h>
#include <otclient/core/item.h>
#include <otclient/core/effect.h>
#include <otclient/core/missile.h>
#include <otclient/core/statictext.h>
#include <otclient/core/animatedtext.h>
#include <otclient/core/creature.h>
#include <otclient/core/player.h>
#include <otclient/core/localplayer.h>
#include <otclient/core/map.h>
#include <otclient/core/thingtypemanager.h>
#include <otclient/core/spritemanager.h>
#include <otclient/core/shadermanager.h>
#include <otclient/net/protocolgame.h>
#include <otclient/ui/uiitem.h>
#include <otclient/ui/uicreature.h>
#include <otclient/ui/uimap.h>
#include <otclient/ui/uiprogressrect.h>
#include <otclient/core/outfit.h>
#include <framework/luaengine/luainterface.h>
#include "luavaluecasts.h"
#include "game.h"
#include "tile.h"
#include "container.h"
#include "item.h"
#include "effect.h"
#include "missile.h"
#include "statictext.h"
#include "animatedtext.h"
#include "creature.h"
#include "player.h"
#include "localplayer.h"
#include "map.h"
#include "thingtypemanager.h"
#include "spritemanager.h"
#include "shadermanager.h"
#include "protocolgame.h"
#include "uiitem.h"
#include "uicreature.h"
#include "uimap.h"
#include "uiprogressrect.h"
#include "outfit.h"
void OTClient::registerLuaFunctions()
{

View File

@ -21,7 +21,7 @@
*/
#include "luavaluecasts.h"
#include <framework/luascript/luainterface.h>
#include <framework/luaengine/luainterface.h>
int push_luavalue(const Outfit& outfit)
{

View File

@ -23,9 +23,9 @@
#ifndef OTCLIENT_LUAVALUECASTS_H
#define OTCLIENT_LUAVALUECASTS_H
#include <otclient/global.h>
#include <framework/luascript/declarations.h>
#include <otclient/core/outfit.h>
#include "global.h"
#include <framework/luaengine/declarations.h>
#include "outfit.h"
// outfit
int push_luavalue(const Outfit& outfit);

View File

@ -33,7 +33,7 @@
#include <framework/graphics/graphics.h>
#include <framework/graphics/framebuffermanager.h>
#include <framework/core/eventdispatcher.h>
#include <framework/application.h>
#include <framework/core/application.h>
MapView::MapView()
{
@ -51,7 +51,7 @@ MapView::MapView()
MapView::~MapView()
{
assert(!g_app.isTermianted());
assert(!g_app.isTerminated());
}
void MapView::draw(const Rect& rect)

View File

@ -25,7 +25,7 @@
#include "declarations.h"
#include <framework/graphics/declarations.h>
#include <framework/luascript/luaobject.h>
#include <framework/luaengine/luaobject.h>
#include <framework/core/declarations.h>
// @bindclass

View File

@ -24,7 +24,7 @@
#ifndef MINIMAP_H
#define MINIMAP_H
#include <otclient/global.h>
#include "global.h"
#include <framework/graphics/image.h>
/*
enum {

View File

@ -24,10 +24,10 @@
#include <framework/core/modulemanager.h>
#include <framework/core/resourcemanager.h>
#include <framework/graphics/graphics.h>
#include <otclient/core/game.h>
#include <otclient/core/map.h>
#include <otclient/core/shadermanager.h>
#include "core/spritemanager.h"
#include "game.h"
#include "map.h"
#include "shadermanager.h"
#include "spritemanager.h"
#include <framework/core/configmanager.h>
OTClient g_otclient;

View File

@ -23,7 +23,7 @@
#ifndef OTCLIENT_H
#define OTCLIENT_H
#include <otclient/global.h>
#include "global.h"
class OTClient
{

View File

@ -24,7 +24,7 @@
#define OUTFIT_H
#include <framework/util/color.h>
#include <otclient/core/thingtypemanager.h>
#include "thingtypemanager.h"
class Outfit
{

Some files were not shown because too many files have changed in this diff Show More