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
master
Eduardo Bart 12 years ago
parent 099716fe03
commit e3298d561c

@ -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)

@ -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

@ -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}")
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(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake;${CMAKE_MODULE_PATH}")
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,7 +78,178 @@ SET(framework_SOURCES ${framework_SOURCES}
${CMAKE_CURRENT_LIST_DIR}/core/timer.cpp
${CMAKE_CURRENT_LIST_DIR}/core/timer.h
# graphics
# 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
${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.h
${CMAKE_CURRENT_LIST_DIR}/otml/otml.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h
# crash handler
${CMAKE_CURRENT_LIST_DIR}/platform/crashhandler.h
${CMAKE_CURRENT_LIST_DIR}/platform/unixcrashhandler.cpp
${CMAKE_CURRENT_LIST_DIR}/platform/win32crashhandler.cpp
)
# 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
@ -250,97 +302,8 @@ SET(framework_SOURCES ${framework_SOURCES}
${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
# otml
${CMAKE_CURRENT_LIST_DIR}/otml/declarations.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmldocument.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlemitter.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlexception.h
${CMAKE_CURRENT_LIST_DIR}/otml/otml.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlnode.h
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.cpp
${CMAKE_CURRENT_LIST_DIR}/otml/otmlparser.h
# platform
${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
${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.cpp
${CMAKE_CURRENT_LIST_DIR}/graphics/apngloader.h
# ui
${CMAKE_CURRENT_LIST_DIR}/ui/declarations.h
@ -373,17 +336,92 @@ SET(framework_SOURCES ${framework_SOURCES}
${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
)
# 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})

@ -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();
}

@ -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();
bool willRepaint() { return m_mustRepaint; }
void repaint() { m_mustRepaint = true; }
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();
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

@ -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>
#include "consoleapplication.h"
#include <framework/core/clock.h>
#include <framework/luaengine/luainterface.h>
class UIItem;
class UICreature;
class UIMap;
class UIProgressRect;
#ifdef FW_NET
#include <framework/net/connection.h>
#endif
ConsoleApplication g_app;
void ConsoleApplication::run()
{
m_running = true;
// run the first poll
poll();
typedef std::shared_ptr<UIItem> UIItemPtr;
typedef std::shared_ptr<UICreature> UICreaturePtr;
typedef std::shared_ptr<UIMap> UIMapPtr;
typedef std::shared_ptr<UIProgressRect> UIProgressRectPtr;
// 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;
}

@ -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

@ -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

@ -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();
}

@ -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;

@ -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>
#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();
#ifdef FW_SOUND
#include <framework/sound/soundmanager.h>
#endif
m_appCompactName = compactName;
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;
GraphicalApplication g_app;
// 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;
// first clock update
g_clock.update();
// run the first poll
poll();
g_clock.update();
g_lua.callGlobalField("g_app", "onRun");
// first clock update
g_clock.update();
// 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);

@ -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

@ -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;

@ -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)
{

@ -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

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

@ -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>

@ -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);
}

@ -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);
}

@ -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)
{

@ -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

@ -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);
}

@ -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);
}

@ -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

@ -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);

@ -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;

@ -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;

@ -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) {

@ -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
}

@ -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();
}

@ -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

@ -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

@ -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();
}

@ -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

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

@ -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

@ -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>

@ -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)))

@ -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)))

@ -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

@ -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;

@ -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()
{

@ -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));

@ -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>

@ -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()
{

@ -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 )

@ -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

@ -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
)

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

@ -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

@ -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;

@ -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;

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

@ -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()
{

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

@ -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);

@ -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)

@ -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

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

@ -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;

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

@ -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

Loading…
Cancel
Save