pax_global_header00006660000000000000000000000064145155675350014532gustar00rootroot0000000000000052 comment=a9ed29e727ef117977df104a1005905b91028b97 mygui-3.4.3+dfsg/000077500000000000000000000000001451556753500136125ustar00rootroot00000000000000mygui-3.4.3+dfsg/.clang-format000066400000000000000000000050751451556753500161740ustar00rootroot00000000000000BasedOnStyle: LLVM AccessModifierOffset: -4 AlignAfterOpenBracket: AlwaysBreak AlignConsecutiveAssignments: None AlignConsecutiveBitFields: None AlignConsecutiveDeclarations: None AlignConsecutiveMacros: None AlignEscapedNewlines: DontAlign AlignOperands: DontAlign AlignTrailingComments: false AllowAllArgumentsOnNextLine: false AllowAllConstructorInitializersOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false AllowShortBlocksOnASingleLine: Empty AllowShortCaseLabelsOnASingleLine: true AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: Never AllowShortLambdasOnASingleLine: Inline AllowShortLoopsOnASingleLine: false AlwaysBreakAfterReturnType: None AlwaysBreakBeforeMultilineStrings: false AlwaysBreakTemplateDeclarations: Yes BinPackArguments: false BinPackParameters: false BitFieldColonSpacing: Both BreakBeforeBinaryOperators: None BreakBeforeBraces: Allman BreakBeforeConceptDeclarations: true BreakBeforeTernaryOperators: true BreakConstructorInitializers: AfterColon BreakInheritanceList: AfterColon BreakStringLiterals: true ColumnLimit: 120 CompactNamespaces: false ConstructorInitializerAllOnOneLineOrOnePerLine: true ContinuationIndentWidth: 4 Cpp11BracedListStyle: true DeriveLineEnding: true DerivePointerAlignment: false EmptyLineBeforeAccessModifier: LogicalBlock FixNamespaceComments: false IncludeBlocks: Preserve IndentCaseBlocks: false IndentCaseLabels: false IndentExternBlock: NoIndent IndentGotoLabels: true IndentPPDirectives: BeforeHash IndentRequires: true IndentWidth: 4 IndentWrappedFunctionNames: false KeepEmptyLinesAtTheStartOfBlocks: false MaxEmptyLinesToKeep: 2 NamespaceIndentation: All PackConstructorInitializers: Never PenaltyIndentedWhitespace: 1 PenaltyReturnTypeOnItsOwnLine: 1000 PointerAlignment: Left ReflowComments: false SortIncludes: Never SortUsingDeclarations: false SpaceAfterCStyleCast: false SpaceAfterLogicalNot: false SpaceAfterTemplateKeyword: false SpaceAroundPointerQualifiers: Default SpaceBeforeAssignmentOperators: true SpaceBeforeCaseColon: false SpaceBeforeCpp11BracedList: false SpaceBeforeCtorInitializerColon: true SpaceBeforeInheritanceColon: true SpaceBeforeParens: ControlStatements SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 1 SpacesInAngles: false SpacesInCStyleCastParentheses: false SpacesInConditionalStatement: false SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false Standard: Latest TabWidth: 4 UseTab: Always mygui-3.4.3+dfsg/.clang-tidy000066400000000000000000000061461451556753500156550ustar00rootroot00000000000000Checks: '\ -*,\ # definitely good checks modernize-*,\ performance-*,\ readability-*,\ cppcoreguidelines-*,\ hicpp-*,\ google-*,\ bugprone-*,\ \ # intentionally disabled checks (sorted alphabetically) -bugprone-branch-clone,\ -bugprone-easily-swappable-parameters,\ -bugprone-exception-escape,\ # TODO? -bugprone-implicit-widening-of-multiplication-result,\ # TODO? -bugprone-macro-parentheses,\ -bugprone-misplaced-widening-cast,\ -bugprone-narrowing-conversions,\ -bugprone-reserved-identifier,\ -bugprone-signed-char-misuse,\ # TODO? -cppcoreguidelines-avoid-c-arrays,\ -cppcoreguidelines-avoid-const-or-ref-data-members,\ -cppcoreguidelines-avoid-do-while,\ -cppcoreguidelines-avoid-magic-numbers,\ -cppcoreguidelines-avoid-non-const-global-variables,\ -cppcoreguidelines-c-copy-assignment-signature,\ -cppcoreguidelines-init-variables,\ -cppcoreguidelines-macro-usage,\ -cppcoreguidelines-narrowing-conversions,\ -cppcoreguidelines-non-private-member-variables-in-classes,\ -cppcoreguidelines-owning-memory,\ # TODO -cppcoreguidelines-prefer-member-initializer,\ -cppcoreguidelines-pro-bounds-constant-array-index,\ -cppcoreguidelines-pro-bounds-array-to-pointer-decay,\ # false positive? -cppcoreguidelines-pro-bounds-pointer-arithmetic,\ -cppcoreguidelines-pro-type-const-cast,\ -cppcoreguidelines-pro-type-cstyle-cast,\ -cppcoreguidelines-pro-type-member-init,\ -cppcoreguidelines-pro-type-reinterpret-cast,\ -cppcoreguidelines-pro-type-static-cast-downcast,\ -cppcoreguidelines-pro-type-union-access,\ -cppcoreguidelines-pro-type-vararg,\ -cppcoreguidelines-special-member-functions,\ # TODO (mostly fixed) -cppcoreguidelines-virtual-class-destructor,\ -google-explicit-constructor,\ -google-readability-braces-around-statements,\ -google-readability-casting,\ -google-readability-namespace-comments,\ -google-readability-todo,\ -google-runtime-int,\ # TODO -google-default-arguments,\ -hicpp-special-member-functions,\ -hicpp-braces-around-statements,\ -hicpp-explicit-conversions,\ -hicpp-use-auto,\ -hicpp-uppercase-literal-suffix,\ -hicpp-avoid-c-arrays,\ -hicpp-member-init,-hicpp-vararg,\ -hicpp-no-array-decay,\ -hicpp-signed-bitwise,\ -modernize-pass-by-value,\ -modernize-use-auto,\ -modernize-use-nodiscard,\ -modernize-use-trailing-return-type,\ -performance-unnecessary-value-param,\ -readability-braces-around-statements,\ -readability-convert-member-functions-to-static,\ -readability-function-cognitive-complexity,\ -readability-identifier-length,\ -readability-implicit-bool-conversion,\ -readability-magic-numbers,\ -readability-redundant-access-specifiers,\ -readability-suspicious-call-argument,\ -readability-uppercase-literal-suffix,\ \ # TODO -modernize-avoid-c-arrays,\ -readability-use-anyofallof,\ ' WarningsAsErrors: "*" HeaderFilterRegex: '.*' FormatStyle: file UseColor: true CheckOptions: - key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor value: 1 - key: cppcoreguidelines-special-member-functions.AllowMissingMoveFunctionsWhenCopyIsDeleted value: 1 mygui-3.4.3+dfsg/.clang-tidy-ignore000066400000000000000000000000331451556753500171230ustar00rootroot00000000000000*/include/GL/* */pugixml.* mygui-3.4.3+dfsg/.git-blame-ignore-revs000066400000000000000000000002351451556753500177120ustar00rootroot00000000000000# apply clang-tidy modernize-concat-nested-namespaces 3eb430ff539a61ea58a984a2284f4a3ade6ce6f4 # apply clang-format e19a011076024ad0c05e8413e6129879099216e8 mygui-3.4.3+dfsg/.gitattributes000066400000000000000000000000131451556753500164770ustar00rootroot00000000000000* text=automygui-3.4.3+dfsg/.gitignore000066400000000000000000000000241451556753500155760ustar00rootroot00000000000000.idea build cmake-* mygui-3.4.3+dfsg/.travis.yml000066400000000000000000000020161451556753500157220ustar00rootroot00000000000000language: cpp dist: focal compiler: - gcc - clang env: # - RENDER_SYSTEM=3 BUILD_DEMOS_AND_TOOLS=TRUE # Ogre3D Platform - RENDER_SYSTEM=4 BUILD_DEMOS_AND_TOOLS=TRUE # OpenGL Platform - RENDER_SYSTEM=7 BUILD_DEMOS_AND_TOOLS=TRUE # OpenGL3 Platform branches: only: - master before_install: - pwd - git submodule update --init --recursive - sudo apt-get update -qq - sudo apt-get install -qq cmake libfreetype6-dev graphviz libgl1-mesa-dev libglew-dev doxygen python cppcheck libsdl2-dev libsdl2-image-dev before_script: - mkdir build - cd build - cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DMYGUI_HIGH_LEVEL_WARNINGS=TRUE -DMYGUI_RENDERSYSTEM=$RENDER_SYSTEM -DMYGUI_BUILD_DEMOS=$BUILD_DEMOS_AND_TOOLS -DMYGUI_BUILD_TOOLS=$BUILD_DEMOS_AND_TOOLS -DMYGUI_BUILD_UNITTESTS=$BUILD_DEMOS_AND_TOOLS .. script: - make -j2 after_script: - cd .. - python ./Scripts/cppcheck/cppcheck.py notifications: email: recipients: - psi29a+travis.ci@gmail.com - altren@gmail.com on_success: change on_failure: always mygui-3.4.3+dfsg/AUTHORS000066400000000000000000000002211451556753500146550ustar00rootroot00000000000000AUTHORS ======= Main developers: Albert Semenov ( my.name ) George Evmenov ( Altren ) Contributors: https://www.ohloh.net/p/MyGUI/contributors mygui-3.4.3+dfsg/CMake/000077500000000000000000000000001451556753500145725ustar00rootroot00000000000000mygui-3.4.3+dfsg/CMake/CMakeLists.txt000066400000000000000000000014241451556753500173330ustar00rootroot00000000000000############################################################# # Install useful CMake modules. # These are necessary to compile the samples from the install # directory, but can also be used for custom projects. ############################################################# if(WIN32) set(MYGUI_CMAKE_DIR "CMake") else(WIN32) set(MYGUI_CMAKE_DIR "lib/MYGUI/cmake") endif(WIN32) set(INST_FILES Packages/FindOGRE.cmake Utils/FindPkgMacros.cmake Utils/PreprocessorUtils.cmake Utils/MyGUIConfigTargets.cmake Utils/MyGUIGetVersion.cmake ) set(STATIC_INST_FILES Packages/FindDirectX.cmake Packages/FindDirectX11.cmake ) #install(FILES ${INST_FILES} DESTINATION ${MYGUI_CMAKE_DIR}) if (MYGUI_STATIC) install(FILES ${STATIC_INST_FILES} DESTINATION ${MYGUI_CMAKE_DIR}) endif () mygui-3.4.3+dfsg/CMake/ConfigureBuild.cmake000066400000000000000000000034101451556753500204730ustar00rootroot00000000000000####################################################################### # This file takes care of configuring MyGUI to build with the settings # given in CMake. It creates the necessary config.h file and will # also prepare package files for pkg-config and CMake. ####################################################################### include(GNUInstallDirs) # should we build static libs? if (MYGUI_STATIC) set(MYGUI_LIB_TYPE STATIC) else () set(MYGUI_LIB_TYPE SHARED) endif () set(MYGUI_STATIC_LIB 0) if (MYGUI_STATIC) set(MYGUI_STATIC_LIB 1) add_definitions(-DMYGUI_STATIC) endif() if (WIN32) configure_file(${MYGUI_TEMPLATES_DIR}/updateListFiles.bat.in ${MYGUI_BINARY_DIR}/updateListFiles.bat) endif () # Create the pkg-config package files on Unix systems if (UNIX) set(MYGUI_LIB_SUFFIX "") set(MYGUI_PLUGIN_PREFIX "") set(MYGUI_PLUGIN_EXT ".so") if (MYGUI_STATIC) set(MYGUI_LIB_SUFFIX "${MYGUI_LIB_SUFFIX}Static") set(MYGUI_PLUGIN_PREFIX "lib") set(MYGUI_PLUGIN_EXT ".a") endif () string(TOLOWER "${CMAKE_BUILD_TYPE}" MYGUI_BUILD_TYPE) if (MYGUI_BUILD_TYPE STREQUAL "debug") set(MYGUI_LIB_SUFFIX "${MYGUI_LIB_SUFFIX}_d") endif () set(MYGUI_ADDITIONAL_LIBS "") set(MYGUI_CFLAGS "") set(MYGUI_PREFIX_PATH ${CMAKE_INSTALL_PREFIX}) set(MYGUI_ADDITIONAL_LIBS "${MYGUI_ADDITIONAL_LIBS}") if (MYGUI_STATIC) configure_file(${MYGUI_TEMPLATES_DIR}/MYGUIStatic.pc.in ${MYGUI_BINARY_DIR}/pkgconfig/MYGUI${MYGUI_LIB_SUFFIX}.pc @ONLY) else () configure_file(${MYGUI_TEMPLATES_DIR}/MYGUI.pc.in ${MYGUI_BINARY_DIR}/pkgconfig/MYGUI${MYGUI_LIB_SUFFIX}.pc @ONLY) endif () install(FILES ${MYGUI_BINARY_DIR}/pkgconfig/MYGUI${MYGUI_LIB_SUFFIX}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) # configure additional packages endif () mygui-3.4.3+dfsg/CMake/Dependencies.cmake000066400000000000000000000064101451556753500201630ustar00rootroot00000000000000####################################################################### # Find all necessary and optional MYGUI dependencies ####################################################################### # MYGUI_DEPENDENCIES_DIR can be used to specify a single base # folder where the required dependencies may be found. set(MYGUI_DEPENDENCIES_DIR "Dependencies" CACHE PATH "Path to prebuilt MYGUI dependencies") include(FindPkgMacros) getenv_path(MYGUI_DEPENDENCIES_DIR) set(MYGUI_DEP_SEARCH_PATH ${MYGUI_DEPENDENCIES_DIR} ${ENV_MYGUI_DEPENDENCIES_DIR} "${MYGUI_BINARY_DIR}/Dependencies" "${MYGUI_SOURCE_DIR}/Dependencies" "${MYGUI_BINARY_DIR}/../Dependencies" "${MYGUI_SOURCE_DIR}/../Dependencies" ) # Set hardcoded path guesses for various platforms if (UNIX) set(MYGUI_DEP_SEARCH_PATH ${MYGUI_DEP_SEARCH_PATH} /usr/local) endif () # give guesses as hints to the find_package calls set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${MYGUI_DEP_SEARCH_PATH}) set(CMAKE_FRAMEWORK_PATH ${CMAKE_FRAMEWORK_PATH} ${MYGUI_DEP_SEARCH_PATH}) if (WIN32) include(MyGUIInstallDependencies) endif () ####################################################################### # Core dependencies ####################################################################### if (MYGUI_USE_FREETYPE) # Find FreeType find_package(Freetype) macro_log_feature(FREETYPE_FOUND "freetype" "Portable font engine" "http://www.freetype.org" TRUE "" "") find_package(ZLIB) endif() ####################################################################### # RenderSystem dependencies ####################################################################### find_package(SDL2) if(MYGUI_RENDERSYSTEM EQUAL 3) # Find OGRE find_package(OGRE_Old) macro_log_feature(OGRE_FOUND "ogre" "Support for the Ogre render system" "" TRUE "" "") elseif(MYGUI_RENDERSYSTEM EQUAL 4 OR MYGUI_RENDERSYSTEM EQUAL 7) find_package(SDL2_image) if(POLICY CMP0072) cmake_policy(SET CMP0072 OLD) endif() if(MYGUI_USE_SYSTEM_GLEW) find_package(OpenGL COMPONENTS OpenGL) find_package(GLEW) macro_log_feature(GLEW_FOUND "GLEW" "OpenGL Extension Wrangler Library" "" TRUE "" "") else() if(WIN32 OR APPLE) find_package(OpenGL COMPONENTS OpenGL) else() find_package(OpenGL COMPONENTS OpenGL GLX) endif() endif() macro_log_feature(OPENGL_FOUND "opengl" "Support for the OpenGL render system" "" TRUE "" "") elseif(MYGUI_RENDERSYSTEM EQUAL 5) # Find DirectX if(WIN32) find_package(DirectX) macro_log_feature(DirectX_FOUND "DirectX" "Support for the DirectX render system" "http://msdn.microsoft.com/en-us/directx/" TRUE "" "") endif() elseif(MYGUI_RENDERSYSTEM EQUAL 6) # Find DirectX11 if(WIN32) find_package(DirectX11) macro_log_feature(DirectX_FOUND "DirectX11" "Support for the DirectX11 render system" "http://msdn.microsoft.com/en-us/directx/" TRUE "" "") endif() #elseif for RENDERSYSTEM 7 is covered with RENDERSYSTEM 4 endif() ####################################################################### # Demos and tools optional dependencies ####################################################################### find_package(Doxygen) macro_log_feature(DOXYGEN_FOUND "Doxygen" "Tool for building API documentation" "http://doxygen.org" FALSE "" "") # Display results, terminate if anything required is missing MACRO_DISPLAY_FEATURE_LOG() mygui-3.4.3+dfsg/CMake/InstallResources.cmake000066400000000000000000000065461451556753500211100ustar00rootroot00000000000000################################################################## # Generate and install the config files needed for the samples ################################################################## function(install_file FILENAME) if (WIN32) install(FILES ${MYGUI_BINARY_DIR}/bin/debug/${FILENAME} DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH}" CONFIGURATIONS Debug ) install(FILES ${MYGUI_BINARY_DIR}/bin/release/${FILENAME} DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_RELEASE_PATH}" CONFIGURATIONS Release None "" ) install(FILES ${MYGUI_BINARY_DIR}/bin/release/${FILENAME} DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo ) install(FILES ${MYGUI_BINARY_DIR}/bin/release/${FILENAME} DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel ) else () install(FILES ${MYGUI_BINARY_DIR}/bin/${FILENAME} DESTINATION "bin" ) endif () endfunction(install_file) # install resource files if (MYGUI_INSTALL_DEMOS OR MYGUI_INSTALL_TOOLS) if (MYGUI_RENDERSYSTEM EQUAL 3) # copy plugins.cfg if (DEFINED OGRE_CONFIG_DIR) if (WIN32) if(EXISTS ${OGRE_CONFIG_DIR}/plugins_d.cfg) configure_file(${OGRE_CONFIG_DIR}/plugins_d.cfg ${MYGUI_BINARY_DIR}/bin/debug/plugins.cfg) else() file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg DESTINATION ${MYGUI_BINARY_DIR}/bin/debug/) endif () file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg DESTINATION ${MYGUI_BINARY_DIR}/bin/release/) file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg DESTINATION ${MYGUI_BINARY_DIR}/bin/relwithdebinfo/) file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg DESTINATION ${MYGUI_BINARY_DIR}/bin/minsizerel/) else() file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg DESTINATION ${MYGUI_BINARY_DIR}/bin/) endif() endif() endif () if (WIN32) set(MYGUI_MEDIA_DIR "../../Media") elseif (UNIX) set(MYGUI_MEDIA_DIR "../share/MYGUI/Media") else () set(MYGUI_MEDIA_DIR "../../Media") endif () if (WIN32) # create resources.xml configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/debug/resources.xml) configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/release/resources.xml) else() # other OS only need one cfg file # create resources.xml configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/resources.xml) endif () install_file (resources.xml) if (MYGUI_RENDERSYSTEM EQUAL 3) install_file (plugins.cfg) endif () else () set(MYGUI_MEDIA_DIR "${MYGUI_SOURCE_DIR}/Media") if (EMSCRIPTEN) set(MYGUI_MEDIA_DIR "/Media") endif () if (WIN32) # create resources.xml configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/debug/resources.xml) configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/release/resources.xml) configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/relwithdebinfo/resources.xml) configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/minsizerel/resources.xml) else() # other OS only need one cfg file string(TOLOWER "${CMAKE_BUILD_TYPE}" MYGUI_BUILD_TYPE) if (MYGUI_BUILD_TYPE STREQUAL "debug" AND NOT APPLE) set(MYGUI_CFG_SUFFIX "_d") endif () # create resources.xml configure_file(${MYGUI_TEMPLATES_DIR}/resources.xml.in ${MYGUI_BINARY_DIR}/bin/resources.xml) endif () endif () mygui-3.4.3+dfsg/CMake/MyGUIInstallDependencies.cmake000066400000000000000000000052571451556753500223750ustar00rootroot00000000000000##################################################### # Install dependencies on Windows ##################################################### function(install_dll_file DEBUG_FILEPATH RELEASE_FILEPATH FILENAME) if (EXISTS ${DEBUG_FILEPATH}${FILENAME}_d.dll) install(FILES ${DEBUG_FILEPATH}${FILENAME}_d.dll DESTINATION bin/debug CONFIGURATIONS Debug ) install(FILES ${RELEASE_FILEPATH}${FILENAME}.dll DESTINATION bin/release CONFIGURATIONS Release None "" ) install(FILES ${RELEASE_FILEPATH}${FILENAME}.dll DESTINATION bin/relwithdebinfo CONFIGURATIONS RelWithDebInfo ) install(FILES ${RELEASE_FILEPATH}${FILENAME}.dll DESTINATION bin/minsizerel CONFIGURATIONS MinSizeRel ) configure_file(${DEBUG_FILEPATH}${FILENAME}_d.dll ${MYGUI_BINARY_DIR}/bin/debug/${FILENAME}_d.dll COPYONLY) configure_file(${RELEASE_FILEPATH}${FILENAME}.dll ${MYGUI_BINARY_DIR}/bin/release/${FILENAME}.dll COPYONLY) configure_file(${RELEASE_FILEPATH}${FILENAME}.dll ${MYGUI_BINARY_DIR}/bin/relwithdebinfo/${FILENAME}.dll COPYONLY) configure_file(${RELEASE_FILEPATH}${FILENAME}.dll ${MYGUI_BINARY_DIR}/bin/minsizerel/${FILENAME}.dll COPYONLY) endif () endfunction(install_dll_file) if (MYGUI_DEPENDENCIES_DIR STREQUAL "") set(MYGUI_DEP_BIN_DIR ${MYGUI_SOURCE_DIR}/Dependencies/bin) else () set(MYGUI_DEP_BIN_DIR ${MYGUI_DEPENDENCIES_DIR}/bin) endif () option(MYGUI_TRY_TO_COPY_DLLS "Copy dlls needed for sample builds" TRUE) if (MYGUI_TRY_TO_COPY_DLLS) # copy the dependency DLLs to the right places # TODO copy SDL2.dll # install_dll_file(${MYGUI_DEP_BIN_DIR}/debug/ ${MYGUI_DEP_BIN_DIR}/release/ SDL2) if (MYGUI_RENDERSYSTEM EQUAL 3) if (EXISTS ${OGRE_LIB_DIR}/../bin/debug/OgreMain_d.dll) set(DEBUG_DLLS_DIR ${OGRE_LIB_DIR}/../bin/debug) set(RELEASE_DLLS_DIR ${OGRE_LIB_DIR}/../bin/release) MESSAGE(STATUS " DLL's were copied from bin") elseif (EXISTS "${OGRE_LIB_DIR}/OgreMain_d.dll") set(DEBUG_DLLS_DIR ${OGRE_LIB_DIR}) set(RELEASE_DLLS_DIR ${OGRE_LIB_DIR}) MESSAGE(STATUS " DLL's were copied from lib") elseif (EXISTS ${OGRE_SOUCE_DIR}/bin/debug/OgreMain_d.dll) set(DEBUG_DLLS_DIR ${OGRE_SOUCE_DIR}/bin/debug) set(RELEASE_DLLS_DIR ${OGRE_SOUCE_DIR}/bin/release) MESSAGE(STATUS " DLL's were copied from sdk's bin") elseif (EXISTS ${OGRE_BUILD}/bin/debug/OgreMain_d.dll) set(DEBUG_DLLS_DIR ${OGRE_BUILD}/bin/debug) set(RELEASE_DLLS_DIR ${OGRE_BUILD}/bin/release) MESSAGE(STATUS " DLL's were copied from build bin") else () set(DEBUG_DLLS_DIR "") set(RELEASE_DLLS_DIR "") MESSAGE(ERROR " compiled OGRE DLL's wasn't found") endif () install_dll_file(${DEBUG_DLLS_DIR}/ ${RELEASE_DLLS_DIR}/ OgreMain) endif () endif () mygui-3.4.3+dfsg/CMake/Packages/000077500000000000000000000000001451556753500163105ustar00rootroot00000000000000mygui-3.4.3+dfsg/CMake/Packages/FindDirectX.cmake000066400000000000000000000106311451556753500214560ustar00rootroot00000000000000# ----------------------------------------------------------------------------- # Find DirectX SDK # Define: # DirectX_FOUND # DirectX_INCLUDE_DIR # DirectX_LIBRARY IF (NOT DIRECTX_DIR) set(DIRECTX_DIR "" CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)") ENDIF () if(WIN32) # The only platform it makes sense to check for DirectX SDK include(FindPkgMacros) findpkg_begin(DirectX) # Get path, convert backslashes as ${ENV_DXSDK_DIR} getenv_path(DXSDK_DIR) # construct search paths set(DirectX_PREFIX_PATH "${DIRECTX_DIR}" "${DXSDK_DIR}" "${ENV_DXSDK_DIR}" "C:/apps_x86/Microsoft DirectX SDK*" "C:/Program Files (x86)/Microsoft DirectX SDK*" "C:/apps/Microsoft DirectX SDK*" "C:/Program Files/Microsoft DirectX SDK*" "$ENV{ProgramFiles}/Microsoft DirectX SDK*" ) create_search_paths(DirectX) # redo search if prefix path changed clear_if_changed(DirectX_PREFIX_PATH DirectX_LIBRARY DirectX_INCLUDE_DIR ) find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH}) # dlls are in DIRECTX_DIR/Developer Runtime/x64|x86 # lib files are in DIRECTX_DIR/Lib/x64|x86 if(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x64") else(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x86") endif(CMAKE_CL_64) find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXERR9_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) if(DirectX_INCLUDE_DIR) if (NOT DIRECTX_DIR) set(DIRECTX_DIR ${DirectX_INCLUDE_DIR}/.. CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)" FORCE) endif () endif(DirectX_INCLUDE_DIR) findpkg_finish(DirectX) set(DirectX_LIBRARIES ${DirectX_LIBRARIES} ${DirectX_D3DX9_LIBRARY} ${DirectX_DXERR9_LIBRARY} ${DirectX_DXGUID_LIBRARY} ) endif(WIN32) if(WIN32) # The only platform it makes sense to check for DirectX11 SDK include(FindPkgMacros) findpkg_begin(DirectX11) # Get path, convert backslashes as ${ENV_DXSDK_DIR} getenv_path(DXSDK_DIR) # construct search paths set(DirectX_PREFIX_PATH "${DIRECTX_DIR}" "${DXSDK_DIR}" "${ENV_DXSDK_DIR}" "C:/apps_x86/Microsoft DirectX SDK*" "C:/Program Files (x86)/Microsoft DirectX SDK*" "C:/apps/Microsoft DirectX SDK*" "C:/Program Files/Microsoft DirectX SDK*" "$ENV{ProgramFiles}/Microsoft DirectX SDK*" ) create_search_paths(DirectX) # redo search if prefix path changed clear_if_changed(DirectX_PREFIX_PATH DirectX11_LIBRARY DirectX11_INCLUDE_DIR ) find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS ${DirectX_INC_SEARCH_PATH}) # dlls are in DIRECTX_DIR/Developer Runtime/x64|x86 # lib files are in DIRECTX_DIR/Lib/x64|x86 if(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x64") else(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x86") endif(CMAKE_CL_64) find_library(DirectX11_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXERR_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_COMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) if(DirectX11_INCLUDE_DIR) if (NOT DIRECTX_DIR) set(DIRECTX_DIR ${DirectX11_INCLUDE_DIR}/.. CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)" FORCE) endif () endif(DirectX11_INCLUDE_DIR) findpkg_finish(DirectX11) set(DirectX11_LIBRARIES ${DirectX11_LIBRARIES} ${DirectX11_D3D11_LIBRARY} ${DirectX11_D3DX11_LIBRARY} ${DirectX11_DXGI_LIBRARY} ${DirectX11_DXGUID_LIBRARY} ${DirectX11_DXERR_LIBRARY} ${DirectX11_COMPILER_LIBRARY} ) endif(WIN32) mygui-3.4.3+dfsg/CMake/Packages/FindDirectX11.cmake000066400000000000000000000026701451556753500216240ustar00rootroot00000000000000# ----------------------------------------------------------------------------- # Find DirectX11 SDK # Define: # DirectX11_FOUND # DirectX_INCLUDE_DIR # DirectX_LIBRARY if(WIN32) # The only platform it makes sense to check for DirectX11 SDK include(FindPkgMacros) include(FindDirectX) findpkg_begin(DirectX11) if(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x64") else(CMAKE_CL_64) set(DirectX_LIBPATH_SUFFIX "x86") endif(CMAKE_CL_64) find_library(DirectX11_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_DXERR_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) find_library(DirectX11_COMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX}) findpkg_finish(DirectX11) set(DirectX11_LIBRARIES ${DirectX11_LIBRARIES} ${DirectX11_D3D11_LIBRARY} ${DirectX11_D3DX11_LIBRARY} ${DirectX11_DXGI_LIBRARY} ${DirectX11_DXGUID_LIBRARY} ${DirectX11_DXERR_LIBRARY} ${DirectX11_COMPILER_LIBRARY} ) endif(WIN32) mygui-3.4.3+dfsg/CMake/Packages/FindOGRE_Old.cmake000066400000000000000000000114261451556753500214510ustar00rootroot00000000000000# Find OGRE includes and library # # This module defines # OGRE_INCLUDE_DIR # OGRE_LIBRARIES, the libraries to link against to use OGRE. # OGRE_LIB_DIR, the location of the libraries # OGRE_FOUND, If false, do not try to use OGRE include(FindPkgMacros) if (NOT OGRE_FOUND) # Then try everything else IF (NOT OGRE_SOURCE_DIR) set(OGRE_SOURCE_DIR "" CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)") ENDIF () if (NOT OGRE_BUILD) set(OGRE_BUILD ${OGRE_SOURCE_DIR} CACHE PATH "Path to Ogre build directory (same as OGRE_SOURCE_DIR by default)") endif () if (NOT ${OGRE_SOURCE_DIR} STREQUAL "") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OGRE_SOURCE_DIR}/CMake ${OGRE_SOURCE_DIR}/CMake/Packages) endif() if (NOT (WIN32 OR APPLE)) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /usr/lib/OGRE/cmake/ /usr/local/lib/OGRE/cmake /usr/share/OGRE/cmake/modules /usr/local/share/OGRE/cmake/modules) endif() if (EXISTS ${OGRE_SOURCE_DIR}/CMake) MESSAGE(STATUS "Original FindOGRE.cmake found in OGRE_SOURCE_DIR, trying to use it") set (OGRE_HOME ${OGRE_SOURCE_DIR}) FIND_PACKAGE(OGRE) else() FIND_PACKAGE(OGRE) endif() if (OGRE_FOUND) MESSAGE(STATUS "Ogre was found with it's own CMake script") set(BOOST_ROOT ${BOOST_ROOT} CACHE PATH "Path to Boost (required if Ogre was built with boost)") FIND_PACKAGE(Boost) if (Boost_FOUND) set (OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} ${Boost_INCLUDE_DIR}) set (OGRE_LIB_DIR ${OGRE_LIB_DIR} ${Boost_LIBRARY_DIRS} ${BOOST_LIBRARYDIR}) else() # trying to get boost from OGRE_SOURCE_DIR set (OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} ${OGRE_SOURCE_DIR}/boost) set (OGRE_LIB_DIR ${OGRE_LIB_DIR} ${OGRE_SOURCE_DIR}/boost/lib) endif() #add_definitions("-DBOOST_ALL_NO_LIB") return() endif () # now trying to find it by our script CMAKE_POLICY(PUSH) IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR) SET(OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR) IF (WIN32) #Windows MESSAGE(STATUS "Looking for OGRE") SET(OGRESDK $ENV{OGRE_HOME}) SET(OGRESOURCE $ENV{OGRE_SRC}) IF (OGRE_SOURCE_DIR) MESSAGE(STATUS "Using OGRE built from source (from specified path)") SET(OGRE_INCLUDE_DIR ${OGRE_SOURCE_DIR}/OgreMain/include ${OGRE_SOURCE_DIR}/include) SET(OGRE_LIB_DIR ${OGRE_SOURCE_DIR}/lib) ELSEIF (OGRESDK) MESSAGE(STATUS "Using OGRE SDK") STRING(REGEX REPLACE "[\\]" "/" OGRESDK "${OGRESDK}") SET(OGRE_INCLUDE_DIR ${OGRESDK}/include/OGRE ${OGRESDK}/include) SET(OGRE_LIB_DIR ${OGRESDK}/lib) IF (NOT OGRE_SOURCE_DIR) set(OGRE_SOURCE_DIR $ENV{OGRE_HOME} CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)") ENDIF () ELSEIF (OGRESOURCE) MESSAGE(STATUS "Using OGRE built from source") SET(OGRE_INCLUDE_DIR $ENV{OGRE_SRC}/OgreMain/include ${OGRE_SOURCE_DIR}/include) SET(OGRE_LIB_DIR $ENV{OGRE_SRC}/lib) IF (NOT OGRE_SOURCE_DIR) set(OGRE_SOURCE_DIR $ENV{OGRE_SRC} CACHE PATH "Path to Ogre sources (set it if you don't have OGRE_HOME or OGRE_SRC environment variables)") ENDIF () ENDIF () IF (OGRESDK OR OGRESOURCE OR OGRE_SOURCE_DIR) SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain) SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "") SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "") SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "") ENDIF () ELSE (WIN32) #Unix IF (OGRE_SOURCE_DIR) MESSAGE(STATUS "Using OGRE built from source (from specified path)") SET(OGRE_INCLUDE_DIR ${OGRE_SOURCE_DIR}/OgreMain/include) SET(OGRE_LIB_DIR ${OGRE_SOURCE_DIR}/lib) ELSE () CMAKE_MINIMUM_REQUIRED(VERSION 2.4.7 FATAL_ERROR) FIND_PACKAGE(PkgConfig) PKG_SEARCH_MODULE(OGRE OGRE) SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS}) SET(OGRE_LIB_DIR ${OGRE_LIBDIR}) ENDIF () SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "") SET(OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "") SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "") ENDIF (WIN32) # compatibility with CMakeConfig script SET(OGRE_LIB_DIR ${OGRE_LIB_DIR} ${OGRE_LIBRARY_DIRS}) IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES) SET(OGRE_FOUND TRUE) ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES) IF (OGRE_FOUND) # compatibility with CMakeConfig script IF(NOT OGRE_CONFIG_DIR) IF(WIN32) SET(OGRE_CONFIG_DIR "${OGRE_MEDIA_DIR}/../bin/") ELSE() SET(OGRE_CONFIG_DIR "${OGRE_MEDIA_DIR}/../") ENDIF() ENDIF() IF (NOT OGRE_FIND_QUIETLY) MESSAGE(STATUS " libraries : ${OGRE_LIBRARIES} from ${OGRE_LIB_DIR}") MESSAGE(STATUS " includes : ${OGRE_INCLUDE_DIR}") ENDIF (NOT OGRE_FIND_QUIETLY) ELSE (OGRE_FOUND) IF (OGRE_FIND_REQUIRED) MESSAGE(FATAL_ERROR "Could not find OGRE") ENDIF (OGRE_FIND_REQUIRED) ENDIF (OGRE_FOUND) CMAKE_POLICY(POP) endif() mygui-3.4.3+dfsg/CMake/Packages/FindSDL2.cmake000066400000000000000000000101311451556753500206130ustar00rootroot00000000000000# Find module for SDL 2.0 (http://www.libsdl.org/). # It defines the following variables: # SDL2_INCLUDE_DIRS - The location of the headers, e.g., SDL.h. # SDL2_LIBRARIES - The libraries to link against to use SDL2. # SDL2_FOUND - If false, do not try to use SDL2. # SDL2_VERSION_STRING - Human-readable string containing the version of SDL2. # # This module responds to the the flag: # SDL2_BUILDING_LIBRARY # If this is defined, then no SDL2_main will be linked in because # only applications need main(). # Otherwise, it is assumed you are building an application and this # module will attempt to locate and set the the proper link flags # as part of the returned SDL2_LIBRARIES variable. # # Also defined, but not for general use are: # SDL2_INCLUDE_DIR - The directory that contains SDL.h. # SDL2_LIBRARY - The location of the SDL2 library. # SDL2MAIN_LIBRARY - The location of the SDL2main library. # #============================================================================= # Copyright 2013 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(FindPkgMacros) IF(NOT SDL2_FOUND) # Then try everything else CMAKE_POLICY(PUSH) find_package(PkgConfig QUIET) pkg_check_modules(PC_SDL2 QUIET sdl2) find_path(SDL2_INCLUDE_DIR NAMES SDL.h HINTS ${PC_SDL2_INCLUDEDIR} ${PC_SDL2_INCLUDE_DIRS} PATH_SUFFIXES SDL2 ) find_library(SDL2_LIBRARY NAMES SDL2 HINTS ${PC_SDL2_LIBDIR} ${PC_SDL2_LIBRARY_DIRS} PATH_SUFFIXES x64 x86 ) set(SDL2_BUILDING_LIBRARY TRUE) if(NOT SDL2_BUILDING_LIBRARY) find_library(SDL2MAIN_LIBRARY NAMES SDL2main HINTS ${PC_SDL2_LIBDIR} ${PC_SDL2_LIBRARY_DIRS} PATH_SUFFIXES x64 x86 ) endif() if(SDL2_INCLUDE_DIR AND EXISTS "${SDL2_INCLUDE_DIR}/SDL_version.h") file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+[0-9]+$") file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MINOR_VERSION[ \t]+[0-9]+$") file(STRINGS "${SDL2_INCLUDE_DIR}/SDL_version.h" SDL2_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_PATCHLEVEL[ \t]+[0-9]+$") string(REGEX REPLACE "^#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MAJOR "${SDL2_VERSION_MAJOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_MINOR "${SDL2_VERSION_MINOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_VERSION_PATCH "${SDL2_VERSION_PATCH_LINE}") set(SDL2_VERSION_STRING ${SDL2_VERSION_MAJOR}.${SDL2_VERSION_MINOR}.${SDL2_VERSION_PATCH}) unset(SDL2_VERSION_MAJOR_LINE) unset(SDL2_VERSION_MINOR_LINE) unset(SDL2_VERSION_PATCH_LINE) unset(SDL2_VERSION_MAJOR) unset(SDL2_VERSION_MINOR) unset(SDL2_VERSION_PATCH) endif() set(SDL2_INCLUDE_DIRS ${SDL2_INCLUDE_DIR}) set(SDL2_LIBRARIES ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY}) if (WIN32) set(SDL2_LIBRARIES ${SDL2_LIBRARIES} winmm imm32 version) endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SDL2 REQUIRED_VARS SDL2_INCLUDE_DIR SDL2_LIBRARY VERSION_VAR SDL2_VERSION_STRING) mark_as_advanced(SDL2_INCLUDE_DIR SDL2_LIBRARY) add_library(SDL2::Main INTERFACE IMPORTED) set_target_properties( SDL2::Main PROPERTIES INTERFACE_LINK_LIBRARIES "${SDL2_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${SDL2_INCLUDE_DIR}" ) CMAKE_POLICY(POP) ENDIF(NOT SDL2_FOUND) mygui-3.4.3+dfsg/CMake/Packages/FindSDL2_image.cmake000066400000000000000000000070131451556753500217620ustar00rootroot00000000000000# Find module for SDL_image 2.0 (http://www.libsdl.org/projects/SDL_image/). # It defines the following variables: # SDL2_IMAGE_INCLUDE_DIRS - The location of the headers, e.g., SDL_image.h. # SDL2_IMAGE_LIBRARIES - The libraries to link against to use SDL2_image. # SDL2_IMAGE_FOUND - If false, do not try to use SDL2_image. # SDL2_IMAGE_VERSION_STRING # Human-readable string containing the version of SDL2_image. # # Also defined, but not for general use are: # SDL2_IMAGE_INCLUDE_DIR - The directory that contains SDL_image.h. # SDL2_IMAGE_LIBRARY - The location of the SDL2_image library. # #============================================================================= # Copyright 2013 Benjamin Eikel # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. # # This software is distributed WITHOUT ANY WARRANTY; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) include(FindPkgMacros) IF(NOT SDL2_IMAGE_FOUND) # Then try everything else CMAKE_POLICY(PUSH) find_package(PkgConfig QUIET) pkg_check_modules(PC_SDL2_IMAGE QUIET SDL2_image) find_path(SDL2_IMAGE_INCLUDE_DIR NAMES SDL_image.h HINTS ${PC_SDL2_IMAGE_INCLUDEDIR} ${PC_SDL2_IMAGE_INCLUDE_DIRS} PATH_SUFFIXES SDL2 ) find_library(SDL2_IMAGE_LIBRARY NAMES SDL2_image HINTS ${PC_SDL2_IMAGE_LIBDIR} ${PC_SDL2_IMAGE_LIBRARY_DIRS} PATH_SUFFIXES x64 x86 ) if(SDL2_IMAGE_INCLUDE_DIR AND EXISTS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h") file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+[0-9]+$") file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+[0-9]+$") file(STRINGS "${SDL2_IMAGE_INCLUDE_DIR}/SDL_image.h" SDL2_IMAGE_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+[0-9]+$") string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MAJOR "${SDL2_IMAGE_VERSION_MAJOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_MINOR "${SDL2_IMAGE_VERSION_MINOR_LINE}") string(REGEX REPLACE "^#define[ \t]+SDL_IMAGE_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_IMAGE_VERSION_PATCH "${SDL2_IMAGE_VERSION_PATCH_LINE}") set(SDL2_IMAGE_VERSION_STRING ${SDL2_IMAGE_VERSION_MAJOR}.${SDL2_IMAGE_VERSION_MINOR}.${SDL2_IMAGE_VERSION_PATCH}) unset(SDL2_IMAGE_VERSION_MAJOR_LINE) unset(SDL2_IMAGE_VERSION_MINOR_LINE) unset(SDL2_IMAGE_VERSION_PATCH_LINE) unset(SDL2_IMAGE_VERSION_MAJOR) unset(SDL2_IMAGE_VERSION_MINOR) unset(SDL2_IMAGE_VERSION_PATCH) endif() set(SDL2_IMAGE_INCLUDE_DIRS ${SDL2_IMAGE_INCLUDE_DIR}) set(SDL2_IMAGE_LIBRARIES ${SDL2_IMAGE_LIBRARY}) include(FindPackageHandleStandardArgs) find_package_handle_standard_args(SDL2_image REQUIRED_VARS SDL2_IMAGE_INCLUDE_DIRS SDL2_IMAGE_LIBRARIES VERSION_VAR SDL2_IMAGE_VERSION_STRING) mark_as_advanced(SDL2_IMAGE_INCLUDE_DIR SDL2_IMAGE_LIBRARY) CMAKE_POLICY(POP) ENDIF(NOT SDL2_IMAGE_FOUND)mygui-3.4.3+dfsg/CMake/Packaging.cmake000066400000000000000000000040221451556753500174560ustar00rootroot00000000000000option(MYGUI_CREATE_PACKAGE "Create package." FALSE) if (MYGUI_CREATE_PACKAGE) set(CPACK_PACKAGE_VERSION ${MYGUI_VERSION}) set(CPACK_PACKAGE_VERSION_MAJOR ${MYGUI_VERSION_MAJOR}) set(CPACK_PACKAGE_VERSION_MINOR ${MYGUI_VERSION_MINOR}) set(CPACK_PACKAGE_VERSION_PATCH ${MYGUI_VERSION_PATCH}) set(CPACK_INSTALL_CMAKE_PROJECTS "${MYGUI_BINARY_DIR}" "MYGUI" "ALL" "/") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyGUI - fast, flexible and simple GUI") set(CPACK_PACKAGE_INSTALL_DIRECTORY "MYGUI") set(CPACK_PACKAGE_NAME "MYGUI") set(CPACK_PACKAGE_VENDOR "") set(CPACK_RESOURCE_FILE_LICENSE "${MYGUI_SOURCE_DIR}/COPYING.LESSER") set(CPACK_PACKAGE_CONTACT "MYGUI Team ") if (WIN32 AND NOT UNIX) set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "WriteRegStr \\\${WriteEnvStr_RegKey} \\\"MYGUI_HOME\\\" $INSTDIR") # There is a bug in NSIS that does not handle full unix paths properly. Make # sure there is at least one set of four (4) backlasshes. SET(CPACK_PACKAGE_ICON "${MYGUI_SOURCE_DIR}/Media/Common/Sources\\\\MyGUI_Logo.bmp") SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin/Debug\\\\LayoutEditor.exe") SET(CPACK_NSIS_MUI_ICON "Common/Base\\\\MyGUI.ico") SET(CPACK_NSIS_DISPLAY_NAME "MyGUI") SET(CPACK_NSIS_HELP_LINK "http://my-gui.sourceforge.net/") # SET(CPACK_NSIS_MENU_LINKS # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-gui.html" "cmake-gui Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake.html" "CMake Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-properties.html" # "CMake Properties and Variables Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/ctest.html" "CTest Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-modules.html" "CMake Modules Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cmake-commands.html" "CMake Commands Help" # "doc/cmake-@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@/cpack.html" "CPack Help" # "http://MyGUI.info" "MyGUI Web Site" # ) endif () include(CPack) endif () mygui-3.4.3+dfsg/CMake/Templates/000077500000000000000000000000001451556753500165305ustar00rootroot00000000000000mygui-3.4.3+dfsg/CMake/Templates/MYGUI.pc.in000066400000000000000000000005401451556753500203520ustar00rootroot00000000000000prefix=@MYGUI_PREFIX_PATH@ exec_prefix=${prefix} libdir=@CMAKE_INSTALL_FULL_LIBDIR@ includedir=${prefix}/include Name: MyGUI Description: Fast, flexible and simple GUI Version: @MYGUI_VERSION@ URL: http://mygui.info Libs: -L${libdir} -lMyGUIEngine@MYGUI_LIB_SUFFIX@ @MYGUI_ADDITIONAL_LIBS@ Cflags: -I${includedir} -I${includedir}/MYGUI @MYGUI_CFLAGS@ mygui-3.4.3+dfsg/CMake/Templates/MYGUIConfig.cmake.in000066400000000000000000000012641451556753500221620ustar00rootroot00000000000000# Find MYGUI includes and library # # This module defines # MYGUI_INCLUDE_DIRS # MYGUI_LIBRARIES, the libraries to link against to use MYGUI. # MYGUI_LIBRARY_DIRS, the location of the libraries # MYGUI_FOUND, If false, do not try to use MYGUI # include(FindPackageMessage) set(MYGUI_PREFIX_DIR "@CMAKE_INSTALL_PREFIX@") get_filename_component(MYGUI_LIBRARY_DIRS "${MYGUI_PREFIX_DIR}/lib" ABSOLUTE) get_filename_component(MYGUI_INCLUDE_DIRS "${MYGUI_PREFIX_DIR}/include/MYGUI" ABSOLUTE) set(MYGUI_LIBRARIES "MyGUIEngine") message(STATUS "Found MYGUI") message(STATUS " libraries : '${MYGUI_LIBRARIES}' from ${MYGUI_LIBRARY_DIRS}") message(STATUS " includes : ${MYGUI_INCLUDE_DIRS}") mygui-3.4.3+dfsg/CMake/Templates/MYGUIConfigVersion.cmake.in000066400000000000000000000016571451556753500235360ustar00rootroot00000000000000# MYGUI CMake package file # - check if package version satisfies requested version set(PACKAGE_VERSION @MYGUI_VERSION@) set(PACKAGE_VERSION_MAJOR @MYGUI_VERSION_MAJOR@) set(PACKAGE_VERSION_MINOR @MYGUI_VERSION_MINOR@) set(PACKAGE_VERSION_EXACT FALSE) set(PACKAGE_VERSION_COMPATIBLE FALSE) if(${PACKAGE_VERSION} VERSION_EQUAL ${PACKAGE_FIND_VERSION}) set(PACKAGE_VERSION_EXACT TRUE) set(PACKAGE_VERSION_COMPATIBLE TRUE) elseif(${PACKAGE_VERSION} VERSION_GREATER ${PACKAGE_FIND_VERSION}) # compatibility is only guaranteed if major and minor version numbers match if (PACKAGE_FIND_VERSION_MAJOR EQUAL ${PACKAGE_VERSION_MAJOR} AND PACKAGE_FIND_VERSION_MINOR EQUAL ${PACKAGE_VERSION_MINOR}) set(PACKAGE_VERSION_COMPATIBLE TRUE) endif (PACKAGE_FIND_VERSION_MAJOR EQUAL ${PACKAGE_VERSION_MAJOR} AND PACKAGE_FIND_VERSION_MINOR EQUAL ${PACKAGE_VERSION_MINOR}) endif(${PACKAGE_VERSION} VERSION_EQUAL ${PACKAGE_FIND_VERSION}) mygui-3.4.3+dfsg/CMake/Templates/MYGUIStatic.pc.in000066400000000000000000000005631451556753500215270ustar00rootroot00000000000000prefix=@MYGUI_PREFIX_PATH@ exec_prefix=${prefix} libdir=${prefix}/lib includedir=${prefix}/include Name: MyGUI (static lib) Description: Fast, flexible and simple GUI Version: @MYGUI_VERSION@ URL: http://mygui.info Requires: freetype2 Libs: -L${libdir} -lMyGUIEngine@MYGUI_LIB_SUFFIX@ @MYGUI_ADDITIONAL_LIBS@ Cflags: -I${includedir} -I${includedir}/MYGUI @MYGUI_CFLAGS@ mygui-3.4.3+dfsg/CMake/Templates/buildsettings.h.in000066400000000000000000000002141451556753500221630ustar00rootroot00000000000000#ifndef __Custom_Config_H_ #define __Custom_Config_H_ // CMake auto-generated configuration options #cmakedefine MYGUI_STATIC_LIB #endif mygui-3.4.3+dfsg/CMake/Templates/html.cfg.in000066400000000000000000000217631451556753500205730ustar00rootroot00000000000000# Doxyfile 1.5.3 #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- DOXYFILE_ENCODING = UTF-8 PROJECT_NAME = MYGUI PROJECT_NUMBER = ${MYGUI_VERSION} OUTPUT_DIRECTORY = ${MYGUI_BINARY_DIR}/api/ CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English BRIEF_MEMBER_DESC = YES REPEAT_BRIEF = YES ABBREVIATE_BRIEF = "The $name class " \ "The $name widget " \ "The $name file " \ is \ provides \ specifies \ contains \ represents \ a \ an \ the ALWAYS_DETAILED_SEC = YES INLINE_INHERITED_MEMB = YES FULL_PATH_NAMES = NO STRIP_FROM_PATH = STRIP_FROM_INC_PATH = SHORT_NAMES = NO JAVADOC_AUTOBRIEF = YES QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO DETAILS_AT_TOP = NO INHERIT_DOCS = YES SEPARATE_MEMBER_PAGES = NO TAB_SIZE = 4 ALIASES = OPTIMIZE_OUTPUT_FOR_C = NO OPTIMIZE_OUTPUT_JAVA = NO BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO DISTRIBUTE_GROUP_DOC = NO SUBGROUPING = YES #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- EXTRACT_ALL = YES EXTRACT_PRIVATE = YES EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO HIDE_UNDOC_MEMBERS = NO HIDE_UNDOC_CLASSES = NO HIDE_FRIEND_COMPOUNDS = NO HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO CASE_SENSE_NAMES = YES HIDE_SCOPE_NAMES = NO SHOW_INCLUDE_FILES = YES INLINE_INFO = NO SORT_MEMBER_DOCS = YES SORT_BRIEF_DOCS = NO SORT_BY_SCOPE_NAME = NO GENERATE_TODOLIST = NO GENERATE_TESTLIST = YES GENERATE_BUGLIST = YES GENERATE_DEPRECATEDLIST= YES ENABLED_SECTIONS = MAX_INITIALIZER_LINES = 30 SHOW_USED_FILES = YES SHOW_DIRECTORIES = YES FILE_VERSION_FILTER = #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- QUIET = NO WARNINGS = YES WARN_IF_UNDOCUMENTED = YES WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO WARN_FORMAT = "$file:$line: $text " WARN_LOGFILE = ${MYGUI_BINARY_DIR}/doxygen_warnings.log #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- INPUT = ${MYGUI_SOURCE_DIR}/MyGUIEngine \ ${MYGUI_SOURCE_DIR}/Docs/src \ main_page.txt INPUT_ENCODING = UTF-8 FILE_PATTERNS = MyGUI_*.h RECURSIVE = YES EXCLUDE = EXCLUDE_SYMLINKS = NO EXCLUDE_PATTERNS = *UTF* EXCLUDE_SYMBOLS = EXAMPLE_PATH = EXAMPLE_PATTERNS = EXAMPLE_RECURSIVE = NO IMAGE_PATH = INPUT_FILTER = FILTER_PATTERNS = FILTER_SOURCE_FILES = NO #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- SOURCE_BROWSER = YES INLINE_SOURCES = NO STRIP_CODE_COMMENTS = YES REFERENCED_BY_RELATION = YES REFERENCES_RELATION = YES REFERENCES_LINK_SOURCE = YES USE_HTAGS = NO VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- ALPHABETICAL_INDEX = YES COLS_IN_ALPHA_INDEX = 3 IGNORE_PREFIX = #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- GENERATE_HTML = YES HTML_OUTPUT = html HTML_FILE_EXTENSION = .html HTML_HEADER = header.html HTML_FOOTER = footer.html HTML_STYLESHEET = HTML_ALIGN_MEMBERS = YES GENERATE_HTMLHELP = YES HTML_DYNAMIC_SECTIONS = NO CHM_FILE = OgreAPIReference.chm HHC_LOCATION = GENERATE_CHI = NO BINARY_TOC = NO TOC_EXPAND = YES DISABLE_INDEX = NO ENUM_VALUES_PER_LINE = 4 GENERATE_TREEVIEW = NO TREEVIEW_WIDTH = 250 #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- GENERATE_LATEX = NO LATEX_OUTPUT = latex LATEX_CMD_NAME = latex MAKEINDEX_CMD_NAME = makeindex COMPACT_LATEX = NO PAPER_TYPE = a4 EXTRA_PACKAGES = LATEX_HEADER = PDF_HYPERLINKS = YES USE_PDFLATEX = YES LATEX_BATCHMODE = YES LATEX_HIDE_INDICES = NO #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- GENERATE_RTF = NO RTF_OUTPUT = rtf COMPACT_RTF = NO RTF_HYPERLINKS = NO RTF_STYLESHEET_FILE = RTF_EXTENSIONS_FILE = #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- GENERATE_MAN = NO MAN_OUTPUT = man MAN_EXTENSION = .3 MAN_LINKS = NO #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- GENERATE_XML = NO XML_OUTPUT = xml XML_SCHEMA = XML_DTD = XML_PROGRAMLISTING = YES #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- GENERATE_AUTOGEN_DEF = NO #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- GENERATE_PERLMOD = NO PERLMOD_LATEX = NO PERLMOD_PRETTY = YES PERLMOD_MAKEVAR_PREFIX = #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- ENABLE_PREPROCESSING = YES MACRO_EXPANSION = NO EXPAND_ONLY_PREDEF = NO SEARCH_INCLUDES = YES INCLUDE_PATH = INCLUDE_FILE_PATTERNS = PREDEFINED = EXPAND_AS_DEFINED = SKIP_FUNCTION_MACROS = YES #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- TAGFILES = GENERATE_TAGFILE = ALLEXTERNALS = NO EXTERNAL_GROUPS = YES PERL_PATH = /usr/bin/perl #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- CLASS_DIAGRAMS = YES MSCGEN_PATH = HIDE_UNDOC_RELATIONS = YES HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = NO GROUP_GRAPHS = YES UML_LOOK = NO TEMPLATE_RELATIONS = NO INCLUDE_GRAPH = NO INCLUDED_BY_GRAPH = NO CALL_GRAPH = NO CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES DOT_IMAGE_FORMAT = gif DOT_PATH = DOTFILE_DIRS = DOT_GRAPH_MAX_NODES = 50 MAX_DOT_GRAPH_DEPTH = 4 DOT_TRANSPARENT = NO DOT_MULTI_TARGETS = YES GENERATE_LEGEND = YES DOT_CLEANUP = YES #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- SEARCHENGINE = NO mygui-3.4.3+dfsg/CMake/Templates/plugins.cfg.in000066400000000000000000000002731451556753500213010ustar00rootroot00000000000000# Defines plugins to load # Define plugin folder PluginFolder=@MYGUI_PLUGIN_DIR_REL@ # Define plugins @MYGUI_NO_PLUGIN_OGRE_DIRECTX@Plugin=RenderSystem_Direct3D9 Plugin=RenderSystem_GL mygui-3.4.3+dfsg/CMake/Templates/plugins_d.cfg.in000066400000000000000000000002771451556753500216100ustar00rootroot00000000000000# Defines plugins to load # Define plugin folder PluginFolder=@MYGUI_PLUGIN_DIR_DBG@ # Define plugins @MYGUI_NO_PLUGIN_OGRE_DIRECTX@Plugin=RenderSystem_Direct3D9_d Plugin=RenderSystem_GL_d mygui-3.4.3+dfsg/CMake/Templates/resources.xml.in000066400000000000000000000002231451556753500216660ustar00rootroot00000000000000 @MYGUI_MEDIA_DIR@ @MYGUI_MEDIA_DIR@/MyGUI_Media mygui-3.4.3+dfsg/CMake/Templates/updateListFiles.bat.in000066400000000000000000000001471451556753500227300ustar00rootroot00000000000000chdir @MYGUI_SOURCE_DIR@/Scripts @MYGUI_SOURCE_DIR@/Scripts/ConvertVcxprojToList.exe @MYGUI_BINARY_DIR@mygui-3.4.3+dfsg/CMake/Utils/000077500000000000000000000000001451556753500156725ustar00rootroot00000000000000mygui-3.4.3+dfsg/CMake/Utils/FindPkgMacros.cmake000066400000000000000000000051331451556753500213650ustar00rootroot00000000000000################################################################## # Provides some common functionality for the FindPackage modules ################################################################## # Begin processing of package macro(findpkg_begin PREFIX) if (NOT ${PREFIX}_FIND_QUIETLY) message(STATUS "Looking for ${PREFIX}...") endif () endmacro(findpkg_begin) # Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes macro(getenv_path VAR) set(ENV_${VAR} $ENV{${VAR}}) # replace won't work if var is blank if (ENV_${VAR}) string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} ) endif () endmacro(getenv_path) # Construct search paths for includes and libraries from a PREFIX_PATH macro(create_search_paths PREFIX) foreach(dir ${${PREFIX}_PREFIX_PATH}) set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH} ${dir}/include ${dir}/include/${PREFIX} ${dir}/Headers) set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH} ${dir}/lib ${dir}/lib/${PREFIX} ${dir}/Libs) endforeach(dir) set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH}) endmacro(create_search_paths) # clear cache variables if a certain variable changed macro(clear_if_changed TESTVAR) # test against internal check variable if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}") message(STATUS "${TESTVAR} changed.") foreach(var ${ARGN}) set(${var} "NOTFOUND" CACHE STRING "x" FORCE) endforeach(var) endif () set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE) endmacro(clear_if_changed) # Do the final processing for the package find. macro(findpkg_finish PREFIX) # skip if already processed during this run if (NOT ${PREFIX}_FOUND) if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY) set(${PREFIX}_FOUND TRUE) set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR}) set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY}) if (NOT ${PREFIX}_FIND_QUIETLY) message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}") endif () else () if (NOT ${PREFIX}_FIND_QUIETLY) message(STATUS "Could not locate ${PREFIX}") endif () if (${PREFIX}_FIND_REQUIRED) message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.") endif () endif () mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK) endif () endmacro(findpkg_finish) mygui-3.4.3+dfsg/CMake/Utils/MacroLogFeature.cmake000066400000000000000000000122151451556753500217140ustar00rootroot00000000000000# This file defines the Feature Logging macros. # # MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]]) # Logs the information so that it can be displayed at the end # of the configure run # VAR : TRUE or FALSE, indicating whether the feature is supported # FEATURE: name of the feature, e.g. "libjpeg" # DESCRIPTION: description what this feature provides # URL: home page # REQUIRED: TRUE or FALSE, indicating whether the featue is required # MIN_VERSION: minimum version number. empty string if unneeded # COMMENTS: More info you may want to provide. empty string if unnecessary # # MACRO_DISPLAY_FEATURE_LOG() # Call this to display the collected results. # Exits CMake with a FATAL error message if a required feature is missing # # Example: # # INCLUDE(MacroLogFeature) # # FIND_PACKAGE(JPEG) # MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "") # ... # MACRO_DISPLAY_FEATURE_LOG() # Copyright (c) 2006, Alexander Neundorf, # Copyright (c) 2006, Allen Winter, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. IF (NOT _macroLogFeatureAlreadyIncluded) SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) IF (EXISTS ${_file}) FILE(REMOVE ${_file}) ENDIF (EXISTS ${_file}) SET(_macroLogFeatureAlreadyIncluded TRUE) ENDIF (NOT _macroLogFeatureAlreadyIncluded) MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments) SET(_required "${ARGV4}") SET(_minvers "${ARGV5}") SET(_comments "${ARGV6}") IF (${_var}) SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) ELSE (${_var}) IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt) ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]") SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]") ENDIF (${_var}) SET(_logtext "+ ${_package}") IF (NOT ${_var}) IF (${_minvers} MATCHES ".*") SET(_logtext "${_logtext}, ${_minvers}") ENDIF (${_minvers} MATCHES ".*") SET(_logtext "${_logtext}: ${_description} <${_url}>") IF (${_comments} MATCHES ".*") SET(_logtext "${_logtext}\n${_comments}") ENDIF (${_comments} MATCHES ".*") # SET(_logtext "${_logtext}\n") #double-space missing features? ENDIF (NOT ${_var}) FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n") ENDMACRO(MACRO_LOG_FEATURE) MACRO(MACRO_DISPLAY_FEATURE_LOG) SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt) IF (EXISTS ${_file}) FILE(READ ${_file} _requirements) MESSAGE(FATAL_ERROR "\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- Please install them before continuing this software installation.\n-- If you are in Windows, try passing -DMYGUI_DEPENDENCIES_DIR=\n-- Also check that you buildind with RenderSystem that you need or set another with -DMYGUI_RENDERSYSTEM=<3, 4, 5, 6, 7 for OGRE, OpenGL, Direct3D_9, Direct3D_11 or OpenGL 3.x>\n-----------------------------------------------------------------------------\n${_requirements}-----------------------------------------------------------------------------") FILE(REMOVE ${_file}) MESSAGE(FATAL_ERROR "Exiting: Missing Requirements") ENDIF (EXISTS ${_file}) SET(_summary "\n") SET(_elist 0) SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt) IF (EXISTS ${_file}) SET(_elist 1) FILE(READ ${_file} _enabled) FILE(REMOVE ${_file}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n${_enabled}") ENDIF (EXISTS ${_file}) SET(_dlist 0) SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt) IF (EXISTS ${_file}) SET(_dlist 1) FILE(READ ${_file} _disabled) FILE(REMOVE ${_file}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n${_disabled}") ELSE (EXISTS ${_file}) IF (${_elist}) SET(_summary "${_summary}Congratulations! All external packages have been found.\n") ENDIF (${_elist}) ENDIF (EXISTS ${_file}) IF (${_elist} OR ${_dlist}) SET(_summary "${_summary}-----------------------------------------------------------------------------\n") ENDIF (${_elist} OR ${_dlist}) MESSAGE(STATUS "${_summary}") ENDMACRO(MACRO_DISPLAY_FEATURE_LOG) mygui-3.4.3+dfsg/CMake/Utils/MyGUIConfigTargets.cmake000066400000000000000000000362111451556753500223110ustar00rootroot00000000000000# Configure settings and install targets include(GNUInstallDirs) if (WIN32) set(MYGUI_RELEASE_PATH "/Release") set(MYGUI_RELWDBG_PATH "/RelWithDebInfo") set(MYGUI_MINSIZE_PATH "/MinSizeRel") set(MYGUI_DEBUG_PATH "/Debug") set(MYGUI_LIB_RELEASE_PATH "/Release") set(MYGUI_LIB_RELWDBG_PATH "/RelWithDebInfo") set(MYGUI_LIB_MINSIZE_PATH "/MinSizeRel") set(MYGUI_LIB_DEBUG_PATH "/Debug") set(MYGUI_PLUGIN_PATH "/opt") elseif (UNIX) set(MYGUI_RELEASE_PATH "") set(MYGUI_RELWDBG_PATH "") set(MYGUI_MINSIZE_PATH "") set(MYGUI_DEBUG_PATH "/debug") set(MYGUI_LIB_RELEASE_PATH "") set(MYGUI_LIB_RELWDBG_PATH "") set(MYGUI_LIB_MINSIZE_PATH "") set(MYGUI_LIB_DEBUG_PATH "") set(MYGUI_PLUGIN_PATH "/MYGUI") endif () function(mygui_set_platform_name PLATFORM_ID) if(${PLATFORM_ID} EQUAL 1) set(MYGUI_PLATFORM_NAME Dummy PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 3) set(MYGUI_PLATFORM_NAME Ogre PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 4) set(MYGUI_PLATFORM_NAME OpenGL PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 5) set(MYGUI_PLATFORM_NAME DirectX PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 6) set(MYGUI_PLATFORM_NAME DirectX11 PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 7) set(MYGUI_PLATFORM_NAME OpenGL3 PARENT_SCOPE) elseif(${PLATFORM_ID} EQUAL 8) set(MYGUI_PLATFORM_NAME OpenGLES PARENT_SCOPE) endif() endfunction(mygui_set_platform_name) # install targets according to current build type function(mygui_install_target TARGETNAME SUFFIX) install(TARGETS ${TARGETNAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_RELEASE_PATH}" CONFIGURATIONS Release None "" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_RELEASE_PATH}${SUFFIX}" CONFIGURATIONS Release None "" FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}" CONFIGURATIONS Release None "" ) install(TARGETS ${TARGETNAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH}" CONFIGURATIONS RelWithDebInfo LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_RELWDBG_PATH}${SUFFIX}" CONFIGURATIONS RelWithDebInfo FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}" CONFIGURATIONS RelWithDebInfo ) install(TARGETS ${TARGETNAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_MINSIZE_PATH}" CONFIGURATIONS MinSizeRel LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_MINSIZE_PATH}${SUFFIX}" CONFIGURATIONS MinSizeRel FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}" CONFIGURATIONS MinSizeRel ) install(TARGETS ${TARGETNAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH}" CONFIGURATIONS Debug LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}${MYGUI_LIB_DEBUG_PATH}${SUFFIX}" CONFIGURATIONS Debug FRAMEWORK DESTINATION "${CMAKE_INSTALL_LIBDIR}" CONFIGURATIONS Debug ) endfunction(mygui_install_target) # setup common target settings function(mygui_config_common TARGETNAME) set_target_properties(${TARGETNAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} LIBRARY_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} RUNTIME_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} ) endfunction(mygui_config_common) #setup Demo builds function(mygui_app PROJECTNAME SOLUTIONFOLDER) include_directories( . ${MYGUI_SOURCE_DIR}/Common ${MYGUI_SOURCE_DIR}/MyGUIEngine/include ${MYGUI_SOURCE_DIR}/Common/Input/SDL ) # define the sources include(${PROJECTNAME}.list) include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) link_directories(${SDL2_LIB_DIR}) # Set up dependencies mygui_add_base_manager_include(${MYGUI_RENDERSYSTEM}) mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) include_directories( ${MYGUI_SOURCE_DIR}/Platforms/${MYGUI_PLATFORM_NAME}/${MYGUI_PLATFORM_NAME}Platform/include ) if(MYGUI_RENDERSYSTEM EQUAL 1) add_definitions("-DMYGUI_DUMMY_PLATFORM") elseif(MYGUI_RENDERSYSTEM EQUAL 3) add_definitions("-DMYGUI_OGRE_PLATFORM") include_directories(SYSTEM ${OGRE_INCLUDE_DIR} ) link_directories(${OGRE_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 4) add_definitions("-DMYGUI_OPENGL_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ) link_directories( ${OPENGL_LIB_DIR} ${SDL2_IMAGE_LIB_DIR} ) elseif(MYGUI_RENDERSYSTEM EQUAL 5) add_definitions("-DMYGUI_DIRECTX_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 6) add_definitions("-DMYGUI_DIRECTX11_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 7) add_definitions("-DMYGUI_OPENGL3_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ) link_directories( ${OPENGL_LIB_DIR} ${SDL2_IMAGE_LIB_DIR} ) elseif(MYGUI_RENDERSYSTEM EQUAL 8) add_definitions("-DMYGUI_OPENGLES_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ) link_directories( ${OPENGL_LIB_DIR} ${SDL2_IMAGE_LIB_DIR} ) endif() # setup demo target if (${SOLUTIONFOLDER} STREQUAL "Wrappers") add_library(${PROJECTNAME} ${MYGUI_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES}) else () # determine specific executable type if (WIN32) set(MYGUI_EXEC_TYPE WIN32) endif () add_executable(${PROJECTNAME} ${MYGUI_EXEC_TYPE} ${HEADER_FILES} ${SOURCE_FILES}) endif () set_target_properties(${PROJECTNAME} PROPERTIES FOLDER ${SOLUTIONFOLDER}) add_dependencies(${PROJECTNAME} MyGUIEngine MyGUICommon) mygui_config_sample(${PROJECTNAME}) # link Common, Platform and MyGUIEngine target_link_libraries(${PROJECTNAME} MyGUICommon ) if (NOT EMSCRIPTEN) # exclude emscripten, because it link SDL in its own way target_link_libraries(${PROJECTNAME} ${SDL2_LIBRARIES} ) endif () mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) add_dependencies(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform) target_link_libraries(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform) if(MYGUI_RENDERSYSTEM EQUAL 1) elseif(MYGUI_RENDERSYSTEM EQUAL 3) elseif(MYGUI_RENDERSYSTEM EQUAL 4) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) elseif(MYGUI_RENDERSYSTEM EQUAL 5) elseif(MYGUI_RENDERSYSTEM EQUAL 7) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) elseif(MYGUI_RENDERSYSTEM EQUAL 8) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) endif() target_link_libraries(${PROJECTNAME} MyGUIEngine ) if (MYGUI_GENERATE_LIST_FILES_FROM_VSPROJECT) add_custom_command(TARGET ${PROJECTNAME} POST_BUILD COMMAND ${MYGUI_BINARY_DIR}/updateListFiles.bat COMMENT "Generating *.list files") endif () endfunction(mygui_app) #setup Tools dll builds function(mygui_dll PROJECTNAME SOLUTIONFOLDER) include_directories( . ${MYGUI_SOURCE_DIR}/Common ${MYGUI_SOURCE_DIR}/MyGUIEngine/include ) # define the sources include(${PROJECTNAME}.list) include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) link_directories(${SDL2_LIB_DIR}) # Set up dependencies mygui_add_base_manager_include(${MYGUI_RENDERSYSTEM}) mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) include_directories( ${MYGUI_SOURCE_DIR}/Platforms/${MYGUI_PLATFORM_NAME}/${MYGUI_PLATFORM_NAME}Platform/include ) if(MYGUI_RENDERSYSTEM EQUAL 1) add_definitions("-DMYGUI_DUMMY_PLATFORM") elseif(MYGUI_RENDERSYSTEM EQUAL 3) add_definitions("-DMYGUI_OGRE_PLATFORM") include_directories(SYSTEM ${OGRE_INCLUDE_DIR} ) link_directories(${OGRE_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 4) add_definitions("-DMYGUI_OPENGL_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ) link_directories( ${OPENGL_LIB_DIR} ) elseif(MYGUI_RENDERSYSTEM EQUAL 5) add_definitions("-DMYGUI_DIRECTX_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 6) add_definitions("-DMYGUI_DIRECTX11_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 7) add_definitions("-DMYGUI_OPENGL3_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ) link_directories(${OPENGL_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 8) add_definitions("-DMYGUI_OPENGLES_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ) link_directories(${OPENGL_LIB_DIR}) endif() add_definitions("-D_USRDLL -DMYGUI_BUILD_DLL") add_library(${PROJECTNAME} ${MYGUI_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES}) set_target_properties(${PROJECTNAME} PROPERTIES FOLDER ${SOLUTIONFOLDER}) add_dependencies(${PROJECTNAME} MyGUIEngine) target_link_libraries(${PROJECTNAME} MyGUIEngine) mygui_config_lib(${PROJECTNAME}) add_dependencies(${PROJECTNAME} MyGUIEngine MyGUICommon) mygui_config_sample(${PROJECTNAME}) target_link_libraries(${PROJECTNAME} MyGUICommon ) if (NOT EMSCRIPTEN) # exclude emscripten, because it link SDL in its own way target_link_libraries(${PROJECTNAME} ${SDL2_LIBRARIES} ) endif () mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) add_dependencies(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform) target_link_libraries(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform) if(MYGUI_RENDERSYSTEM EQUAL 1) elseif(MYGUI_RENDERSYSTEM EQUAL 3) elseif(MYGUI_RENDERSYSTEM EQUAL 4) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) elseif(MYGUI_RENDERSYSTEM EQUAL 5) elseif(MYGUI_RENDERSYSTEM EQUAL 6) elseif(MYGUI_RENDERSYSTEM EQUAL 7) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) elseif(MYGUI_RENDERSYSTEM EQUAL 8) target_link_libraries(${PROJECTNAME} ${SDL2_IMAGE_LIBRARIES}) endif() target_link_libraries(${PROJECTNAME} MyGUIEngine ) if (MYGUI_GENERATE_LIST_FILES_FROM_VSPROJECT) add_custom_command(TARGET ${PROJECTNAME} POST_BUILD COMMAND ${MYGUI_BINARY_DIR}/updateListFiles.bat COMMENT "Generating *.list files") endif () endfunction(mygui_dll) function(mygui_demo PROJECTNAME) mygui_app(${PROJECTNAME} Demos) if (MYGUI_INSTALL_DEMOS) mygui_install_app(${PROJECTNAME}) endif () endfunction(mygui_demo) function(mygui_tool PROJECTNAME) mygui_app(${PROJECTNAME} Tools) if (MYGUI_INSTALL_TOOLS) mygui_install_app(${PROJECTNAME}) endif () include_directories(${MYGUI_SOURCE_DIR}/Tools/EditorFramework) if (${CMAKE_VERSION} VERSION_EQUAL "3.16" OR ${CMAKE_VERSION} VERSION_GREATER "3.16") if (NOT MYGUI_CLANG_TIDY_BUILD) target_precompile_headers(${PROJECTNAME} PRIVATE "../../Common/Precompiled.h") else () target_compile_options(${PROJECTNAME} PRIVATE -include "${CMAKE_CURRENT_LIST_DIR}/../../Common/Precompiled.h") endif () endif () target_link_libraries(${PROJECTNAME} EditorFramework ) endfunction(mygui_tool) function(mygui_unit_test PROJECTNAME) mygui_app(${PROJECTNAME} UnitTest) endfunction(mygui_unit_test) function(mygui_tool_dll PROJECTNAME) mygui_dll(${PROJECTNAME} Tools) if (${CMAKE_VERSION} VERSION_EQUAL "3.16" OR ${CMAKE_VERSION} VERSION_GREATER "3.16") if (NOT MYGUI_CLANG_TIDY_BUILD) target_precompile_headers(${PROJECTNAME} PRIVATE "../../Common/Precompiled.h") else () target_compile_options(${PROJECTNAME} PRIVATE -include "${CMAKE_CURRENT_LIST_DIR}/../../Common/Precompiled.h") endif () endif () endfunction(mygui_tool_dll) function(mygui_install_app PROJECTNAME) if (MYGUI_INSTALL_PDB) install(FILES ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH}/${PROJECTNAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH} CONFIGURATIONS Debug ) install(FILES ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH}/${PROJECTNAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH} CONFIGURATIONS RelWithDebInfo ) endif () mygui_install_target(${PROJECTNAME} "") endfunction(mygui_install_app) #setup Plugin builds function(mygui_plugin PROJECTNAME) include_directories(.) # define the sources include(${PROJECTNAME}.list) add_definitions("-D_USRDLL -DMYGUI_BUILD_DLL") add_library(${PROJECTNAME} ${MYGUI_LIB_TYPE} ${HEADER_FILES} ${SOURCE_FILES}) set_target_properties(${PROJECTNAME} PROPERTIES FOLDER "Plugins") add_dependencies(${PROJECTNAME} MyGUIEngine) target_link_libraries(${PROJECTNAME} MyGUIEngine) mygui_config_lib(${PROJECTNAME}) # Plugins are loaded at runtime and not linked at buildtime, so they should go to the same # output directory as the executables, so the plugin loader can find them there. set_target_properties(${PROJECTNAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) # Remove default library prefix (e.g. "lib" on Linux), as the plugin loader doesn't know about it set_target_properties(${PROJECTNAME} PROPERTIES PREFIX "") install(FILES ${HEADER_FILES} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/MYGUI" ) endfunction(mygui_plugin) # setup library build function(mygui_config_lib PROJECTNAME) mygui_config_common(${PROJECTNAME}) if (MYGUI_STATIC) # add static prefix, if compiling static version set_target_properties(${PROJECTNAME} PROPERTIES OUTPUT_NAME ${PROJECTNAME}Static) else (MYGUI_STATIC) if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") # add GCC visibility flags to shared library build target_compile_options(${PROJECTNAME} PRIVATE ${MYGUI_GCC_VISIBILITY_OPTIONS}) target_compile_definitions(${PROJECTNAME} PRIVATE ${MYGUI_GCC_VISIBILITY_DEFINITIONS}) if (APPLE) # deal with Mac OS X's framework system set_target_properties(${PROJECTNAME} PROPERTIES FRAMEWORK TRUE) set_target_properties(${PROJECTNAME} PROPERTIES PUBLIC_HEADER "${${PROJECTNAME}_HEADERS}") set_target_properties(${PROJECTNAME} PROPERTIES OUTPUT_NAME ${PROJECTNAME}) set_target_properties(${PROJECTNAME} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE) set_target_properties(${PROJECTNAME} PROPERTIES BUILD_WITH_INSTALL_NAME_DIR TRUE) set_target_properties(${PROJECTNAME} PROPERTIES INSTALL_NAME_DIR "@executable_path/../lib") endif (APPLE) endif () endif (MYGUI_STATIC) mygui_install_target(${PROJECTNAME} "") if (MYGUI_INSTALL_PDB AND NOT MYGUI_STATIC) install(FILES ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH}/${PROJECTNAME}_d.pdb DESTINATION ${CMAKE_INSTALL_BINDIR}${MYGUI_DEBUG_PATH} CONFIGURATIONS Debug ) install(FILES ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH}/${PROJECTNAME}.pdb DESTINATION ${CMAKE_INSTALL_BINDIR}${MYGUI_RELWDBG_PATH} CONFIGURATIONS RelWithDebInfo ) endif () endfunction(mygui_config_lib) # setup demo build function(mygui_config_sample PROJECTNAME) mygui_config_common(${PROJECTNAME}) # set install RPATH for Unix systems if (UNIX AND MYGUI_FULL_RPATH) set_property(TARGET ${PROJECTNAME} APPEND PROPERTY INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) set_property(TARGET ${PROJECTNAME} PROPERTY INSTALL_RPATH_USE_LINK_PATH TRUE) endif () endfunction(mygui_config_sample) mygui-3.4.3+dfsg/CMake/Utils/MyGUIGetVersion.cmake000066400000000000000000000011601451556753500216320ustar00rootroot00000000000000include(PreprocessorUtils) macro(mygui_get_version HEADER) file(READ ${HEADER} TEMP_VAR_CONTENTS) get_preprocessor_entry(TEMP_VAR_CONTENTS MYGUI_VERSION_MAJOR MYGUI_VERSION_MAJOR) get_preprocessor_entry(TEMP_VAR_CONTENTS MYGUI_VERSION_MINOR MYGUI_VERSION_MINOR) get_preprocessor_entry(TEMP_VAR_CONTENTS MYGUI_VERSION_PATCH MYGUI_VERSION_PATCH) get_preprocessor_entry(TEMP_VAR_CONTENTS MYGUI_VERSION_NAME MYGUI_VERSION_NAME) get_preprocessor_entry(TEMP_VAR_CONTENTS MYGUI_VERSION_SUFFIX MYGUI_VERSION_SUFFIX) set(MYGUI_VERSION "${MYGUI_VERSION_MAJOR}.${MYGUI_VERSION_MINOR}.${MYGUI_VERSION_PATCH}") endmacro() mygui-3.4.3+dfsg/CMake/Utils/PreprocessorUtils.cmake000066400000000000000000000022431451556753500224040ustar00rootroot00000000000000macro(get_preprocessor_entry CONTENTS KEYWORD VARIABLE) string(REGEX MATCH "# *define +${KEYWORD} +((\"([^\n]*)\")|([^ \n]*))" PREPROC_TEMP_VAR ${${CONTENTS}} ) if (CMAKE_MATCH_3) set(${VARIABLE} ${CMAKE_MATCH_3}) else () set(${VARIABLE} ${CMAKE_MATCH_4}) endif () endmacro() macro(has_preprocessor_entry CONTENTS KEYWORD VARIABLE) string(REGEX MATCH "\n *# *define +(${KEYWORD})" PREPROC_TEMP_VAR ${${CONTENTS}} ) if (CMAKE_MATCH_1) set(${VARIABLE} TRUE) else () set(${VARIABLE} FALSE) endif () endmacro() macro(replace_preprocessor_entry VARIABLE KEYWORD NEW_VALUE) string(REGEX REPLACE "(// *)?# *define +${KEYWORD} +[^ \n]*" "#define ${KEYWORD} ${NEW_VALUE}" ${VARIABLE}_TEMP ${${VARIABLE}} ) set(${VARIABLE} ${${VARIABLE}_TEMP}) endmacro() macro(set_preprocessor_entry VARIABLE KEYWORD ENABLE) if (${ENABLE}) set(TMP_REPLACE_STR "#define ${KEYWORD}") else () set(TMP_REPLACE_STR "// #define ${KEYWORD}") endif () string(REGEX REPLACE "(// *)?# *define +${KEYWORD} *\n" ${TMP_REPLACE_STR} ${VARIABLE}_TEMP ${${VARIABLE}} ) set(${VARIABLE} ${${VARIABLE}_TEMP}) endmacro() mygui-3.4.3+dfsg/CMakeLists.txt000066400000000000000000000264211451556753500163570ustar00rootroot00000000000000###################################################################### # MYGUI BUILD SYSTEM # Welcome to the CMake build system for MYGUI. # This is the main file where we prepare the general build environment # and provide build configuration options. ###################################################################### cmake_minimum_required(VERSION 3.8) if(POLICY CMP0048) cmake_policy(SET CMP0048 NEW) endif() # for link time optimization, remove if cmake version is >= 3.9 if(POLICY CMP0069) # LTO cmake_policy(SET CMP0069 NEW) endif() # for position-independent executable, remove if cmake version is >= 3.14 if(POLICY CMP0083) cmake_policy(SET CMP0083 NEW) endif() project(MYGUI) # Include necessary submodules set(CMAKE_MODULE_PATH "${MYGUI_SOURCE_DIR}/CMake" "${MYGUI_SOURCE_DIR}/CMake/Utils" "${MYGUI_SOURCE_DIR}/CMake/Packages" ) include(CMakeDependentOption) include(MacroLogFeature) include(MyGUIConfigTargets) include(PreprocessorUtils) include(GNUInstallDirs) set(MYGUI_TEMPLATES_DIR "${MYGUI_SOURCE_DIR}/CMake/Templates") SET(CMAKE_CXX_STANDARD 17) set(CMAKE_EXPORT_COMPILE_COMMANDS True) # Prevent CMake from adding "#pragma clang system_header" to the precompiled headers (otherwise all warnings are suppressed) set(CMAKE_PCH_PROLOGUE "") ##################################################################### # Set up the basic build environment ##################################################################### if (CMAKE_BUILD_TYPE STREQUAL "") # CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up # differentiation between debug and release builds. set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE) endif () # determine MyGUI version numbers include(MyGUIGetVersion) mygui_get_version(${MYGUI_SOURCE_DIR}/MyGUIEngine/include/MyGUI_Prerequest.h) message(STATUS "Configuring MYGUI ${MYGUI_VERSION}") if (NOT APPLE) # Create debug libraries with _d postfix set(CMAKE_DEBUG_POSTFIX "_d") endif () if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") # Test for GCC visibility include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fvisibility=hidden MYGUI_GCC_VISIBILITY) if (MYGUI_GCC_VISIBILITY) message(STATUS "Enabling visibility flags") set(MYGUI_GCC_VISIBILITY_DEFINITIONS "MYGUI_GCC_VISIBILITY") set(MYGUI_GCC_VISIBILITY_OPTIONS "-fvisibility-inlines-hidden;-fvisibility=hidden") endif (MYGUI_GCC_VISIBILITY) # Fix x64 issues on Linux if(("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" OR "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "amd64") AND NOT APPLE) add_definitions(-fPIC) endif() endif () # Specify build paths set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MYGUI_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) if (WIN32 OR APPLE) if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) if (UNIX) # On Mac OS X and Linux, standard behavior is to install to /usr/local/lib set(CMAKE_INSTALL_PREFIX "/usr/local") elseif (WIN32) # On Windows, we don't want to install in default system location, install is really for the SDK, so call it that SET(CMAKE_INSTALL_PREFIX "${MYGUI_BINARY_DIR}/sdk" CACHE PATH "MYGUI install prefix" FORCE ) endif () endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) endif(WIN32 OR APPLE) ###################################################################### # Provide user options to customise the build process ###################################################################### if (EMSCRIPTEN) set(MYGUI_STATIC True CACHE BOOL "") set(MYGUI_DISABLE_PLUGINS True CACHE BOOL "") set(SDL2_INCLUDE_DIR "." CACHE STRING "") set(SDL2_IMAGE_INCLUDE_DIR "." CACHE STRING "") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11 -O2 -s ALLOW_MEMORY_GROWTH=1") # TODO: required only by demos and tools, not by MyGUIEngine or MyGUI.OpenGLESPlatform set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS='[\"png\"]' -s FULL_ES3=1 -s USE_WEBGL2=1") # TODO: set preload-file flags for demos and tools only set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file ${CMAKE_CURRENT_SOURCE_DIR}/Media/@/Media") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file ${CMAKE_CURRENT_BINARY_DIR}/bin/resources.xml@/resources.xml") SET(CMAKE_EXECUTABLE_SUFFIX ".html") endif () # Customise what to build option(MYGUI_STATIC "Static build" FALSE) option(MYGUI_DISABLE_PLUGINS "Disable plugins support" FALSE) option(MYGUI_USE_FREETYPE "Use freetype for font texture rendering" TRUE) option(MYGUI_MSDF_FONTS "Enable msdf fonts generation support" FALSE) option(MYGUI_DONT_USE_OBSOLETE "Remove obsolete functions from build" FALSE) set(MYGUI_RENDERSYSTEM 3 CACHE STRING "Specify the Render System. Possible values: 1 - Dummy 2 - Export (not used) 3 - Ogre 4 - OpenGL 5 - Direct3D 9 6 - Direct3D 11 7 - OpenGL 3.x 8 - OpenGL ES 2.0 (Emscripten)" ) if(MYGUI_RENDERSYSTEM EQUAL 4 OR MYGUI_RENDERSYSTEM EQUAL 7) option(MYGUI_USE_SYSTEM_GLEW "Use system OpenGL Extension Wrangler Library (GLEW)" FALSE) endif() option(MYGUI_BUILD_DEMOS "Build MyGUI demos" TRUE) cmake_dependent_option(MYGUI_BUILD_PLUGINS "Build MyGUI plugins" TRUE "NOT MYGUI_DISABLE_PLUGINS" FALSE) option(MYGUI_BUILD_TOOLS "Build the tools" TRUE) option(MYGUI_BUILD_UNITTESTS "Build the unit tests" FALSE) option(MYGUI_BUILD_TEST_APP "Build TestApp" FALSE) option(MYGUI_BUILD_WRAPPER "Build the wrapper" FALSE) cmake_dependent_option(MYGUI_INSTALL_DEMOS "Install MyGUI demos." FALSE "MYGUI_BUILD_DEMOS" FALSE) cmake_dependent_option(MYGUI_INSTALL_TOOLS "Install MyGUI tools." FALSE "MYGUI_BUILD_TOOLS" FALSE) option(MYGUI_INSTALL_DOCS "Install documentation." FALSE) cmake_dependent_option(MYGUI_INSTALL_PDB "Install debug pdb files" FALSE "MSVC;NOT MYGUI_STATIC" FALSE) option(MYGUI_GENERATE_LIST_FILES_FROM_VSPROJECT "Generate .list files from visual studio project files" FALSE) MARK_AS_ADVANCED(MYGUI_GENERATE_LIST_FILES_FROM_VSPROJECT) if (MSVC) option(MYGUI_USE_PROJECT_FOLDERS "Use Visual Studio solution folders for projects." TRUE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus") endif () # Used to not annoy users with high level warnings (should be TRUE for developers) option(MYGUI_HIGH_LEVEL_WARNINGS "Use high level compiler warnings. Developers should enable this." FALSE) if (MYGUI_USE_PROJECT_FOLDERS) SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON) endif () if (MYGUI_DONT_USE_OBSOLETE) add_definitions(-DMYGUI_DONT_USE_OBSOLETE) endif () # End of Global defines # Find dependencies include(Dependencies) # Set compiler specific build flags if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Intel") add_compile_options(-Werror) if (NOT MYGUI_HIGH_LEVEL_WARNINGS) add_compile_options(-w) else () if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options( -Weverything ) # might be useful add_compile_options( -Wno-reorder ) # not useful add_compile_options( -Wno-unsafe-buffer-usage -Wno-unknown-warning-option -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-old-style-cast -Wno-poison-system-directories -Wno-c++98-compat-pedantic -Wno-c++11-extensions -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-duplicate-enum -Wno-exit-time-destructors -Wno-unused-parameter -Wno-global-constructors ) else () add_compile_options( -Wno-deprecated -Wall -Winit-self -Wcast-qual -Wwrite-strings -Wextra -pedantic -Wshadow ) add_compile_options("$<$:-Wno-reorder;-Woverloaded-virtual;-Wsuggest-override>") if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Intel") add_compile_options(-fdiagnostics-show-option) endif () # disable some add_compile_options( -Wno-unused-parameter ) endif () endif () endif () option(MYGUI_CLANG_TIDY_BUILD "Hack some things for clang-tidy runs, f.e. disable PCH" FALSE) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # usage: # UBSAN_OPTIONS=print_stacktrace=1,suppressions=sanitizers/UBSanitizer.supp option(MYGUI_UB_SANITIZER "Compile with undefined behaviour sanitizer" FALSE) if (MYGUI_UB_SANITIZER) add_compile_options("-fno-omit-frame-pointer" "-fno-optimize-sibling-calls") add_compile_options("-fsanitize=undefined" "-fno-sanitize-recover=undefined") link_libraries("-fsanitize=undefined") endif() # usage: # ASAN_OPTIONS=alloc_dealloc_mismatch=0,check_initialization_order=1,detect_stack_use_after_return=1 LSAN_OPTIONS=suppressions=sanitizers/LeaksSanitizer.supp # alloc_dealloc_mismatch is here due to issues with Ogre and no clear way to suppress the issue option(MYGUI_ADDRESS_SANITIZER "Compile with address sanitizer" FALSE) if (MYGUI_ADDRESS_SANITIZER) add_compile_options("-fno-omit-frame-pointer" "-fno-optimize-sibling-calls") add_compile_options("-fsanitize=address" "-fsanitize-address-use-after-scope") link_libraries("-fsanitize=address") endif() endif () if (MSVC) add_definitions("-D_CRT_SECURE_NO_WARNINGS") # Use the highest warning level for visual studio. if (MYGUI_HIGH_LEVEL_WARNINGS) SET(WARNING_LEVEL "/W4") else () SET(WARNING_LEVEL "/W3") endif () # disable: warning C4100: '***' : unreferenced formal parameter add_definitions(/wd4100) # TODO: move to Tools only # disable: warning C4275: non dll-interface class '***' used as base for dll-interface clas '***' add_definitions(/wd4275) if (CMAKE_CXX_FLAGS MATCHES "/W[0-4]") STRING(REGEX REPLACE "/W[0-4]" "${WARNING_LEVEL}" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") else () add_compile_definitions(${WARNING_LEVEL}) endif () endif () cmake_dependent_option(MYGUI_BUILD_DOCS "Generate documentation" TRUE "DOXYGEN_FOUND" FALSE) # global configs include_directories( ${MYGUI_SOURCE_DIR}/MyGUIEngine/include ) ################################################################### # configure global build settings based on selected build options ################################################################### include(ConfigureBuild) ################################################################## # Now setup targets ################################################################## # install resource files include(InstallResources) # Setup MyGUIEngine project add_subdirectory(MyGUIEngine) # Setup Platforms add_subdirectory(Platforms) if (MYGUI_BUILD_DEMOS OR MYGUI_BUILD_TOOLS OR MYGUI_BUILD_UNITTESTS OR MYGUI_BUILD_TEST_APP) add_subdirectory(Common) endif () # Setup Plugins if (MYGUI_BUILD_PLUGINS) add_subdirectory(Plugins) endif () if (MYGUI_BUILD_DEMOS) add_subdirectory(Demos) endif () # Setup command-line tools if (MYGUI_BUILD_TOOLS) add_subdirectory(Tools) endif () # Setup tests if (MYGUI_BUILD_UNITTESTS OR MYGUI_BUILD_TEST_APP) add_subdirectory(UnitTests) endif () # Setup wrapers if (MYGUI_BUILD_WRAPPER) add_subdirectory(Wrappers) endif () # Install documentation if (MYGUI_BUILD_DOCS) add_subdirectory(Docs) endif () # Install media files if (MYGUI_INSTALL_DEMOS OR MYGUI_INSTALL_TOOLS) add_subdirectory(Media) endif () # Install CMake modules add_subdirectory(CMake) # Provide CPack packaging target include(Packaging) mygui-3.4.3+dfsg/COPYING.MIT000066400000000000000000000021611451556753500152750ustar00rootroot00000000000000Unless otherwise indicated, Source Code is licensed under MIT license. Copyright (c) 2007-2013 MyGUI Developers 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. mygui-3.4.3+dfsg/ChangeLog.md000066400000000000000000000522461451556753500157740ustar00rootroot00000000000000## MyGUI v3.4.3 ### Core - Allow passing lambdas into MyGUI::newDelegate without explicitly wrapping them into std::function ### Widgets - Add missing eventClipboardChanged when trying to cut/copy with no text selected - Fixed rare crash when changing widget style after it was clicked in the same frame - Fixed TabItem left disabled when rapidly switching between tabs - Improve performance of the TabControl tabs switching - Fixed ignoring "FontHeight" property when "FontName" is also set - Move MyGUI::DEFAULT to deprecated, add TabControl::DEFAULT_WIDTH instead ### Platforms - Fix build with Ogre 14 ### Tools - Minor fixes for macOS - Use macOS Command key in tools ### Other - Switch to C++17 - Use string_view, unique_ptr and some other stuff - Various code improvements, including range base for migration and some other minor stuff - Add some missing MYGUI_DONT_USE_OBSOLETE checks for deprecated stuff - Remove MYGUI_DEBUG_MODE from headers to avoid issues with mixed debug/release builds ## MyGUI v3.4.2 ### Core - Add missing MYGUI_EXPORT for ControllerRepeatClick (was not linking in non-static builds) - Use commands for key combinations on EditBox, provide macOS proper bindings - Add support for string_view in UString ### Widgets - ComboBox and ListBox: make "AddItem" use LanguageManager::replaceTags same way it is done for caption properties - EditBox: Allow text input while holding Ctrl (Allow key combinations involving CTRL that produce printable characters) ### Platforms - OpenGL: Fix build with libX11-free wayland setup - Ogre: Correct vertex color order for ogre 13 ### Demos and Tools - Use SDL_WINDOWEVENT_FOCUS_GAINED/SDL_WINDOWEVENT_FOCUS_LOST events for better detection when window should have low FPS - Fix macOS resources paths, do not use MACOSX_BUNDLE - Fix various deprecated or incorrect resources usage ### Other - Add missing MYGUI_EXPORT to fix C4275 warnings - Various minor build fixes and improvements - Enable more warnings in MYGUI_HIGH_LEVEL_WARNINGS mode - Use GNUInstallDirs to install includes ## MyGUI v3.4.1 ### Core - Implement new MSDF font, that lets use render huge fonts without having big textures, also allows using only one texture for all sizes (see Demo_MsdfFont) - Add new eventWidgetDestroyed - Add support for custom shaders for each render item, used for subskin (so far used only for MSDF fonts) - Add support for Unicode code points outside of the Basic Multilingual Plane (code points above 2^16, represented by two UTF-16 code units) - Allow std::function in the MyGUI::newDelegate - Allow const functions and const classes in the MyGUI::newDelegate - Make most getters const - Fix UB in RotatingSkin::_rebuildGeometry when all vertices are cropped - Fix eventMouseButtonClick being triggered even when mouse is pressed not over widget - Fix InputManager::injectMouseMove returning true when mouse is pressed, but there is no focused widget - Fix bug with Popup widget being picked by mouse, when it is invisible because of invisible parent - Fix Widget::setDepth call making Overlapped child widgets not visible ### Widgets - ListBox: fix getWidgetByIndex when not all widgets are visible - EditBox: fix getFontHeight always returning 0 - EditBox: fix rare bug with text selection when holding mouse and changing text - EditBox: fix scroll position when selecting text below - Button: make Button without "normal_checked" skin display "pushed" skin (fixes button visual state when setStateSelected(true) is called) - Window: add borders snapping, when resizing it (previously only move was snapping borders) ### Platforms - Ogre: * make it possible to use OGRE_RESOURCEMANAGER_STRICT=1 mode (always specify resource group) * other minor performance improvements * use Ogre::Renderable to render Gui, this fixes several issues with recent Ogre version * fix RTT render with RenderSystem_DirectX11 - All: make all interfaces const-correct. Warning: custom render platforms outside of MyGUI repo must be updated to match new virtual functions API ### Demos and Tools - Add new SdlBaseManager, that is used for all platforms base code instead of multiple BaseManager-s with duplicate code - Remove no longer needed and no longer used OIS, Win32 and Win32+OIS input systems only SDL2 can is used in demos now ### Tools - LayoutEditor: fix multi language support ### Demos - New Demo_MsdfFont - Make all demos with 3d render work with the latest Ogre ### Other - Use GNUInstallDirs to determine where libraries should be installed - Use precompiled headers from CMake 3.16, enable precompiled headers on all target platforms - Remove many outdated or not used CMake options and scripts ## MyGUI v3.4.0 ### Core - Added LanguageManager::getLanguages - Fix lost key focus event not being triggered sometimes - Fix inconsistency: _riseMouseButtonMove was using Layer coordinates (most of the time). _riseMouseButtonReleased/Pressed were using absolute coordinates. - Other InputManager events fixes. - Minor MacOS build fixes. - Cleaner and much faster logic for adding and removing render items (it was the performance bottleneck when working with many items on screen). ### Widgets - ScrollBar: Fixed wrong tracking area bug. - Button: make Button with key focus (can be set only manually through code) have highlighted state. - ItemBox: add possibility to not update ItemBox content when working with items (huge speed boost, when adding/removing many in single frame) - EditText: add support for alpha in text and text shadow colours (multiplied with widget's alpha). - ItemBox: add options to hide ItemBox scroll bars (same as for ScrollView and EditBox). - MultiListBox: slightly advanced and more flexible custom compare function. - EditBox: add Ctrl+Left/Right hotkey support (moves cursor to next word). - MultiListBox: add eventNotifyItem. ### Platforms - OpenGL3Platform: Added new rendering platform. - OpenGLESPlatform: Added new rendering platform. - Emscripten support (works for Ogre and all OpenGL platforms). - OgrePlatform: Many minor build-related fixes and imrovements, including newer Ogre support and better CMake scripts. - DirectX 11 and OpenGL3: Fixed application window resizing in editors and demos. - All platforms: Fix possible stack overflow in ***DataManager::getDataPath. - All platforms: better VertexBuffer reallocation strategy for all platforms (in ::lock call, not in ::setVertexCount). - All platforms: Various minor fixes and code cleanup. ### Resources - ResourceManualFont: Added setTexture. - ResourceTrueTypeFont: Optimize TrueTupeFont render speed (half getGlyphInfo search time). - ResourceTrueTypeFont: Remove no longer needed freetype bytecode bug fix. ### Tools - LayoutEditor: Fixed "[DEFAULT]" value not being handles properly (was colored white in ComboBox, was saved in layout). - LayoutEditor: Other minor fixes and improvements. ### Demos - Added SDL2 support. ### Other - Switched to C++11: various related code improvements and cleanups. ## MyGUI v3.2.2 ### Core - Fixed eventChangeMouseFocus and eventChangeKeyFocus not being triggered in certain cases. ### Widgets - ComboBox: Fixed mouse events incorrectly going to the widget below the ComboBox when clicking on an item. - ScrollBar: Added button repeat support, ScrollBar buttons will trigger repeatedly so long as the mouse is held down. ### Platforms - OpenGLPlatform: Added option to use system GLEW library. - OgrePlatform: Improved performance of OgreDataManager::isDataExist. - OgrePlatform: Fixed build failure regarding boost libraries used by Ogre not being found. ### Resources - ResourceManualFont: Added API to create a ResourceManualFont in code rather than from XML. ### Tools - Fixed broken file dialog directory listing on Linux and make sure files are sorted. ## MyGUI v3.2.1 ### Core - Added events to clipboard manager: eventClipboardRequested, eventClipboardChanged. - Added API access to child LayerNodes. - Added pointer to ControllerItem in all controller events. - Key focus will be reset when the key focus widget is hidden. - Fixed incorrectly detecting double click when clicking on different widgets. - Fixed a memory leak when creating or changing widgets in several cases. - Fixed a lot of warnings from cppcheck. - Other minor fixes. - Remove possibility to compile without std::typeinfo (no longer needed for android, MYGUI_RTTI_DISABLE_TYPE_INFO option removed). - Remove -msse from compiler flags. ### Widgets - Added Depth property for child widgets, that can be used for rendering order. - Added eventChangeCoord event. - Fixed Enabled property not being inherited from parent widgets. - ListBox: Added eventNotifyItem for key or mouse press on item widgets. - ListBox: Added getWidgetByIndex public API to allow item widget access from outside. - EditBox: Fixed several keyboard shortcuts (such as copy & paste) not working when key and text events are injected separately by the user. - ImageBox: Added getImageSize method. - ScrollBar: Added WheelPage property for mouse wheel scroll step. ### SubWidgets - PolygonalSkin: Added stroke support for drawing dashed lines (can be seen in UnitTest_Spline). - RotatingSkin: Added properties to skin XML. ### Resources - ResourceTrueTypeFont: Added Distance parameter for margin between glyphs in generated font texture. - ResourceImageSet, ResourceTrueTypeFont: Added public API to allow creating in code rather than from XML. - ResourceManualFont: Added support to set glyph size separately rather than deriving it from image coordinates. ### Skins - Added Dark skin (used by default in Tools). - Added Black skin. - Minor updates to other skins. ### Tools - Significant improvements to LayoutEditor, FontEditor, ImageEditor and SkinEditor. ### Demos - Minor updates to several demos. ### UnitTests - Added DataInfoTest. ### Platforms - Added Dummy platform. - Various fixes for DirectX11 platform. - Slightly refactored OpenGL platform. - Added DataMemoryStream class. ### Other - Updated C# wrapper. - Switched from LGPL to MIT license. - Documentation improvements. ## MyGUI v3.2.0 ### Core - MyGUI can be compiled without std::typeinfo. - Fixed an alignment bug on non-screen layers (for example on the RTT layer). - Fixed bug with widgets on same layer changing their draw order. ### Widgets - DDContainer: Added a resetDrag method that stops a drag operation programmatically. - TextBox: Added optional text shadow. - EditBox: Fixed incorrect text display when the text area was lower than the font height. - EditBox: Reset Redo changes when text was changed. - Canvas: Fixed incorrect destruction. - ProgressBar: Fixed a problem that caused the progress value to be displayed incorrectly after the widget was resized. ### SubWidgets - RotatingSkin: Fixed incorrect display due to swapped UV coordinates. ### Resources - ResourceTrueTypeFont: * Decreased texture memory usage (typically by 50% or more). * Improved startup and runtime performance. * Added support for Windows FON/FNT bitmap fonts and for embedded SBIT bitmaps in TrueType fonts. * Added support for enhanced glyph metrics, typographically correct line spacing, and overlapping glyphs; e.g., "fj". * Implemented the ability to specify the code point used as a substitute for missing code points (now defaults to the "Not Defined" glyph instead of "Space"). * Implemented subpixel positioning. * Added useful default values for several properties. * Deprecated several properties that are no longer useful. * Fixed problems that made it impossible to use whitespace characters other than "Space" and "Tab". * Fixed several crashes and memory leaks. * Replaced an assertion with a log message when a font cannot be loaded. - ResourceManualFont: * Added support for enhanced glyph metrics and overlapping glyphs; e.g., "fj". * Implemented the ability to specify the code point used as a substitute for missing code points. ### Wraps - BaseLayout works properly when it's completely empty. ### Plugins - Updated the BerkeliumWidget plugin. ### Tools - Various fixes in LayoutEditor. - FontViewer: * Added support for all of the new features in ResourceTrueTypeFont and ResourceManualFont. * Added support for additional font types: *.ttc, *.otf, *.pfa, *.fon, and *.fnt. * Redesigned the user interface. * Implemented automatic generation of the output filenames when saving. * Fixed several crashes and memory leaks. ### Platforms - Keep solid mode when Ogre is in wireframe. - Fixed a few bugs in the OpenGL platform (buffers not cleaned up). - New DirectX11 platform prototype. ## MyGUI v3.2.0 RC1 ### Core - Skin properties were simplified for more convenient creation in the editor. - All widgets events is now multidelegates. - Support of right mouse button drag. - If MyGUI is built from svn revision log file also contain svn revision (in addition to version). - Fixed bug with texture creation for fonts. - Other minor additions and bug-fixes. ### Managers - LanguageManager now replace tags recursively. - Fixed bug in LanguageManager when missing language was selected. ### Resources - Add Layout resource, layouts loaded and parsed only once at first use. - All resource files now have "MyGUI_" prefix to avoid naming conflicts. ### Widgets - VScroll and HScroll replaced with single ScrollBar class. - Edit renamed into EditBox. - List renamed into ListBox. - MenuCtrl renamed into MenuControl. - MultiList renamed into MultiListBox. - Progress renamed into ProgressBar. - StaticImage renamed into ImageBox. - StaticText renamed into TextBox. - Tab renamed into TabControl. - New Window property Moveable. - Message moved from Core to Common. - MultiListBox now support different modes of columns resizing. - Button properties StateCheck and ButtonPressed replaced with single property StateSelected. - ListBox and ComboBox now support ToolTip. - Menu items can be checked now, tick icon appears. - Property AlignVert renamed into VerticalAlignment. - Hidden widget lose input and focus. - Active elements visualisation in list now properly respond to changes in the list. - All text related properties was moved from Widget to TextBox. ### SubWidgets - All widgets now have Colour property that colours whole widget. - RawRect subwidget was removed. - Implemented PolygonalSkin sub widget for lines and splines drawing. ### Tools - SkinEditor added. - All skins created in SkinEditor. - LayoutEditor now support projects creation. - Possibility to create MultiListBox columns in LayoutEditor. - Possibility to create PopupMenu\MenuBar in LayoutEditor. - Colour selection window added in LayoutEditor. - Show skin preview in LayoutEditor. - Scaling support in LayoutEditor. - Possibility to change widget's type in LayoutEditor. - Possibility to add custom properties in LayoutEditor. - Removed check for unique name in LayoutEditor (not required any more). - FontViewer now same generated font in two formats: as ttf + xml that use freetype in runtime for texture generation and as manual font (texture and glyphs description) ### Platforms - BasisManager for OpenGL and DirectX now properly display Win32 window content without bugs with offset. - Fixed memory leak in OpenGL's and DirectX's DataManager. - Possibility to save texture in OpenGL. - Fix typo in names vertext -> vertex. ### Plugins - Awesomium plugin removed (not LGPL anymore). ### UnitTests - New UnitTest for PolygonalSkin. - New UnitTest for RotatingSkin. ### CMake - New MYGUI_CHECK_MEMORY_LEAKS option for memory leaks detection in debug mode (MSVC only). - New MYGUI_USE_PROJECT_FOLDERS option for project folders inside generated solution (MSVC only). - UnitTest and Demos options were renames. - Win32 input used by default in demos/tools under windows instead of OIS (OIS input still used in other platforms). ## MyGUI v3.0.1 ### License - in LGPL added exclusion for static linking for possibility to use MyGUI in apps for iPhone - all Media except some files created not by MyGUI dev tean is licensed under MIT now ### Core - Refactoring to reduce the possbility of bugs (based on info from static analyzers). ### Renders - Support of textures created inside Ogre (wrapping of existing texture) ### Widget - added getCaptionWidget to Window: retun pointer to Window caption for text control (fonts and it's size) - RenderBoxScene fixed - fixed bug with Disabled widgets that was rendered as not disabled ### Managers - added log message if skin used for widget wasn't found. ### Utility - fixed loading on non-existing textures for widgets picking ### Wraps - New option to generate wrappers with CMake ### Plugins - optional AwesomiumPlugin and HikariPlugin option added to CMake config ### Resources - fixed bug with incorrect font rendering on some old videocards : TrueType font now rendered into R8G8B8A8 on videocards that doesn't support L8A8 (OgreRender) ## MyGUI v3.0.0 ### Core - rendering separated from core ### Widgets - removed widget RenderBox - moved into Common as wrapper - new widget ListCtrl - base widget for lists with OwnDraw, horizontal scroll and lines with different height support - new widget ListBox - list implementation with horizontal scroll (based on ListCtrl) ### Managers - new FactoryManager - manager creates instances of objects that implements IObject (resources, widgets, controllers, etc.) - new DataManager - possibility to create your own type or data source ### Controllers - controllers support deserialization, possibility to create through XML ### Resources - new resource type ImageSetPointer for creating cursors based on ImageSet with animation support - new resource type ManualPointer for creating cursors based on texture - new resource type TrueTypeFont for creating true type fonts - new resource type ManualFont for creating fonts based on texture - new resource type Skin for skin description ### SubWidgets - new SubWidget RotateSkin with rotating geometry support ### Tools - improved LayoutEditor, controllers support ### Demos - Demo_Pointers - demonstration of cursor contexts and W32 cursors - Demo_RenderBox - demonstration of RenderBox usage (camera view inside widget, model view inside widget) ### Plugins - Plugin_AwesomiumWidget - sample plugin implementation for Awesomium (html inside widget) - Plugin_HikariWidget - sample plugin implementation for Hikari (Flash inside widget) ### UnitTests - UnitTest_Layers - sample of using GUI inside 3D scene - UnitTest_RTTLayers - sample of rendering Layer into texture - UnitTest_TextureAnimation - sample of RTT node, for caching or for animating whole window - UnitTest_TreeControl - sample implementation of tree control (author : Pavel Turin) ## MyGUI v2.2.3 ### SubWidgets - subwidget EditText was reimplemented * word wrap support in edit mode * cursor and text selecting with ManualFont ### Widget - fixed problem with inherited Disabled and Visible conditions ## MyGUI v2.2.2 ### Core - widget hierarchy changed - style added: * Child - child widget, cropped by parent widget borders, no overlapping (used by default for child widgets) * Popup - popup widget, have parent widget, but not cropped on its borders * Overlapped - child widget, cropped by parent widget borders, can overlap (used by default for root widgets) - support of detaching and attaching of widgets, possibility to change skin or style in runtime - added fast RTTI ### Widgets - new widget DDContainer - base class for all widgets that have drag'n'drop - new widget MenuCtrl - base class for all menus (such as MenuBar or PopupMenu) - new widget MenuBar - new widget ScrllView - Widgets tool-tip support - StaticImage animation support ### Managers - new ResourceManager - allows to load user resources (for example ResourceImageSet) - new LanguageManager - allows to replace tags in layouts with strings loaded from language files, manual creating and replacing tags - PointerManager - support animated pointers - FontManager - support of loading custom fonts from texture ### Controllers - ControllerPosition improved, Jump move mode added ### Resources - new resource type ResourceImageSet - used for group of images, with animation, loads through XML ### SubWidgets - new subwidget RawRect for direct access to quad vertices - new subwidget TileRect for tiling ### Others - all widgets-containers have Any (like boost::any) for storing user info about item (for example ComboBox items, Menu items) - configuration files versions in XML - two new themes for skin ### Wrappers - BaseLayout - base class for layout wrapper - BaseItemBox - base class for ItemBox wrapper - added PanelView - made using wrappers ### Tools - LayoutEditor - external resources support, several interface improvements - added ImageSetViewer for ResourceImageSet viewing ### Demos - Demo_Colour - colour selection control, RawRect subwidget and colouring in text - Demo_Console - simple console implementation for changing some widget properties - Demo_Controllers - ControllerFadeAlpha and ControllerPosition examples - Demo_Font - true-type font generation with possibility to save into MyGUI font configuration file - Demo_Gui - demonstration of using different widgets and styles (something like Ogre Demo_Gui) - Demo_ItemBox - ItemBox, BaseItemBox wrapper, ToolTip, external user resource loaded through XML - Demo_PanelView - PanelView control implementation - Demo_Picking - widget with mouse picking creation - Demo_PluginStrangeButton - plugin an user widget - Demo_ScrollView - ScrollView examples - Demo_Themes - new MyGUI themes for skin - Demo_StaticImage - simple ImageSet viewer implementation mygui-3.4.3+dfsg/Common/000077500000000000000000000000001451556753500150425ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/000077500000000000000000000000001451556753500157145ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/BaseDemoManager.h000066400000000000000000000037701451556753500210460ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 07/2012 */ #ifndef _95cb35b3_a2e5_471f_93df_56cc381a7449_ #define _95cb35b3_a2e5_471f_93df_56cc381a7449_ #include "BaseManager.h" #include "StatisticInfo.h" #include "InputFocusInfo.h" namespace base { class BaseDemoManager : public BaseManager { public: diagnostic::StatisticInfo* getStatisticInfo() { return mInfo; } diagnostic::InputFocusInfo* getFocusInput() { return mFocusInfo; } void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) override { BaseManager::injectKeyPress(_key, _text); if (MyGUI::Gui::getInstancePtr() == nullptr) return; if (_key == MyGUI::KeyCode::F11) { bool visible = mInfo->getVisible(); mInfo->setVisible(!visible); } else if (_key == MyGUI::KeyCode::F12) { bool visible = mFocusInfo->getFocusVisible(); mFocusInfo->setFocusVisible(!visible); } } protected: void createGui() override { BaseManager::createGui(); mInfo = new diagnostic::StatisticInfo(); mFocusInfo = new diagnostic::InputFocusInfo(); MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &BaseDemoManager::notifyFrameStartUpdateStatistic); } void destroyGui() override { MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &BaseDemoManager::notifyFrameStartUpdateStatistic); delete mInfo; mInfo = nullptr; delete mFocusInfo; mFocusInfo = nullptr; BaseManager::destroyGui(); } private: void notifyFrameStartUpdateStatistic(float _time) { if (mInfo != nullptr) { static float time = 0; time += _time; if (time > 1) { time -= 1; MyGUI::MapString statistic = getStatistic(); for (MyGUI::MapString::const_iterator info = statistic.begin(); info != statistic.end(); info++) mInfo->change((*info).first, (*info).second); mInfo->update(); } } } private: diagnostic::StatisticInfo* mInfo{nullptr}; diagnostic::InputFocusInfo* mFocusInfo{nullptr}; }; } #endif mygui-3.4.3+dfsg/Common/Base/BaseResource.rc000066400000000000000000000001001451556753500206130ustar00rootroot00000000000000// Icon 1001 ICON "MyGUI.ico" mygui-3.4.3+dfsg/Common/Base/DirectX/000077500000000000000000000000001451556753500172565ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/DirectX/BaseManager.cpp000066400000000000000000000060751451556753500221370ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #include #include #include namespace base { D3DPRESENT_PARAMETERS mD3dpp; bool BaseManager::createRender(int _width, int _height, bool _windowed) { mD3d = Direct3DCreate9(D3D_SDK_VERSION); D3DDISPLAYMODE d3ddm; mD3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT, &d3ddm); memset(&mD3dpp, 0, sizeof(mD3dpp)); mD3dpp.AutoDepthStencilFormat = D3DFMT_D16; mD3dpp.EnableAutoDepthStencil = TRUE; mD3dpp.BackBufferCount = 1; mD3dpp.BackBufferFormat = d3ddm.Format; mD3dpp.BackBufferWidth = _width; mD3dpp.BackBufferHeight = _height; mD3dpp.SwapEffect = D3DSWAPEFFECT_FLIP; mD3dpp.Windowed = _windowed; SDL_SysWMinfo sysWMInfo; SDL_VERSION(&sysWMInfo.version); SDL_GetWindowWMInfo(mSdlWindow, &sysWMInfo); mD3dpp.hDeviceWindow = sysWMInfo.info.win.window; if (FAILED(mD3d->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, mD3dpp.hDeviceWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &mD3dpp, &mDevice))) { return false; } return true; } void BaseManager::destroyRender() { if (mDevice) { mDevice->Release(); mDevice = 0; } if (mD3d) { mD3d->Release(); mD3d = 0; } } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::DirectXPlatform(); setupResources(); mPlatform->initialise(mDevice); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { if (mIsDeviceLost) { Sleep(100); HRESULT hr; if (FAILED(hr = mDevice->TestCooperativeLevel())) { if (hr == D3DERR_DEVICELOST) return; if (hr == D3DERR_DEVICENOTRESET) { if (mPlatform != nullptr) mPlatform->getRenderManagerPtr()->deviceLost(); hr = mDevice->Reset(&mD3dpp); if (FAILED(hr)) return; if (mPlatform != nullptr) mPlatform->getRenderManagerPtr()->deviceRestore(); } return; } mIsDeviceLost = false; } if (SUCCEEDED(mDevice->BeginScene())) { mDevice->Clear(0, nullptr, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x001589FF, 1.0f, 0); mPlatform->getRenderManagerPtr()->drawOneFrame(); mDevice->EndScene(); } if (mDevice->Present(nullptr, nullptr, 0, nullptr) == D3DERR_DEVICELOST) mIsDeviceLost = true; } void BaseManager::resizeRender(int _width, int _height) { if (mDevice != nullptr) { if (mPlatform != nullptr) mPlatform->getRenderManagerPtr()->deviceLost(); mD3dpp.BackBufferWidth = _width; mD3dpp.BackBufferHeight = _height; HRESULT hr = mDevice->Reset(&mD3dpp); if (hr == D3DERR_INVALIDCALL) { MessageBox( nullptr, "Call to Reset() failed with D3DERR_INVALIDCALL! ", "ERROR", MB_OK | MB_ICONEXCLAMATION); } if (mPlatform != nullptr) mPlatform->getRenderManagerPtr()->deviceRestore(); } } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { mPlatform->getDataManagerPtr()->addResourceLocation(_name, _recursive); } } mygui-3.4.3+dfsg/Common/Base/DirectX/BaseManager.h000066400000000000000000000015731451556753500216020ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" namespace MyGUI { class DirectXPlatform; } struct IDirect3D9; struct IDirect3DDevice9; struct HWND__; typedef HWND__* HWND; struct HINSTANCE__; typedef HINSTANCE__* HINSTANCE; namespace base { class BaseManager : public SdlBaseManager { public: BaseManager() : SdlBaseManager(false) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; private: MyGUI::DirectXPlatform* mPlatform = nullptr; IDirect3D9* mD3d = nullptr; IDirect3DDevice9* mDevice = nullptr; bool mIsDeviceLost = false; }; } mygui-3.4.3+dfsg/Common/Base/DirectX11/000077500000000000000000000000001451556753500174205ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/DirectX11/BaseManager.cpp000066400000000000000000000104221451556753500222700ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #pragma warning(push, 0) #include #pragma warning(pop) #include #include namespace base { bool BaseManager::createRender(int _width, int _height, bool _windowed) { D3D_FEATURE_LEVEL featureLevels[] = { D3D_FEATURE_LEVEL_11_0, D3D_FEATURE_LEVEL_10_1, D3D_FEATURE_LEVEL_10_0, D3D_FEATURE_LEVEL_9_3, D3D_FEATURE_LEVEL_9_2, D3D_FEATURE_LEVEL_9_1}; static const int numFeatureLevels = 6; D3D_FEATURE_LEVEL selectedFeatureLevel = D3D_FEATURE_LEVEL_11_0; DXGI_SWAP_CHAIN_DESC swapChainDesc; ZeroMemory(&swapChainDesc, sizeof(swapChainDesc)); swapChainDesc.BufferCount = 1; swapChainDesc.BufferDesc.Width = _width; swapChainDesc.BufferDesc.Height = _height; swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; swapChainDesc.BufferDesc.RefreshRate.Numerator = 60; swapChainDesc.BufferDesc.RefreshRate.Denominator = 1; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.SampleDesc.Count = 1; swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.Windowed = _windowed; SDL_SysWMinfo sysWMInfo; SDL_VERSION(&sysWMInfo.version); SDL_GetWindowWMInfo(mSdlWindow, &sysWMInfo); swapChainDesc.OutputWindow = sysWMInfo.info.win.window; HRESULT hr = S_OK; if (FAILED( hr = D3D11CreateDeviceAndSwapChain( nullptr, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, featureLevels, numFeatureLevels, D3D11_SDK_VERSION, &swapChainDesc, &mSwapChain, &mDevice, &selectedFeatureLevel, &mDeviceContext))) { return false; } hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBuffer); mDevice->CreateRenderTargetView(mBackBuffer, nullptr, &mRenderTarget); mDeviceContext->OMSetRenderTargets(1, &mRenderTarget, nullptr); D3D11_VIEWPORT vp; vp.Width = (float)_width; vp.Height = (float)_height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0.0f; vp.TopLeftY = 0.0f; mDeviceContext->RSSetViewports(1, &vp); return true; } void BaseManager::destroyRender() { if (mRenderTarget) { mRenderTarget->Release(); mRenderTarget = nullptr; } if (mBackBuffer) { mBackBuffer->Release(); mBackBuffer = nullptr; } if (mSwapChain) { mSwapChain->Release(); mSwapChain = nullptr; } if (mDeviceContext) { mDeviceContext->Release(); mDeviceContext = nullptr; } if (mDevice) { mDevice->Release(); mDevice = nullptr; } } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::DirectX11Platform(); setupResources(); mPlatform->initialise(mDevice); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { const float clearColor[] = {0.0f, 0.0f, 0.0f, 1.0f}; mDeviceContext->ClearRenderTargetView(mRenderTarget, clearColor); mPlatform->getRenderManagerPtr()->drawOneFrame(); mSwapChain->Present(0, 0); } void BaseManager::resizeRender(int _width, int _height) { if (mDevice != nullptr) { // Release the current render target view and its back buffer mDeviceContext->OMSetRenderTargets(0, nullptr, nullptr); if (mRenderTarget) { mRenderTarget->Release(); mRenderTarget = nullptr; } if (mBackBuffer) { mBackBuffer->Release(); mBackBuffer = nullptr; } // Resize mSwapChain->ResizeBuffers(1, _width, _height, DXGI_FORMAT_R8G8B8A8_UNORM, 0); // Acquire the new back buffer mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&mBackBuffer); // Create a new render target from the resized buffer mDevice->CreateRenderTargetView(mBackBuffer, nullptr, &mRenderTarget); // Set the new render target mDeviceContext->OMSetRenderTargets(1, &mRenderTarget, nullptr); // Устанавливаем новый вьюпорт D3D11_VIEWPORT vp; vp.Width = (float)_width; vp.Height = (float)_height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0.0f; vp.TopLeftY = 0.0f; mDeviceContext->RSSetViewports(1, &vp); } } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { mPlatform->getDataManagerPtr()->addResourceLocation(_name, _recursive); } } mygui-3.4.3+dfsg/Common/Base/DirectX11/BaseManager.h000066400000000000000000000021101451556753500217300ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" namespace MyGUI { class DirectX11Platform; } struct ID3D11Device; struct ID3D11DeviceContext; struct ID3D11RenderTargetView; struct IDXGISwapChain; struct ID3D11Texture2D; struct HWND__; typedef HWND__* HWND; struct HINSTANCE__; typedef HINSTANCE__* HINSTANCE; namespace base { class BaseManager : public SdlBaseManager { public: BaseManager() : SdlBaseManager(false) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; private: MyGUI::DirectX11Platform* mPlatform = nullptr; ID3D11Device* mDevice = nullptr; ID3D11DeviceContext* mDeviceContext = nullptr; IDXGISwapChain* mSwapChain = nullptr; ID3D11Texture2D* mBackBuffer = nullptr; ID3D11RenderTargetView* mRenderTarget = nullptr; }; } mygui-3.4.3+dfsg/Common/Base/Dummy/000077500000000000000000000000001451556753500170075ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/Dummy/BaseManager.cpp000066400000000000000000000013551451556753500216640ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" namespace base { bool BaseManager::createRender(int _width, int _height, bool _windowed) { return true; } void BaseManager::destroyRender() { } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::DummyPlatform(); setupResources(); mPlatform->initialise(); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { if (mPlatform) mPlatform->getRenderManagerPtr()->drawOneFrame(); } void BaseManager::resizeRender(int _width, int _height) { } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { } } mygui-3.4.3+dfsg/Common/Base/Dummy/BaseManager.h000066400000000000000000000012031451556753500213210ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" #include namespace base { class BaseManager : public SdlBaseManager { public: BaseManager() : SdlBaseManager(false) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; private: MyGUI::DummyPlatform* mPlatform = nullptr; }; } mygui-3.4.3+dfsg/Common/Base/InputFocusInfo.h000066400000000000000000000106021451556753500207770ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 10/2009 @module */ #ifndef INPUT_FOCUS_INFO_H_ #define INPUT_FOCUS_INFO_H_ #include namespace diagnostic { class InputFocusInfo { public: InputFocusInfo() { MyGUI::InputManager::getInstance().eventChangeMouseFocus += MyGUI::newDelegate(this, &InputFocusInfo::notifyChangeMouseFocus); MyGUI::InputManager::getInstance().eventChangeKeyFocus += MyGUI::newDelegate(this, &InputFocusInfo::notifyChangeKeyFocus); MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &InputFocusInfo::notifyFrameStart); } ~InputFocusInfo() { MyGUI::InputManager::getInstance().eventChangeMouseFocus -= MyGUI::newDelegate(this, &InputFocusInfo::notifyChangeMouseFocus); MyGUI::InputManager::getInstance().eventChangeKeyFocus -= MyGUI::newDelegate(this, &InputFocusInfo::notifyChangeKeyFocus); MyGUI::Gui::getInstance().eventFrameStart -= MyGUI::newDelegate(this, &InputFocusInfo::notifyFrameStart); if (mKeyHelper != nullptr) MyGUI::Gui::getInstance().destroyWidget(mKeyHelper); if (mMouseHelper != nullptr) MyGUI::Gui::getInstance().destroyWidget(mMouseHelper); } bool getFocusVisible() const { return mFocusVisible; } void setFocusVisible(bool _value) { mFocusVisible = _value; if (!mFocusVisible) { if (mMouseHelper) mMouseHelper->setVisible(false); if (mKeyHelper) mKeyHelper->setVisible(false); } } private: void notifyChangeMouseFocus(MyGUI::Widget* _widget) { if (mFocusVisible) { mWidgetMouseFocus = _widget; updateFocusWidgetHelpers(); } } void notifyChangeKeyFocus(MyGUI::Widget* _widget) { if (mFocusVisible) { mWidgetKeyFocus = _widget; updateFocusWidgetHelpers(); } } void notifyFrameStart(float _time) { if (mFocusVisible) updateFocusWidgetHelpers(false); } void updateFocusWidgetHelpers(bool _updateinfo = true) { const std::string_view layer = "Statistic"; const std::string_view skin_mouse = "RectGreen"; const std::string_view skin_key = "RectBlue"; if ((mWidgetMouseFocus != mOldMouseFocus) || ((mWidgetMouseFocus != nullptr) && (mMouseHelper != nullptr) && mWidgetMouseFocus->getAbsoluteCoord() != mMouseHelper->getAbsoluteCoord())) { mOldMouseFocus = mWidgetMouseFocus; if (mMouseHelper == nullptr) { if (!MyGUI::LayerManager::getInstance().isExist(layer)) return; if (!MyGUI::SkinManager::getInstance().isExist(skin_mouse)) return; mMouseHelper = MyGUI::Gui::getInstance().createWidget( skin_mouse, MyGUI::IntCoord(), MyGUI::Align::Default, layer); mMouseHelper->setNeedMouseFocus(false); } if (mWidgetMouseFocus) { //if (_updateinfo) // MyGUI::MYGUI_OUT("mouse focus : ", mWidgetMouseFocus->getName()); mMouseHelper->setCoord(mWidgetMouseFocus->getAbsoluteCoord()); mMouseHelper->setVisible(true); } else { //if (_updateinfo) // MyGUI::MYGUI_OUT("mouse focus : nullptr"); mMouseHelper->setVisible(false); } } if ((mWidgetKeyFocus != mOldKeyFocus) || ((mWidgetKeyFocus != nullptr) && (mKeyHelper != nullptr) && mWidgetKeyFocus->getAbsoluteCoord() != mKeyHelper->getAbsoluteCoord())) { mOldKeyFocus = mWidgetKeyFocus; if (mKeyHelper == nullptr) { if (!MyGUI::LayerManager::getInstance().isExist(layer)) return; if (!MyGUI::SkinManager::getInstance().isExist(skin_key)) return; mKeyHelper = MyGUI::Gui::getInstance().createWidget( skin_key, MyGUI::IntCoord(), MyGUI::Align::Default, layer); mKeyHelper->setNeedMouseFocus(false); } if (mWidgetKeyFocus) { //if (_updateinfo) // MyGUI::MYGUI_OUT("key focus : ", mWidgetKeyFocus->getName()); mKeyHelper->setCoord(mWidgetKeyFocus->getAbsoluteCoord()); mKeyHelper->setVisible(true); } else { //if (_updateinfo) // MyGUI::MYGUI_OUT("key focus : nullptr"); mKeyHelper->setVisible(false); } } } private: bool mFocusVisible{false}; MyGUI::Widget* mMouseHelper{nullptr}; MyGUI::Widget* mKeyHelper{nullptr}; MyGUI::Widget* mWidgetMouseFocus{nullptr}; MyGUI::Widget* mWidgetKeyFocus{nullptr}; MyGUI::Widget* mOldMouseFocus{nullptr}; MyGUI::Widget* mOldKeyFocus{nullptr}; }; } // namespace diagnostic #endif // INPUT_FOCUS_INFO_H_ mygui-3.4.3+dfsg/Common/Base/Main.h000066400000000000000000000032441451556753500167540ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 08/2008 @module */ #ifndef BASEMAIN_H_ #define BASEMAIN_H_ #include "Precompiled.h" #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include #include #endif #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 #define MYGUI_APP(cls) \ INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT argc) \ { \ return startApp(); \ } #else #define MYGUI_APP(cls) \ int main(int argc, char** argv) \ { \ return startApp(); \ } #endif #ifdef EMSCRIPTEN #include template void run(void* arg) { reinterpret_cast(arg)->run(); } #endif template int startApp() { try { #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 // set working directory to exe location LPSTR fileName = new CHAR[256]; GetModuleFileName(nullptr, fileName, 256); std::string_view path = fileName; size_t path_directory_index = path.find_last_of('\\'); std::string exedir{path.substr(0, path_directory_index + 1)}; _chdir(exedir.c_str()); #endif AppClass* app = new AppClass(); app->prepare(); if (app->create()) { #ifdef EMSCRIPTEN emscripten_set_main_loop_arg(run, app, 120, true); #else app->run(); #endif app->destroy(); } delete app; app = nullptr; } catch (MyGUI::Exception& _e) { #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 MessageBoxA( nullptr, _e.getFullDescription().c_str(), "An exception has occured", MB_OK | MB_ICONERROR | MB_TASKMODAL); #else std::cerr << "An exception has occured" << " : " << _e.getFullDescription().c_str(); #endif throw; } return 0; } #endif mygui-3.4.3+dfsg/Common/Base/MyGUI.ico000066400000000000000000000617131451556753500173520ustar00rootroot00000000000000 5V00 %  3E U hc_PNG  IHDR\rfIDATxxՕǿI#C BT"ʠ*(T<(}.n6inIQ47b$!`CBH7/$yϹ}ߙyasϽL{9          ]|N@4c>Tu$i}Т3Q1F~ګX a/`>`NjĦ|d5(maA=xB sx2 `D ҧ/@-^8?iXN0Lz]O- 8Jħ b N?LKn0N1฿-A`$+@F-s;oLX$~>Ȋ Y1X4@ LdO |f=ǁѣ8Eݜ!(X:7/‹@e8gWpt;~*[zI^Zq‹bb'KN^y](,B7y 'ORӲ!b@*_V߁\:tLj(RMWrEH  Ξf^5!IDGQ8*BR08C%أṮoyK t/yΈZ<> RD`^4@,p?̕y}G!`p ,G}N>3.M+b8Gj R_n8iЏsn3 J:Jj|4Cf#x+ +Mz0ij;Bp@($9롾&[|$fJɅ @?Lo$e "cLAi1 #}&@'j,nƙRM9yrt`%`j{ZلNAR>yGZ`%=pmNHPn4q) y:nŀspz̰3p?NmH9VMabK Q΄(xi K-Q]fpR R3$6q] Jq0KH~A",q~>P IA zی_r_#Lp(_9N\<6㼏~v24l ReҔ뿜A,3';Dp3&?̙*>@I(lX&Pg*a_EpLqU;BZ(R@4P7!ÀA=goٸߢe.uH}V\5nijwWKܛ򥗥B4Zkuy2Ih6}^*{Å.G$?O@_#bW@ )%92EVCyw{(6%H$9H3"@*|W=KױEeWREià4B g`4ޫ^?@ ztUEAp:|_.SAiȟ4  8~ꚯ)31t E@9aMX敪\)u)G6QDTC0( avH''`_,=,Y+-=/@GI @yrό.]sTv_OE)tPP\_>1LTAi=y&kHKH/<>,G8j.&uQ0Rq6t)3o2qy$@"0<<&ˋN@''Ʋ;7:>-q H\;" )+_俰A\}ZUm1WyN/kMPϞ<.{eU'{Uٓ봡-|)rxP:*NJ{tgf xA0|dů]]ҥ%I a[#0-@f_ &KO-u@ =UDzKX%>2]m?ɏi3cNf322H`n p肐ek)ͅ1*u`nu  Rh'UD$gC xd*`s<#Hi,^N2V 0W9n(?/-RUJ}!+;SrJcTd o3䢈xIbhWpVHEqEg ?͛FF]!@ ybA_S i_:'3 p7BP@2 />dRqo'a2 '>Փ+y8q*"a%dABbd󫐝5@O7! mE'Oǭ+7NA*/ "hT9y Z}cEUHN8Y Y(u9XTre5 <&Qq"@:P\97{ b8ԥ&$l u} 3ɃQ}P|?`"X:{H<( ϐ$Ġ~ f|J@@1 -SCOw3UĸP8SpCש"<#{)=A4?P`(r@` z z|(?:4PE'z-nY7sC3UĄvUa(w4R jTCWT: (E0q1t5QD(#gA2 JIi@;/кs#UDR7$$0=!s1!;BN'dd'$ߟ_<!XQv*"?hozdn2N G j%0ɾ1YD04F))xb%b8I;%a_%W) T@B!@|̚b 6 `dD\!][6f}0JI)@B5t5aTULRTܳ WXba"PhH.pm~.~GNwp RQT"AxY_wv~}fLɃ d+}EUZ EH= NX$Kq|\zj-}U.EW|EK_"v z}dOEKMi s;*cm,Yke@Y2M]!5CL?H)Ͼ-8\^XW^0>sd+uǓT-8HA%8_#*IWeϯ[?q`ANg##=Ge!tC׈mjۂDL0x!fU\(.IS:ic1^=Α.!$:=s>Cl@i|(vx &W+t}]2"+;Ak86{I*Pk="B҂&] ?`O)6@2& b S:mi'JsA}k8;:ݾ]ygYBT,@QY SKX}BH_= g]3hEwtLQRq J*¼Wj}V0 bȞ9A24xMlم ]2lEEbdI -[X= Ƃf gMc0ZgȲ&O) # Ӡpx-YGF1rL͟8$4b+cqyçuS894Rj`\4 ҭ8eLñѲJdڊ!_`? [x€P[7:^*`w R[U٪A/;jwd;:(HMڦB?F0B;B+3UMVx]-} -} jT˕_M?FD@ w8{xZzlGk?omm?F Rb6}@^H0DC*H6Rk%llb<܇sbQrPR>gD hT߁6f^ K$g]?I>B,^p=e.q+f>,F x7)2޳X82=O~\z6?(0OC,Nb^ҳpKda*]+D<{3"P8.P$*;*y)UDl%(s;+n $m|ĕW.0%:0f^9 x683p]b:v?gA*L\_k0 +V@u/ԩd'[E@nܷGK'翥nk@d7[u.G~X HԹw+jFP,ж(pdd1T&"y931`e85tC@EU@ ?LM SrRE7OE^pm|DTnƦU\>ۡ|~^ nwtfw[g:(n0=ݗ Ցc py }G9(W9bqBL軬1P`""pad`{xqM03(Ft6:ү5XRdqr[" 4*/N]zN? R,|6 T1WD^p\CPB+xoe pIKG9- Q(?%XdXOξ(/ ?s>-Pk@TpRLaADR@9uFloCJ+ ]M|gwcwcwcwcwcwcxdo6,wcwcwcwcwcwcwcE9 PBzewcwcwcwcwc|gy8.(x:0wcwcwcwcwcwcwcH!6s`wcwcwcwcwcxdm[FB7yewcwcwcwcwcwcH!t bQwcwcwcwcwcwcxd}TF|hwcwcwcwcwcH!RDwcwcwcwcwcwcwcAZJyewcwcwcwcH!k4+wcwcwcwcwcwcwca/%VGzfwcwcwc20wcwcwcwcwcwcwcz;1 ?5jxdwcuYxdwcwcwcwcwcwcx:0 Fn[wcK@gUxdwcwcwcwcwcx:0k5+11OAzfwcwcwcwcwcy;1+!x9/|gwcwcwcwcwc`.%% u7.|gwcwcwcwcwcH!2J"J"2Fm|m?(  +// s[Gs. L%:(7eT].&y7 \L}=21ZKI{i2*wcXI`-&M@wcwctawcwcwc}=29PBwcwctawcwcwcwcwcwcwcfU  +#% iWwcwcwcwcv;1v;1wcwcwcwcwc`/'o/.o\wcwcwcgU! ÓI3OAQCwcwcwco\.K({A6wcwcwco\.G{X+$_NcRgUSD! ? !  mygui-3.4.3+dfsg/Common/Base/Ogre/000077500000000000000000000000001451556753500166105ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/Ogre/BaseManager.cpp000066400000000000000000000145701451556753500214700ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #include #include #include namespace base { const std::string BaseManager::MyGuiResourceGroup = "MyGuiResourceGroup"; bool BaseManager::createRender(int _width, int _height, bool _windowed) { Ogre::String pluginsPath; #ifndef OGRE_STATIC_LIB pluginsPath = "plugins.cfg"; #endif mRoot = new Ogre::Root(pluginsPath, "ogre.cfg", "Ogre.log"); auto renderSystem = mRoot->getRenderSystemByName(mRoot->getAvailableRenderers()[0]->getName()); mRoot->setRenderSystem(renderSystem); mWindow = mRoot->initialise(false); SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version) if (SDL_GetWindowWMInfo(mSdlWindow, &wmInfo) == SDL_FALSE) { OGRE_EXCEPT( Ogre::Exception::ERR_INTERNAL_ERROR, "Couldn't get WM Info! (SDL2)", "BaseManager::createRender"); } Ogre::NameValuePairList params; if (mEnableVSync) params["vsync"] = "true"; #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX params["parentWindowHandle"] = Ogre::StringConverter::toString(size_t(wmInfo.info.x11.window)); #elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32 params["externalWindowHandle"] = Ogre::StringConverter::toString(size_t(wmInfo.info.win.window)); #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE params["externalWindowHandle"] = Ogre::StringConverter::toString(size_t(wmInfo.info.cocoa.window)); #endif mWindow = mRoot->createRenderWindow("MainRenderWindow", _width, _height, false, ¶ms); mSceneManager = mRoot->createSceneManager(); mCamera = mSceneManager->createCamera("BaseCamera"); mCamera->setNearClipDistance(5); mCameraNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); mCameraNode->attachObject(mCamera); mCameraNode->setPosition(400, 400, 400); mCameraNode->setFixedYawAxis(true); mCameraNode->lookAt(Ogre::Vector3(0, 150, 0), Ogre::Node::TransformSpace::TS_WORLD); // Create one viewport, entire window Ogre::Viewport* vp = mWindow->addViewport(mCamera); // Alter the camera aspect ratio to match the viewport mCamera->setAspectRatio((float)vp->getActualWidth() / (float)vp->getActualHeight()); // Set default mipmap level (NB some APIs ignore this) Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5); Ogre::Light* light = mSceneManager->createLight("MainLight"); light->setType(Ogre::Light::LT_DIRECTIONAL); Ogre::Vector3 vec(-0.3f, -0.3f, -0.3f); vec.normalise(); auto lightNode = mSceneManager->getRootSceneNode()->createChildSceneNode(); lightNode->attachObject(light); lightNode->setDirection(vec); return true; } void BaseManager::destroyRender() { if (mSceneManager) { mSceneManager->clearScene(); mSceneManager->destroyAllCameras(); mSceneManager = nullptr; mCamera = nullptr; } if (mWindow) { mWindow->destroy(); mWindow = nullptr; } if (mRoot) { Ogre::RenderWindow* window = mRoot->getAutoCreatedWindow(); if (window) window->removeAllViewports(); delete mRoot; mRoot = nullptr; } } void BaseManager::createGuiPlatform() { setupResources(); Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups(); mPlatform = new MyGUI::OgrePlatform(); mPlatform->initialise(mWindow, mSceneManager, MyGuiResourceGroup); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { mRoot->renderOneFrame(); } void BaseManager::resizeRender(int _width, int _height) { mWindow->windowMovedOrResized(); mCamera->setAspectRatio((float)_width / (float)_height); } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { Ogre::ResourceGroupManager::getSingleton() .addResourceLocation(_name, "FileSystem", MyGuiResourceGroup, _recursive); } void BaseManager::makeScreenShot() { std::ifstream stream; std::string file; do { stream.close(); static size_t num = 0; const size_t max_shot = 100; if (num == max_shot) { MYGUI_LOG(Info, "The limit of screenshots is exceeded : " << max_shot); return; } file = MyGUI::utility::toString("screenshot_", ++num, ".png"); stream.open(file.c_str()); } while (stream.is_open()); mWindow->writeContentsToFile(file); } void BaseManager::setupResources() { SdlBaseManager::setupResources(); } MyGUI::MapString BaseManager::getStatistic() { MyGUI::MapString result; try { const Ogre::RenderTarget::FrameStats& stats = mWindow->getStatistics(); result["FPS"] = MyGUI::utility::toString(stats.lastFPS); result["triangle"] = MyGUI::utility::toString(stats.triangleCount); result["batch"] = MyGUI::utility::toString(stats.batchCount); result["batch gui"] = MyGUI::utility::toString(MyGUI::OgreRenderManager::getInstance().getBatchCount()); } catch (...) { MYGUI_LOG(Warning, "Error get statistics"); } return result; } void BaseManager::injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) { // change polygon mode if (_key == MyGUI::KeyCode::F5) { mCamera->setPolygonMode(Ogre::PM_SOLID); } else if (_key == MyGUI::KeyCode::F6) { mCamera->setPolygonMode(Ogre::PM_WIREFRAME); } else if (_key == MyGUI::KeyCode::F7) { mCamera->setPolygonMode(Ogre::PM_POINTS); } #if OGRE_VERSION >= MYGUI_DEFINE_VERSION(1, 7, 0) && OGRE_VERSION < MYGUI_DEFINE_VERSION(14, 0, 0) && \ OGRE_NO_VIEWPORT_ORIENTATIONMODE == 0 else if (_key == MyGUI::KeyCode::F1) { mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_0, false); mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow); } else if (_key == MyGUI::KeyCode::F2) { mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_90, false); mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow); } else if (_key == MyGUI::KeyCode::F3) { mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_180, false); mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow); } else if (_key == MyGUI::KeyCode::F4) { mWindow->getViewport(0)->setOrientationMode(Ogre::OR_DEGREE_270, false); mPlatform->getRenderManagerPtr()->setRenderWindow(mWindow); } #endif SdlBaseManager::injectKeyPress(_key, _text); } Ogre::SceneManager* BaseManager::getSceneManager() const { return mSceneManager; } Ogre::Camera* BaseManager::getCamera() const { return mCamera; } Ogre::SceneNode* BaseManager::getCameraNode() const { return mCameraNode; } } mygui-3.4.3+dfsg/Common/Base/Ogre/BaseManager.h000066400000000000000000000022121451556753500211230ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" #include namespace base { class BaseManager : public SdlBaseManager { public: BaseManager() : SdlBaseManager(false) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void makeScreenShot() override; void createGuiPlatform() override; void destroyGuiPlatform() override; void setupResources() override; MyGUI::MapString getStatistic() override; void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) override; /*internal:*/ Ogre::SceneManager* getSceneManager() const; Ogre::Camera* getCamera() const; Ogre::SceneNode* getCameraNode() const; static const std::string MyGuiResourceGroup; private: MyGUI::OgrePlatform* mPlatform = nullptr; Ogre::Root* mRoot; Ogre::Camera* mCamera; Ogre::SceneNode* mCameraNode; Ogre::SceneManager* mSceneManager; Ogre::RenderWindow* mWindow; }; } mygui-3.4.3+dfsg/Common/Base/OpenGL/000077500000000000000000000000001451556753500170405ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/OpenGL/BaseManager.cpp000066400000000000000000000051041451556753500217110ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #include #include namespace base { bool BaseManager::createRender(int _width, int _height, bool _windowed) { mContext = SDL_GL_CreateContext(mSdlWindow); if (mContext == nullptr) { std::cerr << "Failed to create SDL context: " << SDL_GetError(); exit(1); } #ifndef EMSCRIPTEN if (IMG_Init(~0) == 0) { std::cerr << "Failed to initialize SDL_image: " << IMG_GetError(); exit(1); } #endif return true; } void BaseManager::destroyRender() { IMG_Quit(); SDL_GL_DeleteContext(mContext); } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::OpenGLPlatform(); setupResources(); mPlatform->initialise(this); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (mPlatform) mPlatform->getRenderManagerPtr()->drawOneFrame(); SDL_GL_SwapWindow(mSdlWindow); } void BaseManager::resizeRender(int _width, int _height) { } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { mPlatform->getDataManagerPtr()->addResourceLocation(_name, _recursive); } void* BaseManager::loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) { std::string fullname = MyGUI::OpenGLDataManager::getInstance().getDataPath(_filename); void* result = nullptr; SDL_Surface* image = nullptr; SDL_Surface* cvtImage = nullptr; // converted surface with RGBA/RGB pixel format image = IMG_Load(fullname.c_str()); MYGUI_ASSERT(image != nullptr, "Failed to load image: " + fullname); _width = image->w; _height = image->h; int bpp = image->format->BytesPerPixel; if (bpp < 3) { result = convertPixelData(image, _format); } else { Uint32 pixelFmt = bpp == 3 ? SDL_PIXELFORMAT_BGR24 : SDL_PIXELFORMAT_ARGB8888; cvtImage = SDL_ConvertSurfaceFormat(image, pixelFmt, 0); result = convertPixelData(cvtImage, _format); SDL_FreeSurface(cvtImage); } SDL_FreeSurface(image); return result; } void BaseManager::saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) { SDL_Surface* surface = SDL_CreateRGBSurface(0, _width, _height, _format.getBytesPerPixel() * 8, 0, 0, 0, 0); std::memcpy(surface->pixels, _texture, _width * _height * _format.getBytesPerPixel()); IMG_SavePNG(surface, _filename.c_str()); } } mygui-3.4.3+dfsg/Common/Base/OpenGL/BaseManager.h000066400000000000000000000017361451556753500213650ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" #include namespace base { class BaseManager : public SdlBaseManager, public MyGUI::OpenGLImageLoader { public: BaseManager() : SdlBaseManager(true) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; // /*internal:*/ void* loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) override; void saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) override; private: MyGUI::OpenGLPlatform* mPlatform = nullptr; SDL_GLContext mContext = nullptr; }; } mygui-3.4.3+dfsg/Common/Base/OpenGL3/000077500000000000000000000000001451556753500171235ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/OpenGL3/BaseManager.cpp000066400000000000000000000051371451556753500220020ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #include #include namespace base { bool BaseManager::createRender(int _width, int _height, bool _windowed) { mContext = SDL_GL_CreateContext(mSdlWindow); if (mContext == nullptr) { std::cerr << "Failed to create SDL context: " << SDL_GetError(); exit(1); } #ifndef EMSCRIPTEN if (IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG) == 0) { std::cerr << "Failed to initialize SDL_image: " << IMG_GetError(); exit(1); } #endif return true; } void BaseManager::destroyRender() { IMG_Quit(); SDL_GL_DeleteContext(mContext); } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::OpenGL3Platform(); setupResources(); mPlatform->initialise(this); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (mPlatform) mPlatform->getRenderManagerPtr()->drawOneFrame(); SDL_GL_SwapWindow(mSdlWindow); } void BaseManager::resizeRender(int _width, int _height) { } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { mPlatform->getDataManagerPtr()->addResourceLocation(_name, _recursive); } void* BaseManager::loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) { std::string fullname = MyGUI::OpenGL3DataManager::getInstance().getDataPath(_filename); void* result = nullptr; SDL_Surface* image = nullptr; SDL_Surface* cvtImage = nullptr; // converted surface with RGBA/RGB pixel format image = IMG_Load(fullname.c_str()); MYGUI_ASSERT(image != nullptr, "Failed to load image: " + fullname); _width = image->w; _height = image->h; int bpp = image->format->BytesPerPixel; if (bpp < 3) { result = convertPixelData(image, _format); } else { Uint32 pixelFmt = bpp == 3 ? SDL_PIXELFORMAT_BGR24 : SDL_PIXELFORMAT_ARGB8888; cvtImage = SDL_ConvertSurfaceFormat(image, pixelFmt, 0); result = convertPixelData(cvtImage, _format); SDL_FreeSurface(cvtImage); } SDL_FreeSurface(image); return result; } void BaseManager::saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) { SDL_Surface* surface = SDL_CreateRGBSurface(0, _width, _height, _format.getBytesPerPixel() * 8, 0, 0, 0, 0); std::memcpy(surface->pixels, _texture, _width * _height * _format.getBytesPerPixel()); IMG_SavePNG(surface, _filename.c_str()); } } mygui-3.4.3+dfsg/Common/Base/OpenGL3/BaseManager.h000066400000000000000000000017411451556753500214440ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" #include namespace base { class BaseManager : public SdlBaseManager, public MyGUI::OpenGL3ImageLoader { public: BaseManager() : SdlBaseManager(true) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; // /*internal:*/ void* loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) override; void saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) override; private: MyGUI::OpenGL3Platform* mPlatform = nullptr; SDL_GLContext mContext = nullptr; }; } mygui-3.4.3+dfsg/Common/Base/OpenGLES/000077500000000000000000000000001451556753500172705ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/OpenGLES/BaseManager.cpp000066400000000000000000000055331451556753500221470ustar00rootroot00000000000000#include "Precompiled.h" #include "BaseManager.h" #include #include #include namespace base { bool BaseManager::createRender(int _width, int _height, bool _windowed) { #ifdef EMSCRIPTEN // Enable WebGL 2.0. MyGUI works with WebGL 1, butsome demos use es 300 shaders. SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); #endif mContext = SDL_GL_CreateContext(mSdlWindow); if (mContext == nullptr) { std::cerr << "Failed to create SDL context: " << SDL_GetError(); exit(1); } #ifndef EMSCRIPTEN if (IMG_Init(IMG_INIT_JPG | IMG_INIT_PNG) == 0) { std::cerr << "Failed to initialize SDL_image: " << IMG_GetError(); exit(1); } #endif return true; } void BaseManager::destroyRender() { IMG_Quit(); SDL_GL_DeleteContext(mContext); } void BaseManager::createGuiPlatform() { mPlatform = new MyGUI::OpenGLESPlatform(); setupResources(); mPlatform->initialise(this); } void BaseManager::destroyGuiPlatform() { if (mPlatform) { mPlatform->shutdown(); delete mPlatform; mPlatform = nullptr; } } void BaseManager::drawOneFrame() { glClearColor(0, 0, 0, 1); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if (mPlatform) mPlatform->getRenderManagerPtr()->drawOneFrame(); SDL_GL_SwapWindow(mSdlWindow); } void BaseManager::resizeRender(int _width, int _height) { } void BaseManager::addResourceLocation(const std::string& _name, bool _recursive) { mPlatform->getDataManagerPtr()->addResourceLocation(_name, _recursive); } void* BaseManager::loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) { std::string fullname = MyGUI::OpenGLESDataManager::getInstance().getDataPath(_filename); void* result = nullptr; SDL_Surface* image = nullptr; SDL_Surface* cvtImage = nullptr; // converted surface with RGBA/RGB pixel format image = IMG_Load(fullname.c_str()); MYGUI_ASSERT(image != nullptr, "Failed to load image: " + fullname); _width = image->w; _height = image->h; int bpp = image->format->BytesPerPixel; if (bpp < 3) { result = convertPixelData(image, _format); } else { Uint32 pixelFmt = bpp == 3 ? SDL_PIXELFORMAT_BGR24 : SDL_PIXELFORMAT_ARGB8888; cvtImage = SDL_ConvertSurfaceFormat(image, pixelFmt, 0); result = convertPixelData(cvtImage, _format); SDL_FreeSurface(cvtImage); } SDL_FreeSurface(image); return result; } void BaseManager::saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) { SDL_Surface* surface = SDL_CreateRGBSurface(0, _width, _height, _format.getBytesPerPixel() * 8, 0, 0, 0, 0); std::memcpy(surface->pixels, _texture, _width * _height * _format.getBytesPerPixel()); IMG_SavePNG(surface, _filename.c_str()); } } mygui-3.4.3+dfsg/Common/Base/OpenGLES/BaseManager.h000066400000000000000000000017441451556753500216140ustar00rootroot00000000000000#pragma once #include "Base/PlatformBaseManager/SdlBaseManager.h" #include namespace base { class BaseManager : public SdlBaseManager, public MyGUI::OpenGLESImageLoader { public: BaseManager() : SdlBaseManager(true) { } bool createRender(int _width, int _height, bool _windowed) override; void destroyRender() override; void drawOneFrame() override; void resizeRender(int _width, int _height) override; void addResourceLocation(const std::string& _name, bool _recursive = false) override; void createGuiPlatform() override; void destroyGuiPlatform() override; // /*internal:*/ void* loadImage(int& _width, int& _height, MyGUI::PixelFormat& _format, const std::string& _filename) override; void saveImage( int _width, int _height, MyGUI::PixelFormat _format, void* _texture, const std::string& _filename) override; private: MyGUI::OpenGLESPlatform* mPlatform = nullptr; SDL_GLContext mContext = nullptr; }; } mygui-3.4.3+dfsg/Common/Base/PlatformBaseManager/000077500000000000000000000000001451556753500215665ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Base/PlatformBaseManager/SdlBaseManager.cpp000066400000000000000000000207031451556753500251040ustar00rootroot00000000000000#include "Precompiled.h" #include "SdlBaseManager.h" #include namespace base { SdlBaseManager::SdlBaseManager(bool _isOpenGlWindow) : mIsOpenGlWindow(_isOpenGlWindow) { } void SdlBaseManager::_windowResized(int w, int h) { resizeRender(w, h); if (mPlatformReady) MyGUI::RenderManager::getInstance().setViewSize(w, h); setInputViewSize(w, h); } bool SdlBaseManager::create(int _width, int _height) { // initialize SDL if (SDL_Init(SDL_INIT_VIDEO) != 0) { std::cerr << "Failed to initialize SDL2."; exit(1); } const int width = _width; const int height = _height; bool windowed = true; // create window and position it at the center of the screen SDL_DisplayMode currDisp; if (SDL_GetCurrentDisplayMode(0, &currDisp) != 0) { std::cerr << "Failed to retrieve screen info."; exit(1); } int left = (currDisp.w - width) / 2; int top = (currDisp.h - height) / 2; mSdlWindow = SDL_CreateWindow( "MyGUI Render Window", left, top, width, height, (mIsOpenGlWindow ? SDL_WINDOW_OPENGL : 0) | SDL_WINDOW_RESIZABLE); if (mSdlWindow == nullptr) { std::cerr << "Failed to create SDL window."; exit(1); } mWindowOn = true; #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 // set icon SDL_SysWMinfo wmInfo; SDL_VERSION(&wmInfo.version) if (SDL_GetWindowWMInfo(mSdlWindow, &wmInfo) == SDL_FALSE) { std::cerr << "Failed to SDL_GetWindowWMInfo."; exit(1); } size_t handle = (size_t)wmInfo.info.win.window; char buf[MAX_PATH]; ::GetModuleFileNameA(0, (LPCH)&buf, MAX_PATH); HINSTANCE instance = ::GetModuleHandleA(buf); HICON hIconSmall = static_cast(LoadImage(instance, MAKEINTRESOURCE(1001), IMAGE_ICON, 32, 32, LR_DEFAULTSIZE)); HICON hIconBig = static_cast(LoadImage(instance, MAKEINTRESOURCE(1001), IMAGE_ICON, 256, 256, LR_DEFAULTSIZE)); if (hIconSmall) ::SendMessageA((HWND)handle, WM_SETICON, 0, (LPARAM)hIconSmall); if (hIconBig) ::SendMessageA((HWND)handle, WM_SETICON, 1, (LPARAM)hIconBig); #endif if (!createRender(width, height, windowed)) { return false; } SDL_GL_SetSwapInterval(mEnableVSync ? 1 : 0); createGuiPlatform(); mPlatformReady = true; createGui(); createInput(); createPointerManager(); // this needs to be called before createScene() since some demos require // screen size to properly position the widgets _windowResized(width, height); createScene(); loadPointerResources(); return true; } void SdlBaseManager::run() { #ifndef EMSCRIPTEN while (!mExit) #endif { while (SDL_PollEvent(&mEvent) != 0) { switch (mEvent.type) { // keyboard events case SDL_KEYDOWN: mKeyCode = mEvent.key.keysym.sym; keyPressed(mKeyCode, nullptr); break; case SDL_TEXTINPUT: mKeyCode = SDLK_UNKNOWN; keyPressed(mKeyCode, &mEvent.text); break; case SDL_KEYUP: keyReleased(mEvent.key); break; // mouse events case SDL_MOUSEMOTION: mouseMoved(mEvent.motion); break; case SDL_MOUSEBUTTONDOWN: mousePressed(mEvent.button); break; case SDL_MOUSEBUTTONUP: mouseReleased(mEvent.button); break; case SDL_MOUSEWHEEL: mouseWheelMoved(mEvent.wheel); break; // drop file events case SDL_DROPFILE: break; // windows events case SDL_WINDOWEVENT: switch (mEvent.window.event) { case SDL_WINDOWEVENT_CLOSE: mExit = true; break; case SDL_WINDOWEVENT_RESIZED: _windowResized(mEvent.window.data1, mEvent.window.data2); break; case SDL_WINDOWEVENT_FOCUS_GAINED: mWindowOn = true; break; case SDL_WINDOWEVENT_FOCUS_LOST: mWindowOn = false; break; default: break; } break; default: break; } } mFpsCounter++; drawOneFrame(); if (!mWindowOn) SDL_Delay(50); } } void SdlBaseManager::destroy() { destroyScene(); destroyPointerManager(); destroyInput(); destroyGui(); destroyRender(); SDL_Quit(); } void SdlBaseManager::setupResources() { MyGUI::xml::Document doc; if (!doc.open(std::string("resources.xml"))) MYGUI_LOG(Warning, "Failed to load resources.xml: " << doc.getLastError()); MyGUI::xml::ElementPtr root = doc.getRoot(); if (root == nullptr || root->getName() != "Paths") return; MyGUI::xml::ElementEnumerator node = root->getElementEnumerator(); while (node.next()) { if (node->getName() == "Path") { if (!node->findAttribute("root").empty()) { bool rootAttribute = MyGUI::utility::parseBool(node->findAttribute("root")); if (rootAttribute) mRootMedia = node->getContent(); } addResourceLocation(node->getContent(), false); } } addResourceLocation(getRootMedia() + "/Common/Base"); } MyGUI::MapString SdlBaseManager::getStatistic() { MyGUI::MapString statistics; statistics["FPS"] = MyGUI::utility::toString(mFpsCounter); mFpsCounter = 0; return statistics; } void SdlBaseManager::createGui() { mGUI = new MyGUI::Gui(); mGUI->initialise(mResourceFileName); SDL_StartTextInput(); } void SdlBaseManager::destroyGui() { SDL_StopTextInput(); if (mGUI) { mGUI->shutdown(); delete mGUI; mGUI = nullptr; } destroyGuiPlatform(); } void SdlBaseManager::setWindowMaximized(bool _value) { if (mSdlWindow != nullptr && _value) { SDL_MaximizeWindow(mSdlWindow); } } bool SdlBaseManager::getWindowMaximized() const { Uint32 windowState = SDL_GetWindowFlags(mSdlWindow); return windowState & SDL_WINDOW_MAXIMIZED || windowState & SDL_WINDOW_FULLSCREEN; } void SdlBaseManager::setWindowCoord(const MyGUI::IntCoord& _value) { if (_value.empty()) return; MyGUI::IntCoord coord = _value; SDL_SetWindowPosition(mSdlWindow, coord.left, coord.top); } MyGUI::IntCoord SdlBaseManager::getWindowCoord() const { int left; int top; int width; int height; SDL_GetWindowPosition(mSdlWindow, &left, &top); SDL_GetWindowSize(mSdlWindow, &width, &height); return {left, top, width, height}; } void SdlBaseManager::setWindowCaption(const std::wstring& _text) { MyGUI::UString title(_text); SDL_SetWindowTitle(mSdlWindow, title.asUTF8_c_str()); } void SdlBaseManager::injectMouseMove(int _absx, int _absy, int _absz) { if (!mGUI) return; MyGUI::InputManager::getInstance().injectMouseMove(_absx, _absy, _absz); } void SdlBaseManager::injectMousePress(int _absx, int _absy, MyGUI::MouseButton _id) { if (!mGUI) return; MyGUI::InputManager::getInstance().injectMousePress(_absx, _absy, _id); } void SdlBaseManager::injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton _id) { if (!mGUI) return; MyGUI::InputManager::getInstance().injectMouseRelease(_absx, _absy, _id); } void SdlBaseManager::injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) { if (!mGUI) return; if (_key == MyGUI::KeyCode::Escape) { mExit = true; return; } if (_key == MyGUI::KeyCode::SysRq) { makeScreenShot(); return; } MyGUI::InputManager::getInstance().injectKeyPress(_key, _text); } void SdlBaseManager::injectKeyRelease(MyGUI::KeyCode _key) { if (!mGUI) return; MyGUI::InputManager::getInstance().injectKeyRelease(_key); } void* SdlBaseManager::convertPixelData(SDL_Surface* _image, MyGUI::PixelFormat& _myGuiPixelFormat) { void* ret = nullptr; SDL_PixelFormat* format = _image->format; unsigned int bpp = format->BytesPerPixel; switch (bpp) { case 1: _myGuiPixelFormat = MyGUI::PixelFormat::L8; break; case 2: _myGuiPixelFormat = MyGUI::PixelFormat::L8A8; break; case 3: _myGuiPixelFormat = MyGUI::PixelFormat::R8G8B8; break; case 4: _myGuiPixelFormat = MyGUI::PixelFormat::R8G8B8A8; break; default: break; } SDL_LockSurface(_image); int pitchSrc = _image->pitch; //the length of a row of pixels in bytes size_t size = _image->h * pitchSrc; ret = new unsigned char[size]; unsigned char* ptr_source = (unsigned char*)_image->pixels; unsigned char* ptr_dst = (unsigned char*)ret; int pitchDst = _image->w * bpp; if (pitchSrc == pitchDst) { memcpy(ret, _image->pixels, size); } else { for (unsigned int y = 0; y < (unsigned int)_image->h; ++y) { memcpy(ptr_dst, ptr_source, pitchDst); ptr_dst += pitchDst; ptr_source += pitchSrc; } } SDL_UnlockSurface(_image); return ret; } void SdlBaseManager::quit() { mExit = true; } const std::string& SdlBaseManager::getRootMedia() const { return mRootMedia; } void SdlBaseManager::setResourceFilename(std::string_view _flename) { mResourceFileName = _flename; } } // namespace base mygui-3.4.3+dfsg/Common/Base/PlatformBaseManager/SdlBaseManager.h000066400000000000000000000045341451556753500245550ustar00rootroot00000000000000#pragma once #include #include "InputManager.h" #include "PointerManager.h" #include namespace base { class SdlBaseManager : public input::InputManager, public input::PointerManager { public: SdlBaseManager(bool _isOpenGlWindow); // Block of virtual functions for specific platform implementations virtual bool createRender(int _width, int _height, bool _windowed) = 0; virtual void destroyRender() = 0; virtual void createGuiPlatform() = 0; virtual void destroyGuiPlatform() = 0; virtual void drawOneFrame() = 0; virtual void resizeRender(int _width, int _height) = 0; virtual void addResourceLocation(const std::string& _name, bool _recursive = false) = 0; virtual void makeScreenShot() { MYGUI_LOG(Warning, "makeScreenShot not implemented"); } bool create(int _width = 1024, int _height = 768); void destroy(); void run(); void quit(); void setWindowCaption(const std::wstring& _text); const std::string& getRootMedia() const; void setResourceFilename(std::string_view _flename); /*internal:*/ void _windowResized(int w, int h); virtual void prepare() { } virtual MyGUI::MapString getStatistic(); protected: virtual void createScene() { } virtual void destroyScene() { } virtual void setupResources(); void injectMouseMove(int _absx, int _absy, int _absz) override; void injectMousePress(int _absx, int _absy, MyGUI::MouseButton _id) override; void injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton _id) override; void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) override; void injectKeyRelease(MyGUI::KeyCode _key) override; virtual void createGui(); virtual void destroyGui(); virtual void setWindowMaximized(bool _value); virtual bool getWindowMaximized() const; virtual void setWindowCoord(const MyGUI::IntCoord& _value); virtual MyGUI::IntCoord getWindowCoord() const; void* convertPixelData(SDL_Surface* _image, MyGUI::PixelFormat& _myGuiPixelFormat); protected: SDL_Window* mSdlWindow = nullptr; bool mEnableVSync = false; private: MyGUI::Gui* mGUI = nullptr; bool mIsOpenGlWindow = false; bool mPlatformReady = false; bool mExit = false; SDL_Event mEvent; std::string mRootMedia; std::string mResourceFileName = "MyGUI_Core.xml"; bool mWindowOn = false; SDL_Keycode mKeyCode; int mFpsCounter = 0; }; } mygui-3.4.3+dfsg/Common/Base/StatisticInfo.h000066400000000000000000000054001451556753500206470ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 08/2008 @module */ #ifndef STATISTIC_INFO_H_ #define STATISTIC_INFO_H_ #include namespace diagnostic { class StatisticInfo { public: StatisticInfo() { std::string_view layer = "Statistic"; if (!MyGUI::LayerManager::getInstance().isExist(layer)) return; mInfo = MyGUI::Gui::getInstance() .createWidget("TextBox", MyGUI::IntCoord(), MyGUI::Align::Default, layer); mInfo->setTextColour(MyGUI::Colour::White); mInfo->setTextShadow(true); } ~StatisticInfo() { if (mInfo != nullptr) { MyGUI::Gui::getInstance().destroyChildWidget(mInfo); mInfo = nullptr; } } template void change(std::string_view _key, const T& _value) { for (auto& param : mParams) { if (param.first == _key) { param.second = MyGUI::utility::toString(_value); return; } } mParams.emplace_back(_key, MyGUI::utility::toString(_value)); } void remove(std::string_view _key) { for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter) { if (iter->first == _key) { mParams.erase(iter); return; } } } void update() { if (mInfo != nullptr) { std::ostringstream stream; for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter) { if (iter != mParams.begin()) stream << "\n"; stream << iter->first << " : " << iter->second; } mInfo->setCaption(stream.str()); MyGUI::ISubWidgetText* text = mInfo->getSubWidgetText(); if (text != nullptr) { MyGUI::IntSize size = text->getTextSize() + mInfo->getSize() - text->getSize(); const MyGUI::IntSize& size_view = MyGUI::RenderManager::getInstance().getViewSize(); MyGUI::IntCoord coord( size_view.width - size.width - mOffset.left, size_view.height - size.height - mOffset.top, size.width, size.height); if (coord != mInfo->getCoord()) mInfo->setCoord(coord); } } } void clear() { mParams.clear(); } void clear(std::string_view _key) { for (MyGUI::VectorStringPairs::iterator iter = mParams.begin(); iter != mParams.end(); ++iter) { if (iter->first == _key) { mParams.erase(iter); return; } } } void setVisible(bool _value) { if (mInfo != nullptr) mInfo->setVisible(_value); } bool getVisible() { if (mInfo != nullptr) return mInfo->getVisible(); return false; } void setOffset(const MyGUI::IntPoint& _value) { mOffset = _value; } private: MyGUI::TextBox* mInfo{nullptr}; MyGUI::VectorStringPairs mParams; MyGUI::IntPoint mOffset{20, 20}; }; } // namespace diagnostic #endif // STATISTIC_INFO_H_ mygui-3.4.3+dfsg/Common/BaseLayout/000077500000000000000000000000001451556753500171125ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/BaseLayout/Attribute.h000066400000000000000000000071611451556753500212330ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 10/2009 @module */ #ifndef ATTRIBUTE_H_ #define ATTRIBUTE_H_ namespace attribute { // класс обертка для удаления данных из статического вектора template struct DataHolder { ~DataHolder() { for (typename Type::iterator item = data.begin(); item != data.end(); ++item) delete (*item).first; } Type data; }; // интерфейс для обертки поля template struct Field { virtual ~Field() = default; virtual bool set(OwnerType* _target, typename SetterType::BaseValueType* _value) = 0; virtual std::string_view getFieldTypeName() const = 0; }; // шаблон для обертки поля template struct FieldHolder : public Field { FieldHolder(FieldType* OwnerType::*offset) : m_offset(offset) { } FieldType* OwnerType::*const m_offset; bool set(OwnerType* _target, typename SetterType::BaseValueType* _value) override { _target->*m_offset = SetterType::template convert(_value); return _target->*m_offset != nullptr; } std::string_view getFieldTypeName() const override { return FieldType::getClassTypeName(); } }; // шаблон для атрибута поля template struct AttributeField { using BindPair = std::pair*, ValueType>; using VectorBindPair = std::vector; template AttributeField(FieldType* OwnerType::*_offset, const ValueType& _value) { getData().push_back(BindPair(new FieldHolder(_offset), _value)); } static VectorBindPair& getData() { static DataHolder data; return data.data; } }; // макрос для инстансирования атрибута поля #define DECLARE_ATTRIBUTE_FIELD(_name, _type, _setter) \ template \ struct _name : public attribute::AttributeField \ { \ template \ _name(FieldType* OwnerType::*_offset, const ValueType& _value) : \ AttributeField(_offset, _value) \ { \ } \ } // макрос для инстансирования экземпляра атрибута #define ATTRIBUTE_FIELD(_attribute, _class, _field, _value) \ struct _attribute##_##_field \ { \ _attribute##_##_field() \ { \ static attribute::_attribute<_class> bind(&_class::_field, _value); \ } \ } _attribute##_##_field // шаблон для атрибута класса template struct ClassAttribute { ClassAttribute(const ValueType& _value) { getData() = _value; } static ValueType& getData() { static ValueType data; return data; } }; // макрос для инстансирования атрибута класса #define DECLARE_ATTRIBUTE_CLASS(_name, _type) \ template \ struct _name : public attribute::ClassAttribute<_name, ValueType> \ { \ _name(const ValueType& _value) : \ ClassAttribute<_name, ValueType>(_value) \ { \ } \ } // макрос для инстансирования экземпляра класса #define ATTRIBUTE_CLASS(_attribute, _class, _value) \ class _class; \ static attribute::_attribute<_class> _attribute##_##_class(_value) } #endif // ATTRIBUTE_H_ mygui-3.4.3+dfsg/Common/BaseLayout/BaseLayout.h000066400000000000000000000161061451556753500213370ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 07/2008 @module */ #ifndef BASE_LAYOUT_H_ #define BASE_LAYOUT_H_ #include #include "WrapsAttribute.h" namespace wraps { class BaseLayout { protected: BaseLayout() : mMainWidget(nullptr) { } BaseLayout(std::string_view _layout, MyGUI::Widget* _parent = nullptr) : mMainWidget(nullptr) { initialise(_layout, _parent); } template void assignWidget(T*& _widget, const std::string& _name, bool _throw = true, bool _createFakeWidgets = true) { _widget = nullptr; for (const auto& iter : mListWindowRoot) { MyGUI::Widget* find = iter->findWidget(mPrefix + _name); if (nullptr != find) { T* cast = find->castType(false); if (nullptr != cast) { _widget = cast; } else { MYGUI_LOG( Warning, "Widget with name '" << _name << "' have wrong type ('" << find->getTypeName() << "instead of '" << T::getClassTypeName() << "'). [" << mLayoutName << "]"); MYGUI_ASSERT( !_throw, "Can't assign widget with name '" << _name << "'. [" << mLayoutName << "]"); if (_createFakeWidgets) _widget = _createFakeWidget(mMainWidget); } return; } } MYGUI_LOG(Warning, "Widget with name '" << _name << "' not found. [" << mLayoutName << "]"); MYGUI_ASSERT(!_throw, "Can't assign widget with name '" << _name << "'. [" << mLayoutName << "]"); if (_createFakeWidgets) _widget = _createFakeWidget(mMainWidget); } template void assignBase(T*& _widget, const std::string& _name, bool _throw = true, bool _createFakeWidgets = true) { _widget = nullptr; for (const auto& iter : mListWindowRoot) { MyGUI::Widget* find = iter->findWidget(mPrefix + _name); if (nullptr != find) { _widget = new T(find); mListBase.push_back(_widget); return; } } MYGUI_LOG(Warning, "Widget with name '" << _name << "' not found. [" << mLayoutName << "]"); MYGUI_ASSERT(!_throw, "Can't assign base widget with name '" << _name << "'. [" << mLayoutName << "]"); if (_createFakeWidgets) { _widget = new T(_createFakeWidget(mMainWidget)); mListBase.push_back(_widget); } } void initialise( std::string_view _layout, MyGUI::Widget* _parent = nullptr, bool _throw = true, bool _createFakeWidgets = true) { mLayoutName = _layout; // оборачиваем if (mLayoutName.empty()) { mMainWidget = _parent; if (mMainWidget != nullptr) { mListWindowRoot.push_back(mMainWidget); mPrefix = FindParentPrefix(mMainWidget); } } // загружаем лейаут на виджет else { mPrefix = MyGUI::utility::toString(this, "_"); mListWindowRoot = MyGUI::LayoutManager::getInstance().loadLayout(mLayoutName, mPrefix, _parent); const std::string MAIN_WINDOW1 = "_Main"; const std::string MAIN_WINDOW2 = "Root"; const std::string mainName1 = mPrefix + MAIN_WINDOW1; const std::string mainName2 = mPrefix + MAIN_WINDOW2; for (const auto& iter : mListWindowRoot) { if (iter->getName() == mainName1 || iter->getName() == mainName2) { mMainWidget = iter; snapToParent(mMainWidget); break; } } if (mMainWidget == nullptr) { MYGUI_LOG( Warning, "Root widget with name '" << MAIN_WINDOW1 << "' or '" << MAIN_WINDOW2 << "' not found. [" << mLayoutName << "]"); MYGUI_ASSERT(!_throw, "No root widget. ['" << mLayoutName << "]"); if (_createFakeWidgets) mMainWidget = _createFakeWidget(_parent); } mMainWidget->setUserString("BaseLayoutPrefix", mPrefix); } } void shutdown() { // удаляем все классы for (VectorBasePtr::reverse_iterator iter = mListBase.rbegin(); iter != mListBase.rend(); ++iter) delete (*iter); mListBase.clear(); // удаляем все рутовые виджеты if (!mLayoutName.empty()) MyGUI::LayoutManager::getInstance().unloadLayout(mListWindowRoot); mListWindowRoot.clear(); } template void initialiseByAttributes( Type* _owner, MyGUI::Widget* _parent = nullptr, bool _throw = true, bool _createFakeWidgets = true) { initialise(attribute::AttributeLayout::getData(), _parent, _throw, _createFakeWidgets); typename attribute::AttributeFieldWidgetName::VectorBindPair& data = attribute::AttributeFieldWidgetName::getData(); for (typename attribute::AttributeFieldWidgetName::VectorBindPair::iterator item = data.begin(); item != data.end(); ++item) { MyGUI::Widget* value = nullptr; assignWidget(value, item->second, _throw, false); bool result = item->first->set(_owner, value); if (!result && _createFakeWidgets) { value = _createFakeWidgetT(item->first->getFieldTypeName(), mMainWidget); item->first->set(_owner, value); } } } private: std::string FindParentPrefix(MyGUI::Widget* _parent) { std::string prefix{_parent->getUserString("BaseLayoutPrefix")}; if (!prefix.empty()) return prefix; if (_parent->getParent() != nullptr) return FindParentPrefix(_parent->getParent()); return prefix; } void snapToParent(MyGUI::Widget* _child) { if (_child->isUserString("SnapTo")) { MyGUI::Align align = MyGUI::Align::parse(_child->getUserString("SnapTo")); MyGUI::IntCoord coord = _child->getCoord(); MyGUI::IntSize size = _child->getParentSize(); if (align.isHStretch()) { coord.left = 0; coord.width = size.width; } else if (align.isLeft()) { coord.left = 0; } else if (align.isRight()) { coord.left = size.width - coord.width; } else { coord.left = (size.width - coord.width) / 2; } if (align.isVStretch()) { coord.top = 0; coord.height = size.height; } else if (align.isTop()) { coord.top = 0; } else if (align.isBottom()) { coord.top = size.height - coord.height; } else { coord.top = (size.height - coord.height) / 2; } _child->setCoord(coord); } } template T* _createFakeWidget(MyGUI::Widget* _parent) { return static_cast(_createFakeWidgetT(T::getClassTypeName(), _parent)); } MyGUI::Widget* _createFakeWidgetT(std::string_view _typeName, MyGUI::Widget* _parent) { if (_parent) return _parent->createWidgetT( _typeName, MyGUI::SkinManager::getInstance().getDefaultSkin(), MyGUI::IntCoord(), MyGUI::Align::Default); return MyGUI::Gui::getInstance().createWidgetT( _typeName, MyGUI::SkinManager::getInstance().getDefaultSkin(), MyGUI::IntCoord(), MyGUI::Align::Default, std::string_view{}); } public: virtual ~BaseLayout() { shutdown(); } protected: MyGUI::Widget* mMainWidget; private: std::string mPrefix; std::string mLayoutName; MyGUI::VectorWidgetPtr mListWindowRoot; using VectorBasePtr = std::vector; VectorBasePtr mListBase; }; } // namespace wraps #endif // BASE_LAYOUT_H_ mygui-3.4.3+dfsg/Common/BaseLayout/WrapsAttribute.h000066400000000000000000000014551451556753500222500ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 10/2009 @module */ #ifndef WRAPS_ATTRIBUTE_H_ #define WRAPS_ATTRIBUTE_H_ #include #include "Attribute.h" namespace attribute { struct FieldSetterWidget { using BaseValueType = MyGUI::Widget; template static Type* convert(BaseValueType* _value) { return _value == nullptr ? nullptr : _value->castType(false); } }; DECLARE_ATTRIBUTE_FIELD(AttributeFieldWidgetName, std::string, FieldSetterWidget); #define ATTRIBUTE_FIELD_WIDGET_NAME(_class, _field, _value) \ ATTRIBUTE_FIELD(AttributeFieldWidgetName, _class, _field, _value) DECLARE_ATTRIBUTE_CLASS(AttributeLayout, std::string); #define ATTRIBUTE_CLASS_LAYOUT(_class, _value) ATTRIBUTE_CLASS(AttributeLayout, _class, _value) } #endif // WRAPS_ATTRIBUTE_H_ mygui-3.4.3+dfsg/Common/CMakeLists.txt000066400000000000000000000071721451556753500176110ustar00rootroot00000000000000function(mygui_add_base_manager_include PLATFORM_ID) mygui_set_platform_name(${PLATFORM_ID}) include_directories(../../Common/Base/${MYGUI_PLATFORM_NAME}) endfunction(mygui_add_base_manager_include) set (PROJECTNAME MyGUICommon) include_directories( . ${MYGUI_SOURCE_DIR}/Common ${MYGUI_SOURCE_DIR}/MyGUIEngine/include ) set (HEADER_FILES "") set (SOURCE_FILES "") include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) link_directories(${SDL2_LIB_DIR}) mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) set (HEADER_FILES ${HEADER_FILES} Base/${MYGUI_PLATFORM_NAME}/BaseManager.h Base/PlatformBaseManager/SdlBaseManager.h) set (SOURCE_FILES ${SOURCE_FILES} Base/${MYGUI_PLATFORM_NAME}/BaseManager.cpp Base/PlatformBaseManager/SdlBaseManager.cpp) SOURCE_GROUP("Base" FILES Base/${MYGUI_PLATFORM_NAME}/BaseManager.h Base/${MYGUI_PLATFORM_NAME}/BaseManager.cpp Base/PlatformBaseManager/SdlBaseManager.h Base/PlatformBaseManager/SdlBaseManager.cpp ) include_directories( ${MYGUI_SOURCE_DIR}/Platforms/${MYGUI_PLATFORM_NAME}/${MYGUI_PLATFORM_NAME}Platform/include ) if(MYGUI_RENDERSYSTEM EQUAL 1) add_definitions("-DMYGUI_DUMMY_PLATFORM") link_directories(${DUMMY_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 3) add_definitions("-DMYGUI_OGRE_PLATFORM") include_directories(SYSTEM ${OGRE_INCLUDE_DIR} ) link_directories(${OGRE_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 4) add_definitions("-DMYGUI_OPENGL_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ${MYGUI_SOURCE_DIR}/Platforms/${MYGUI_PLATFORM_NAME}/${MYGUI_PLATFORM_NAME}Platform/include ) include_directories(SYSTEM include/GL) link_directories(${OPENGL_LIB_DIR}) link_directories(${SDL2_IMAGE_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 5) add_definitions("-DMYGUI_DIRECTX_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 6) add_definitions("-DMYGUI_DIRECTX11_PLATFORM") include_directories(SYSTEM ${DirectX_INCLUDE_DIR} ) link_directories(${DIRECTX_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 7) add_definitions("-DMYGUI_OPENGL3_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ${MYGUI_SOURCE_DIR}/Platforms/${MYGUI_PLATFORM_NAME}/${MYGUI_PLATFORM_NAME}Platform/include ) link_directories(${OPENGL_LIB_DIR}) link_directories(${SDL2_IMAGE_LIB_DIR}) elseif(MYGUI_RENDERSYSTEM EQUAL 8) add_definitions("-DMYGUI_OPENGLES_PLATFORM") include_directories(SYSTEM ${OPENGL_INCLUDE_DIR} ${SDL2_IMAGE_INCLUDE_DIRS} ) link_directories(${OPENGL_LIB_DIR}) link_directories(${SDL2_IMAGE_LIB_DIR}) endif() include_directories(Input/SDL) set (HEADER_FILES ${HEADER_FILES} Input/SDL/InputManager.h Input/SDL/PointerManager.h Input/SDL/ResourceSDLPointer.h ) set (SOURCE_FILES ${SOURCE_FILES} Input/SDL/InputManager.cpp Input/SDL/PointerManager.cpp Input/SDL/ResourceSDLPointer.cpp ) SOURCE_GROUP("Base" FILES Input/SDL/InputManager.h Input/SDL/InputManager.cpp Input/SDL/PointerManager.h Input/SDL/PointerManager.cpp Input/SDL/ResourceSDLPointer.h Input/SDL/ResourceSDLPointer.cpp ) add_library(${PROJECTNAME} ${HEADER_FILES} ${SOURCE_FILES}) mygui_set_platform_name(${MYGUI_RENDERSYSTEM}) add_dependencies(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform) target_link_libraries(${PROJECTNAME} MyGUI.${MYGUI_PLATFORM_NAME}Platform SDL2::Main) if (MYGUI_INSTALL_TOOLS OR MYGUI_INSTALL_DEMOS) set_target_properties(${PROJECTNAME} PROPERTIES VERSION ${MYGUI_VERSION} SOVERSION "${MYGUI_VERSION_MAJOR}.${MYGUI_VERSION_MINOR}.${MYGUI_VERSION_PATCH}") mygui_install_target(${PROJECTNAME} "") endif() add_dependencies(${PROJECTNAME} MyGUIEngine) mygui-3.4.3+dfsg/Common/FileSystemInfo/000077500000000000000000000000001451556753500177425ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/FileSystemInfo/FileSystemInfo.h000066400000000000000000000124001451556753500230100ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 09/2009 @module */ #ifndef FILE_SYSTEM_INFO_H_ #define FILE_SYSTEM_INFO_H_ #include #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 #include #include #else #include #include #include #include #include #endif #include #include #include namespace common { struct FileInfo { FileInfo(const std::wstring& _name, bool _folder) : name(_name), folder(_folder) { } std::wstring name; bool folder; }; using VectorFileInfo = std::vector; inline std::wstring toLower(const std::wstring& _input) { std::wstring result; result.resize(_input.size()); static std::locale sLocale(""); for (unsigned int i = 0; i < _input.size(); ++i) result[i] = std::tolower(_input[i], sLocale); return result; } inline bool sortFiles(const common::FileInfo& left, const common::FileInfo& right) { if (left.folder < right.folder) return true; if (left.folder > right.folder) return false; return toLower(left.name) < toLower(right.name); } inline bool isAbsolutePath(const wchar_t* path) { #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 if (IsCharAlphaW(path[0]) && path[1] == ':') return true; #endif return path[0] == '/' || path[0] == '\\'; } inline bool endWith(const std::wstring& _source, const std::wstring& _value) { size_t count = _value.size(); if (_source.size() < count) return false; size_t offset = _source.size() - count; for (size_t index = 0; index < count; ++index) { if (_source[index + offset] != _value[index]) return false; } return true; } inline std::wstring concatenatePath(const std::wstring& _base, const std::wstring& _name) { if (_base.empty() || isAbsolutePath(_name.c_str())) { return _name; } if (endWith(_base, L"\\") || endWith(_base, L"/")) return _base + _name; #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 return _base + L'\\' + _name; #else return _base + L'/' + _name; #endif } inline bool isReservedDir(const wchar_t* _fn) { // if "." return (_fn[0] == '.' && _fn[1] == 0); } inline bool isParentDir(const wchar_t* _fn) { // if ".." return (_fn[0] == '.' && _fn[1] == '.' && _fn[2] == 0); } inline void getSystemFileList( VectorFileInfo& _result, const std::wstring& _folder, const std::wstring& _mask, bool _sorted = true) { #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 //FIXME add optional parameter? bool ms_IgnoreHidden = true; intptr_t lHandle; int res; struct _wfinddata_t tagData; // pattern can contain a directory name, separate it from mask size_t pos = _mask.find_last_of(L"/\\"); std::wstring directory; if (pos != _mask.npos) directory = _mask.substr(0, pos); std::wstring full_mask = concatenatePath(_folder, _mask); lHandle = _wfindfirst(full_mask.c_str(), &tagData); res = 0; while (lHandle != -1 && res != -1) { if ((!ms_IgnoreHidden || (tagData.attrib & _A_HIDDEN) == 0) && !isReservedDir(tagData.name)) { _result.push_back( FileInfo(concatenatePath(directory, tagData.name), (tagData.attrib & _A_SUBDIR) != 0)); } res = _wfindnext(lHandle, &tagData); } // Close if we found any files if (lHandle != -1) _findclose(lHandle); #else std::string folder = MyGUI::UString(_folder).asUTF8(); DIR* dir = opendir(folder.c_str()); struct dirent* dp; if (dir == nullptr) { /* opendir() failed */ MYGUI_LOG(Error, "Can't open " + folder); return; } rewinddir(dir); while ((dp = readdir(dir)) != nullptr) { if ((fnmatch(MyGUI::UString(_mask).asUTF8_c_str(), dp->d_name, 0) == 0) && !isReservedDir(MyGUI::UString(dp->d_name).asWStr_c_str())) { struct stat fInfo; std::string path = folder + "/" + dp->d_name; if (stat(path.c_str(), &fInfo) == -1) perror("stat"); _result.emplace_back(MyGUI::UString(dp->d_name).asWStr_c_str(), (S_ISDIR(fInfo.st_mode))); } } closedir(dir); #endif if (_sorted) { std::sort(_result.begin(), _result.end(), sortFiles); } } inline std::wstring getSystemCurrentFolder() { #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 wchar_t buff[MAX_PATH + 1]; ::GetCurrentDirectoryW(MAX_PATH, buff); return buff; #else #ifndef PATH_MAX #define PATH_MAX 256 #endif char buff[PATH_MAX + 1]; return getcwd(buff, PATH_MAX) ? MyGUI::UString(buff).asWStr_c_str() : std::wstring(); #endif } using VectorWString = std::vector; inline void scanFolder( VectorWString& _result, const std::wstring& _folder, bool _recursive, const std::wstring& _mask, bool _fullpath) { std::wstring folder = _folder; if (!folder.empty() && *folder.rbegin() != '/' && *folder.rbegin() != '\\') folder += L"/"; VectorFileInfo result; getSystemFileList(result, folder, _mask); for (const auto& item : result) { if (item.folder) continue; if (_fullpath) _result.push_back(folder + item.name); else _result.push_back(item.name); } if (_recursive) { getSystemFileList(result, folder, L"*"); for (const auto& item : result) { if (!item.folder || item.name == L".." || item.name == L".") continue; scanFolder(_result, folder + item.name, _recursive, _mask, _fullpath); } } } } #endif // FILE_SYSTEM_INFO_H_ mygui-3.4.3+dfsg/Common/Input/000077500000000000000000000000001451556753500161415ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Input/InputConverter.h000066400000000000000000000664221451556753500213130ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 02/2010 @module */ #ifndef INPUT_CONVERTER_H_ #define INPUT_CONVERTER_H_ #include #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 #include #ifdef max #undef max #endif #ifdef min #undef min #endif #endif //#define INPUT_KEY_NAME #ifdef INPUT_KEY_NAME #include #include #endif namespace input { // Windows virtual keys enum VirtualKey { VLK_LBUTTON = 0x01, VLK_RBUTTON = 0x02, VLK_CANCEL = 0x03, VLK_MBUTTON = 0x04, /* NOT contiguous with L & RBUTTON */ VLK_XBUTTON1 = 0x05, /* NOT contiguous with L & RBUTTON */ VLK_XBUTTON2 = 0x06, /* NOT contiguous with L & RBUTTON */ /* 0x07 : unassigned */ VLK_BACK = 0x08, VLK_TAB = 0x09, /* 0x0A - 0x0B : reserved */ VLK_CLEAR = 0x0C, VLK_RETURN = 0x0D, VLK_SHIFT = 0x10, VLK_CONTROL = 0x11, VLK_MENU = 0x12, VLK_PAUSE = 0x13, VLK_CAPITAL = 0x14, VLK_KANA = 0x15, VLK_HANGEUL = 0x15, /* old name - should be here for compatibility */ VLK_HANGUL = 0x15, VLK_JUNJA = 0x17, VLK_FINAL = 0x18, VLK_HANJA = 0x19, VLK_KANJI = 0x19, VLK_ESCAPE = 0x1B, VLK_CONVERT = 0x1C, VLK_NONCONVERT = 0x1D, VLK_ACCEPT = 0x1E, VLK_MODECHANGE = 0x1F, VLK_SPACE = 0x20, VLK_PRIOR = 0x21, VLK_NEXT = 0x22, VLK_END = 0x23, VLK_HOME = 0x24, VLK_LEFT = 0x25, VLK_UP = 0x26, VLK_RIGHT = 0x27, VLK_DOWN = 0x28, VLK_SELECT = 0x29, VLK_PRINT = 0x2A, VLK_EXECUTE = 0x2B, VLK_SNAPSHOT = 0x2C, VLK_INSERT = 0x2D, VLK_DELETE = 0x2E, VLK_HELP = 0x2F, /* VLK_0 - VLK_9 are the same as ASCII '0' - '9' (0x30 - 0x39) 0x40 : unassigned VLK_A - VLK_Z are the same as ASCII 'A' - 'Z' (0x41 - 0x5A) */ VLK_0 = 0x30, VLK_1 = 0x31, VLK_2 = 0x32, VLK_3 = 0x33, VLK_4 = 0x34, VLK_5 = 0x35, VLK_6 = 0x36, VLK_7 = 0x37, VLK_8 = 0x38, VLK_9 = 0x39, VLK_A = 0x41, VLK_B = 0x42, VLK_C = 0x43, VLK_D = 0x44, VLK_E = 0x45, VLK_F = 0x46, VLK_G = 0x47, VLK_H = 0x48, VLK_I = 0x49, VLK_J = 0x4A, VLK_K = 0x4B, VLK_L = 0x4C, VLK_M = 0x4D, VLK_N = 0x4E, VLK_O = 0x4F, VLK_P = 0x50, VLK_Q = 0x51, VLK_R = 0x52, VLK_S = 0x53, VLK_T = 0x54, VLK_U = 0x55, VLK_V = 0x56, VLK_W = 0x57, VLK_X = 0x58, VLK_Y = 0x59, VLK_Z = 0x5A, VLK_LWIN = 0x5B, VLK_RWIN = 0x5C, VLK_APPS = 0x5D, /* 0x5E : reserved */ VLK_SLEEP = 0x5F, VLK_NUMPAD0 = 0x60, VLK_NUMPAD1 = 0x61, VLK_NUMPAD2 = 0x62, VLK_NUMPAD3 = 0x63, VLK_NUMPAD4 = 0x64, VLK_NUMPAD5 = 0x65, VLK_NUMPAD6 = 0x66, VLK_NUMPAD7 = 0x67, VLK_NUMPAD8 = 0x68, VLK_NUMPAD9 = 0x69, VLK_MULTIPLY = 0x6A, VLK_ADD = 0x6B, VLK_SEPARATOR = 0x6C, VLK_SUBTRACT = 0x6D, VLK_DECIMAL = 0x6E, VLK_DIVIDE = 0x6F, VLK_F1 = 0x70, VLK_F2 = 0x71, VLK_F3 = 0x72, VLK_F4 = 0x73, VLK_F5 = 0x74, VLK_F6 = 0x75, VLK_F7 = 0x76, VLK_F8 = 0x77, VLK_F9 = 0x78, VLK_F10 = 0x79, VLK_F11 = 0x7A, VLK_F12 = 0x7B, VLK_F13 = 0x7C, VLK_F14 = 0x7D, VLK_F15 = 0x7E, VLK_F16 = 0x7F, VLK_F17 = 0x80, VLK_F18 = 0x81, VLK_F19 = 0x82, VLK_F20 = 0x83, VLK_F21 = 0x84, VLK_F22 = 0x85, VLK_F23 = 0x86, VLK_F24 = 0x87, /* 0x88 - 0x8F : unassigned */ VLK_NUMLOCK = 0x90, VLK_SCROLL = 0x91, /* NEC PC-9800 kbd definitions */ VLK_OEM_NEC_EQUAL = 0x92, // '=' key on numpad /* Fujitsu/OASYS kbd definitions */ VLK_OEM_FJ_JISHO = 0x92, // 'Dictionary' key VLK_OEM_FJ_MASSHOU = 0x93, // 'Unregister word' key VLK_OEM_FJ_TOUROKU = 0x94, // 'Register word' key VLK_OEM_FJ_LOYA = 0x95, // 'Left OYAYUBI' key VLK_OEM_FJ_ROYA = 0x96, // 'Right OYAYUBI' key /* 0x97 - 0x9F : unassigned */ /* VLK_L* & VLK_R* - left and right Alt, Ctrl and Shift virtual keys. Used only as parameters to GetAsyncKeyState() and GetKeyState(). No other API or message will distinguish left and right keys in this way. */ VLK_LSHIFT = 0xA0, VLK_RSHIFT = 0xA1, VLK_LCONTROL = 0xA2, VLK_RCONTROL = 0xA3, VLK_LMENU = 0xA4, VLK_RMENU = 0xA5, VLK_BROWSER_BACK = 0xA6, VLK_BROWSER_FORWARD = 0xA7, VLK_BROWSER_REFRESH = 0xA8, VLK_BROWSER_STOP = 0xA9, VLK_BROWSER_SEARCH = 0xAA, VLK_BROWSER_FAVORITES = 0xAB, VLK_BROWSER_HOME = 0xAC, VLK_VOLUME_MUTE = 0xAD, VLK_VOLUME_DOWN = 0xAE, VLK_VOLUME_UP = 0xAF, VLK_MEDIA_NEXT_TRACK = 0xB0, VLK_MEDIA_PREV_TRACK = 0xB1, VLK_MEDIA_STOP = 0xB2, VLK_MEDIA_PLAY_PAUSE = 0xB3, VLK_LAUNCH_MAIL = 0xB4, VLK_LAUNCH_MEDIA_SELECT = 0xB5, VLK_LAUNCH_APP1 = 0xB6, VLK_LAUNCH_APP2 = 0xB7, /* 0xB8 - 0xB9 : reserved */ VLK_OEM_1 = 0xBA, // ';:' for US VLK_OEM_PLUS = 0xBB, // '+' any country VLK_OEM_COMMA = 0xBC, // ',' any country VLK_OEM_MINUS = 0xBD, // '-' any country VLK_OEM_PERIOD = 0xBE, // '.' any country VLK_OEM_2 = 0xBF, // '/?' for US VLK_OEM_3 = 0xC0, // '`~' for US /* 0xC1 - 0xD7 : reserved */ /* 0xD8 - 0xDA : unassigned */ VLK_OEM_4 = 0xDB, // '[{' for US VLK_OEM_5 = 0xDC, // '\|' for US VLK_OEM_6 = 0xDD, // ']}' for US VLK_OEM_7 = 0xDE, // ''"' for US VLK_OEM_8 = 0xDF, /* 0xE0 : reserved */ /* Various extended or enhanced keyboards */ VLK_OEM_AX = 0xE1, // 'AX' key on Japanese AX kbd VLK_OEM_102 = 0xE2, // "<>" or "\|" on RT 102-key kbd. VLK_ICO_HELP = 0xE3, // Help key on ICO VLK_ICO_00 = 0xE4, // 00 key on ICO VLK_PROCESSKEY = 0xE5, VLK_ICO_CLEAR = 0xE6, VLK_PACKET = 0xE7, /* 0xE8 : unassigned */ /* Nokia/Ericsson definitions */ VLK_OEM_RESET = 0xE9, VLK_OEM_JUMP = 0xEA, VLK_OEM_PA1 = 0xEB, VLK_OEM_PA2 = 0xEC, VLK_OEM_PA3 = 0xED, VLK_OEM_WSCTRL = 0xEE, VLK_OEM_CUSEL = 0xEF, VLK_OEM_ATTN = 0xF0, VLK_OEM_FINISH = 0xF1, VLK_OEM_COPY = 0xF2, VLK_OEM_AUTO = 0xF3, VLK_OEM_ENLW = 0xF4, VLK_OEM_BACKTAB = 0xF5, VLK_ATTN = 0xF6, VLK_CRSEL = 0xF7, VLK_EXSEL = 0xF8, VLK_EREOF = 0xF9, VLK_PLAY = 0xFA, VLK_ZOOM = 0xFB, VLK_NONAME = 0xFC, VLK_PA1 = 0xFD, VLK_OEM_CLEAR = 0xFE, VLK_MAX }; // Keyboard scan codes - DirectInput enum ScanCode { SC_UNASSIGNED = 0x00, SC_ESCAPE = 0x01, SC_1 = 0x02, SC_2 = 0x03, SC_3 = 0x04, SC_4 = 0x05, SC_5 = 0x06, SC_6 = 0x07, SC_7 = 0x08, SC_8 = 0x09, SC_9 = 0x0A, SC_0 = 0x0B, SC_MINUS = 0x0C, // - on main keyboard SC_EQUALS = 0x0D, SC_BACK = 0x0E, // backspace SC_TAB = 0x0F, SC_Q = 0x10, SC_W = 0x11, SC_E = 0x12, SC_R = 0x13, SC_T = 0x14, SC_Y = 0x15, SC_U = 0x16, SC_I = 0x17, SC_O = 0x18, SC_P = 0x19, SC_LBRACKET = 0x1A, SC_RBRACKET = 0x1B, SC_RETURN = 0x1C, // Enter on main keyboard SC_LCONTROL = 0x1D, SC_A = 0x1E, SC_S = 0x1F, SC_D = 0x20, SC_F = 0x21, SC_G = 0x22, SC_H = 0x23, SC_J = 0x24, SC_K = 0x25, SC_L = 0x26, SC_SEMICOLON = 0x27, SC_APOSTROPHE = 0x28, SC_GRAVE = 0x29, // accent SC_LSHIFT = 0x2A, SC_BACKSLASH = 0x2B, SC_Z = 0x2C, SC_X = 0x2D, SC_C = 0x2E, SC_V = 0x2F, SC_B = 0x30, SC_N = 0x31, SC_M = 0x32, SC_COMMA = 0x33, SC_PERIOD = 0x34, // . on main keyboard SC_SLASH = 0x35, // / on main keyboard SC_RSHIFT = 0x36, SC_MULTIPLY = 0x37, // * on numeric keypad SC_LMENU = 0x38, // left Alt SC_SPACE = 0x39, SC_CAPITAL = 0x3A, SC_F1 = 0x3B, SC_F2 = 0x3C, SC_F3 = 0x3D, SC_F4 = 0x3E, SC_F5 = 0x3F, SC_F6 = 0x40, SC_F7 = 0x41, SC_F8 = 0x42, SC_F9 = 0x43, SC_F10 = 0x44, SC_NUMLOCK = 0x45, SC_SCROLL = 0x46, // Scroll Lock SC_NUMPAD7 = 0x47, SC_NUMPAD8 = 0x48, SC_NUMPAD9 = 0x49, SC_SUBTRACT = 0x4A, // - on numeric keypad SC_NUMPAD4 = 0x4B, SC_NUMPAD5 = 0x4C, SC_NUMPAD6 = 0x4D, SC_ADD = 0x4E, // + on numeric keypad SC_NUMPAD1 = 0x4F, SC_NUMPAD2 = 0x50, SC_NUMPAD3 = 0x51, SC_NUMPAD0 = 0x52, SC_DECIMAL = 0x53, // . on numeric keypad SC_OEM_102 = 0x56, // < > | on UK/Germany keyboards SC_F11 = 0x57, SC_F12 = 0x58, SC_F13 = 0x64, // (NEC PC98) SC_F14 = 0x65, // (NEC PC98) SC_F15 = 0x66, // (NEC PC98) SC_KANA = 0x70, // (Japanese keyboard) SC_ABNT_C1 = 0x73, // / ? on Portugese (Brazilian) keyboards SC_CONVERT = 0x79, // (Japanese keyboard) SC_NOCONVERT = 0x7B, // (Japanese keyboard) SC_YEN = 0x7D, // (Japanese keyboard) SC_ABNT_C2 = 0x7E, // Numpad . on Portugese (Brazilian) keyboards SC_NUMPADEQUALS = 0x8D, // = on numeric keypad (NEC PC98) SC_PREVTRACK = 0x90, // Previous Track (SC_CIRCUMFLEX on Japanese keyboard) SC_AT = 0x91, // (NEC PC98) SC_COLON = 0x92, // (NEC PC98) SC_UNDERLINE = 0x93, // (NEC PC98) SC_KANJI = 0x94, // (Japanese keyboard) SC_STOP = 0x95, // (NEC PC98) SC_AX = 0x96, // (Japan AX) SC_UNLABELED = 0x97, // (J3100) SC_NEXTTRACK = 0x99, // Next Track SC_NUMPADENTER = 0x9C, // Enter on numeric keypad SC_RCONTROL = 0x9D, SC_MUTE = 0xA0, // Mute SC_CALCULATOR = 0xA1, // Calculator SC_PLAYPAUSE = 0xA2, // Play / Pause SC_MEDIASTOP = 0xA4, // Media Stop SC_VOLUMEDOWN = 0xAE, // Volume - SC_VOLUMEUP = 0xB0, // Volume + SC_WEBHOME = 0xB2, // Web home SC_NUMPADCOMMA = 0xB3, // , on numeric keypad (NEC PC98) SC_DIVIDE = 0xB5, // / on numeric keypad SC_SYSRQ = 0xB7, SC_RMENU = 0xB8, // right Alt SC_PAUSE = 0xC5, // Pause SC_HOME = 0xC7, // Home on arrow keypad SC_UP = 0xC8, // UpArrow on arrow keypad SC_PGUP = 0xC9, // PgUp on arrow keypad SC_LEFT = 0xCB, // LeftArrow on arrow keypad SC_RIGHT = 0xCD, // RightArrow on arrow keypad SC_END = 0xCF, // End on arrow keypad SC_DOWN = 0xD0, // DownArrow on arrow keypad SC_PGDOWN = 0xD1, // PgDn on arrow keypad SC_INSERT = 0xD2, // Insert on arrow keypad SC_DELETE = 0xD3, // Delete on arrow keypad SC_LWIN = 0xDB, // Left Windows key SC_RWIN = 0xDC, // Right Windows key SC_APPS = 0xDD, // AppMenu key SC_POWER = 0xDE, // System Power SC_SLEEP = 0xDF, // System Sleep SC_WAKE = 0xE3, // System Wake SC_WEBSEARCH = 0xE5, // Web Search SC_WEBFAVORITES = 0xE6, // Web Favorites SC_WEBREFRESH = 0xE7, // Web Refresh SC_WEBSTOP = 0xE8, // Web Stop SC_WEBFORWARD = 0xE9, // Web Forward SC_WEBBACK = 0xEA, // Web Back SC_MYCOMPUTER = 0xEB, // My Computer SC_MAIL = 0xEC, // Mail SC_MEDIASELECT = 0xED, // Media Select SC_MAX }; class Table { public: Table() { #ifdef INPUT_KEY_NAME mVirtualKeyToName.resize(VLK_MAX); #define DECLARE_VIRTUAL_KEY(_key) mVirtualKeyToName[_key] = #_key; DECLARE_VIRTUAL_KEY(VLK_LBUTTON) DECLARE_VIRTUAL_KEY(VLK_RBUTTON) DECLARE_VIRTUAL_KEY(VLK_CANCEL) DECLARE_VIRTUAL_KEY(VLK_MBUTTON) DECLARE_VIRTUAL_KEY(VLK_XBUTTON1) DECLARE_VIRTUAL_KEY(VLK_XBUTTON2) DECLARE_VIRTUAL_KEY(VLK_BACK) DECLARE_VIRTUAL_KEY(VLK_TAB) DECLARE_VIRTUAL_KEY(VLK_CLEAR) DECLARE_VIRTUAL_KEY(VLK_RETURN) DECLARE_VIRTUAL_KEY(VLK_SHIFT) DECLARE_VIRTUAL_KEY(VLK_CONTROL) DECLARE_VIRTUAL_KEY(VLK_MENU) DECLARE_VIRTUAL_KEY(VLK_PAUSE) DECLARE_VIRTUAL_KEY(VLK_CAPITAL) DECLARE_VIRTUAL_KEY(VLK_KANA) DECLARE_VIRTUAL_KEY(VLK_HANGEUL) DECLARE_VIRTUAL_KEY(VLK_HANGUL) DECLARE_VIRTUAL_KEY(VLK_JUNJA) DECLARE_VIRTUAL_KEY(VLK_FINAL) DECLARE_VIRTUAL_KEY(VLK_HANJA) DECLARE_VIRTUAL_KEY(VLK_KANJI) DECLARE_VIRTUAL_KEY(VLK_ESCAPE) DECLARE_VIRTUAL_KEY(VLK_CONVERT) DECLARE_VIRTUAL_KEY(VLK_NONCONVERT) DECLARE_VIRTUAL_KEY(VLK_ACCEPT) DECLARE_VIRTUAL_KEY(VLK_MODECHANGE) DECLARE_VIRTUAL_KEY(VLK_SPACE) DECLARE_VIRTUAL_KEY(VLK_PRIOR) DECLARE_VIRTUAL_KEY(VLK_NEXT) DECLARE_VIRTUAL_KEY(VLK_END) DECLARE_VIRTUAL_KEY(VLK_HOME) DECLARE_VIRTUAL_KEY(VLK_LEFT) DECLARE_VIRTUAL_KEY(VLK_UP) DECLARE_VIRTUAL_KEY(VLK_RIGHT) DECLARE_VIRTUAL_KEY(VLK_DOWN) DECLARE_VIRTUAL_KEY(VLK_SELECT) DECLARE_VIRTUAL_KEY(VLK_PRINT) DECLARE_VIRTUAL_KEY(VLK_EXECUTE) DECLARE_VIRTUAL_KEY(VLK_SNAPSHOT) DECLARE_VIRTUAL_KEY(VLK_INSERT) DECLARE_VIRTUAL_KEY(VLK_DELETE) DECLARE_VIRTUAL_KEY(VLK_HELP) DECLARE_VIRTUAL_KEY(VLK_0) DECLARE_VIRTUAL_KEY(VLK_1) DECLARE_VIRTUAL_KEY(VLK_2) DECLARE_VIRTUAL_KEY(VLK_3) DECLARE_VIRTUAL_KEY(VLK_4) DECLARE_VIRTUAL_KEY(VLK_5) DECLARE_VIRTUAL_KEY(VLK_6) DECLARE_VIRTUAL_KEY(VLK_7) DECLARE_VIRTUAL_KEY(VLK_8) DECLARE_VIRTUAL_KEY(VLK_9) DECLARE_VIRTUAL_KEY(VLK_A) DECLARE_VIRTUAL_KEY(VLK_B) DECLARE_VIRTUAL_KEY(VLK_C) DECLARE_VIRTUAL_KEY(VLK_D) DECLARE_VIRTUAL_KEY(VLK_E) DECLARE_VIRTUAL_KEY(VLK_F) DECLARE_VIRTUAL_KEY(VLK_G) DECLARE_VIRTUAL_KEY(VLK_H) DECLARE_VIRTUAL_KEY(VLK_I) DECLARE_VIRTUAL_KEY(VLK_J) DECLARE_VIRTUAL_KEY(VLK_K) DECLARE_VIRTUAL_KEY(VLK_L) DECLARE_VIRTUAL_KEY(VLK_M) DECLARE_VIRTUAL_KEY(VLK_N) DECLARE_VIRTUAL_KEY(VLK_O) DECLARE_VIRTUAL_KEY(VLK_P) DECLARE_VIRTUAL_KEY(VLK_Q) DECLARE_VIRTUAL_KEY(VLK_R) DECLARE_VIRTUAL_KEY(VLK_S) DECLARE_VIRTUAL_KEY(VLK_T) DECLARE_VIRTUAL_KEY(VLK_U) DECLARE_VIRTUAL_KEY(VLK_V) DECLARE_VIRTUAL_KEY(VLK_W) DECLARE_VIRTUAL_KEY(VLK_X) DECLARE_VIRTUAL_KEY(VLK_Y) DECLARE_VIRTUAL_KEY(VLK_Z) DECLARE_VIRTUAL_KEY(VLK_LWIN) DECLARE_VIRTUAL_KEY(VLK_RWIN) DECLARE_VIRTUAL_KEY(VLK_APPS) DECLARE_VIRTUAL_KEY(VLK_SLEEP) DECLARE_VIRTUAL_KEY(VLK_NUMPAD0) DECLARE_VIRTUAL_KEY(VLK_NUMPAD1) DECLARE_VIRTUAL_KEY(VLK_NUMPAD2) DECLARE_VIRTUAL_KEY(VLK_NUMPAD3) DECLARE_VIRTUAL_KEY(VLK_NUMPAD4) DECLARE_VIRTUAL_KEY(VLK_NUMPAD5) DECLARE_VIRTUAL_KEY(VLK_NUMPAD6) DECLARE_VIRTUAL_KEY(VLK_NUMPAD7) DECLARE_VIRTUAL_KEY(VLK_NUMPAD8) DECLARE_VIRTUAL_KEY(VLK_NUMPAD9) DECLARE_VIRTUAL_KEY(VLK_MULTIPLY) DECLARE_VIRTUAL_KEY(VLK_ADD) DECLARE_VIRTUAL_KEY(VLK_SEPARATOR) DECLARE_VIRTUAL_KEY(VLK_SUBTRACT) DECLARE_VIRTUAL_KEY(VLK_DECIMAL) DECLARE_VIRTUAL_KEY(VLK_DIVIDE) DECLARE_VIRTUAL_KEY(VLK_F1) DECLARE_VIRTUAL_KEY(VLK_F2) DECLARE_VIRTUAL_KEY(VLK_F3) DECLARE_VIRTUAL_KEY(VLK_F4) DECLARE_VIRTUAL_KEY(VLK_F5) DECLARE_VIRTUAL_KEY(VLK_F6) DECLARE_VIRTUAL_KEY(VLK_F7) DECLARE_VIRTUAL_KEY(VLK_F8) DECLARE_VIRTUAL_KEY(VLK_F9) DECLARE_VIRTUAL_KEY(VLK_F10) DECLARE_VIRTUAL_KEY(VLK_F11) DECLARE_VIRTUAL_KEY(VLK_F12) DECLARE_VIRTUAL_KEY(VLK_F13) DECLARE_VIRTUAL_KEY(VLK_F14) DECLARE_VIRTUAL_KEY(VLK_F15) DECLARE_VIRTUAL_KEY(VLK_F16) DECLARE_VIRTUAL_KEY(VLK_F17) DECLARE_VIRTUAL_KEY(VLK_F18) DECLARE_VIRTUAL_KEY(VLK_F19) DECLARE_VIRTUAL_KEY(VLK_F20) DECLARE_VIRTUAL_KEY(VLK_F21) DECLARE_VIRTUAL_KEY(VLK_F22) DECLARE_VIRTUAL_KEY(VLK_F23) DECLARE_VIRTUAL_KEY(VLK_F24) DECLARE_VIRTUAL_KEY(VLK_NUMLOCK) DECLARE_VIRTUAL_KEY(VLK_SCROLL) DECLARE_VIRTUAL_KEY(VLK_OEM_NEC_EQUAL) DECLARE_VIRTUAL_KEY(VLK_OEM_FJ_JISHO) DECLARE_VIRTUAL_KEY(VLK_OEM_FJ_MASSHOU) DECLARE_VIRTUAL_KEY(VLK_OEM_FJ_TOUROKU) DECLARE_VIRTUAL_KEY(VLK_OEM_FJ_LOYA) DECLARE_VIRTUAL_KEY(VLK_OEM_FJ_ROYA) DECLARE_VIRTUAL_KEY(VLK_LSHIFT) DECLARE_VIRTUAL_KEY(VLK_RSHIFT) DECLARE_VIRTUAL_KEY(VLK_LCONTROL) DECLARE_VIRTUAL_KEY(VLK_RCONTROL) DECLARE_VIRTUAL_KEY(VLK_LMENU) DECLARE_VIRTUAL_KEY(VLK_RMENU) DECLARE_VIRTUAL_KEY(VLK_BROWSER_BACK) DECLARE_VIRTUAL_KEY(VLK_BROWSER_FORWARD) DECLARE_VIRTUAL_KEY(VLK_BROWSER_REFRESH) DECLARE_VIRTUAL_KEY(VLK_BROWSER_STOP) DECLARE_VIRTUAL_KEY(VLK_BROWSER_SEARCH) DECLARE_VIRTUAL_KEY(VLK_BROWSER_FAVORITES) DECLARE_VIRTUAL_KEY(VLK_BROWSER_HOME) DECLARE_VIRTUAL_KEY(VLK_VOLUME_MUTE) DECLARE_VIRTUAL_KEY(VLK_VOLUME_DOWN) DECLARE_VIRTUAL_KEY(VLK_VOLUME_UP) DECLARE_VIRTUAL_KEY(VLK_MEDIA_NEXT_TRACK) DECLARE_VIRTUAL_KEY(VLK_MEDIA_PREV_TRACK) DECLARE_VIRTUAL_KEY(VLK_MEDIA_STOP) DECLARE_VIRTUAL_KEY(VLK_MEDIA_PLAY_PAUSE) DECLARE_VIRTUAL_KEY(VLK_LAUNCH_MAIL) DECLARE_VIRTUAL_KEY(VLK_LAUNCH_MEDIA_SELECT) DECLARE_VIRTUAL_KEY(VLK_LAUNCH_APP1) DECLARE_VIRTUAL_KEY(VLK_LAUNCH_APP2) DECLARE_VIRTUAL_KEY(VLK_OEM_1) DECLARE_VIRTUAL_KEY(VLK_OEM_PLUS) DECLARE_VIRTUAL_KEY(VLK_OEM_COMMA) DECLARE_VIRTUAL_KEY(VLK_OEM_MINUS) DECLARE_VIRTUAL_KEY(VLK_OEM_PERIOD) DECLARE_VIRTUAL_KEY(VLK_OEM_2) DECLARE_VIRTUAL_KEY(VLK_OEM_3) DECLARE_VIRTUAL_KEY(VLK_OEM_4) DECLARE_VIRTUAL_KEY(VLK_OEM_5) DECLARE_VIRTUAL_KEY(VLK_OEM_6) DECLARE_VIRTUAL_KEY(VLK_OEM_7) DECLARE_VIRTUAL_KEY(VLK_OEM_8) DECLARE_VIRTUAL_KEY(VLK_OEM_AX) DECLARE_VIRTUAL_KEY(VLK_OEM_102) DECLARE_VIRTUAL_KEY(VLK_ICO_HELP) DECLARE_VIRTUAL_KEY(VLK_ICO_00) DECLARE_VIRTUAL_KEY(VLK_PROCESSKEY) DECLARE_VIRTUAL_KEY(VLK_ICO_CLEAR) DECLARE_VIRTUAL_KEY(VLK_PACKET) DECLARE_VIRTUAL_KEY(VLK_OEM_RESET) DECLARE_VIRTUAL_KEY(VLK_OEM_JUMP) DECLARE_VIRTUAL_KEY(VLK_OEM_PA1) DECLARE_VIRTUAL_KEY(VLK_OEM_PA2) DECLARE_VIRTUAL_KEY(VLK_OEM_PA3) DECLARE_VIRTUAL_KEY(VLK_OEM_WSCTRL) DECLARE_VIRTUAL_KEY(VLK_OEM_CUSEL) DECLARE_VIRTUAL_KEY(VLK_OEM_ATTN) DECLARE_VIRTUAL_KEY(VLK_OEM_FINISH) DECLARE_VIRTUAL_KEY(VLK_OEM_COPY) DECLARE_VIRTUAL_KEY(VLK_OEM_AUTO) DECLARE_VIRTUAL_KEY(VLK_OEM_ENLW) DECLARE_VIRTUAL_KEY(VLK_OEM_BACKTAB) DECLARE_VIRTUAL_KEY(VLK_ATTN) DECLARE_VIRTUAL_KEY(VLK_CRSEL) DECLARE_VIRTUAL_KEY(VLK_EXSEL) DECLARE_VIRTUAL_KEY(VLK_EREOF) DECLARE_VIRTUAL_KEY(VLK_PLAY) DECLARE_VIRTUAL_KEY(VLK_ZOOM) DECLARE_VIRTUAL_KEY(VLK_NONAME) DECLARE_VIRTUAL_KEY(VLK_PA1) DECLARE_VIRTUAL_KEY(VLK_OEM_CLEAR) #undef DECLARE_VIRTUAL_KEY mScanCodeToName.resize(SC_MAX); #define DECLARE_SCAN_CODE(_code) mScanCodeToName[_code] = #_code; DECLARE_SCAN_CODE(SC_ESCAPE) DECLARE_SCAN_CODE(SC_1) DECLARE_SCAN_CODE(SC_2) DECLARE_SCAN_CODE(SC_3) DECLARE_SCAN_CODE(SC_4) DECLARE_SCAN_CODE(SC_5) DECLARE_SCAN_CODE(SC_6) DECLARE_SCAN_CODE(SC_7) DECLARE_SCAN_CODE(SC_8) DECLARE_SCAN_CODE(SC_9) DECLARE_SCAN_CODE(SC_0) DECLARE_SCAN_CODE(SC_MINUS) DECLARE_SCAN_CODE(SC_EQUALS) DECLARE_SCAN_CODE(SC_BACK) DECLARE_SCAN_CODE(SC_TAB) DECLARE_SCAN_CODE(SC_Q) DECLARE_SCAN_CODE(SC_W) DECLARE_SCAN_CODE(SC_E) DECLARE_SCAN_CODE(SC_R) DECLARE_SCAN_CODE(SC_T) DECLARE_SCAN_CODE(SC_Y) DECLARE_SCAN_CODE(SC_U) DECLARE_SCAN_CODE(SC_I) DECLARE_SCAN_CODE(SC_O) DECLARE_SCAN_CODE(SC_P) DECLARE_SCAN_CODE(SC_LBRACKET) DECLARE_SCAN_CODE(SC_RBRACKET) DECLARE_SCAN_CODE(SC_RETURN) DECLARE_SCAN_CODE(SC_LCONTROL) DECLARE_SCAN_CODE(SC_A) DECLARE_SCAN_CODE(SC_S) DECLARE_SCAN_CODE(SC_D) DECLARE_SCAN_CODE(SC_F) DECLARE_SCAN_CODE(SC_G) DECLARE_SCAN_CODE(SC_H) DECLARE_SCAN_CODE(SC_J) DECLARE_SCAN_CODE(SC_K) DECLARE_SCAN_CODE(SC_L) DECLARE_SCAN_CODE(SC_SEMICOLON) DECLARE_SCAN_CODE(SC_APOSTROPHE) DECLARE_SCAN_CODE(SC_GRAVE) DECLARE_SCAN_CODE(SC_LSHIFT) DECLARE_SCAN_CODE(SC_BACKSLASH) DECLARE_SCAN_CODE(SC_Z) DECLARE_SCAN_CODE(SC_X) DECLARE_SCAN_CODE(SC_C) DECLARE_SCAN_CODE(SC_V) DECLARE_SCAN_CODE(SC_B) DECLARE_SCAN_CODE(SC_N) DECLARE_SCAN_CODE(SC_M) DECLARE_SCAN_CODE(SC_COMMA) DECLARE_SCAN_CODE(SC_PERIOD) DECLARE_SCAN_CODE(SC_SLASH) DECLARE_SCAN_CODE(SC_RSHIFT) DECLARE_SCAN_CODE(SC_MULTIPLY) DECLARE_SCAN_CODE(SC_LMENU) DECLARE_SCAN_CODE(SC_SPACE) DECLARE_SCAN_CODE(SC_CAPITAL) DECLARE_SCAN_CODE(SC_F1) DECLARE_SCAN_CODE(SC_F2) DECLARE_SCAN_CODE(SC_F3) DECLARE_SCAN_CODE(SC_F4) DECLARE_SCAN_CODE(SC_F5) DECLARE_SCAN_CODE(SC_F6) DECLARE_SCAN_CODE(SC_F7) DECLARE_SCAN_CODE(SC_F8) DECLARE_SCAN_CODE(SC_F9) DECLARE_SCAN_CODE(SC_F10) DECLARE_SCAN_CODE(SC_NUMLOCK) DECLARE_SCAN_CODE(SC_SCROLL) DECLARE_SCAN_CODE(SC_NUMPAD7) DECLARE_SCAN_CODE(SC_NUMPAD8) DECLARE_SCAN_CODE(SC_NUMPAD9) DECLARE_SCAN_CODE(SC_SUBTRACT) DECLARE_SCAN_CODE(SC_NUMPAD4) DECLARE_SCAN_CODE(SC_NUMPAD5) DECLARE_SCAN_CODE(SC_NUMPAD6) DECLARE_SCAN_CODE(SC_ADD) DECLARE_SCAN_CODE(SC_NUMPAD1) DECLARE_SCAN_CODE(SC_NUMPAD2) DECLARE_SCAN_CODE(SC_NUMPAD3) DECLARE_SCAN_CODE(SC_NUMPAD0) DECLARE_SCAN_CODE(SC_DECIMAL) DECLARE_SCAN_CODE(SC_OEM_102) DECLARE_SCAN_CODE(SC_F11) DECLARE_SCAN_CODE(SC_F12) DECLARE_SCAN_CODE(SC_F13) DECLARE_SCAN_CODE(SC_F14) DECLARE_SCAN_CODE(SC_F15) DECLARE_SCAN_CODE(SC_KANA) DECLARE_SCAN_CODE(SC_ABNT_C1) DECLARE_SCAN_CODE(SC_CONVERT) DECLARE_SCAN_CODE(SC_NOCONVERT) DECLARE_SCAN_CODE(SC_YEN) DECLARE_SCAN_CODE(SC_ABNT_C2) DECLARE_SCAN_CODE(SC_NUMPADEQUALS) DECLARE_SCAN_CODE(SC_PREVTRACK) DECLARE_SCAN_CODE(SC_AT) DECLARE_SCAN_CODE(SC_COLON) DECLARE_SCAN_CODE(SC_UNDERLINE) DECLARE_SCAN_CODE(SC_KANJI) DECLARE_SCAN_CODE(SC_STOP) DECLARE_SCAN_CODE(SC_AX) DECLARE_SCAN_CODE(SC_UNLABELED) DECLARE_SCAN_CODE(SC_NEXTTRACK) DECLARE_SCAN_CODE(SC_NUMPADENTER) DECLARE_SCAN_CODE(SC_RCONTROL) DECLARE_SCAN_CODE(SC_MUTE) DECLARE_SCAN_CODE(SC_CALCULATOR) DECLARE_SCAN_CODE(SC_PLAYPAUSE) DECLARE_SCAN_CODE(SC_MEDIASTOP) DECLARE_SCAN_CODE(SC_VOLUMEDOWN) DECLARE_SCAN_CODE(SC_VOLUMEUP) DECLARE_SCAN_CODE(SC_WEBHOME) DECLARE_SCAN_CODE(SC_NUMPADCOMMA) DECLARE_SCAN_CODE(SC_DIVIDE) DECLARE_SCAN_CODE(SC_SYSRQ) DECLARE_SCAN_CODE(SC_RMENU) DECLARE_SCAN_CODE(SC_PAUSE) DECLARE_SCAN_CODE(SC_HOME) DECLARE_SCAN_CODE(SC_UP) DECLARE_SCAN_CODE(SC_PGUP) DECLARE_SCAN_CODE(SC_LEFT) DECLARE_SCAN_CODE(SC_RIGHT) DECLARE_SCAN_CODE(SC_END) DECLARE_SCAN_CODE(SC_DOWN) DECLARE_SCAN_CODE(SC_PGDOWN) DECLARE_SCAN_CODE(SC_INSERT) DECLARE_SCAN_CODE(SC_DELETE) DECLARE_SCAN_CODE(SC_LWIN) DECLARE_SCAN_CODE(SC_RWIN) DECLARE_SCAN_CODE(SC_APPS) DECLARE_SCAN_CODE(SC_POWER) DECLARE_SCAN_CODE(SC_SLEEP) DECLARE_SCAN_CODE(SC_WAKE) DECLARE_SCAN_CODE(SC_WEBSEARCH) DECLARE_SCAN_CODE(SC_WEBFAVORITES) DECLARE_SCAN_CODE(SC_WEBREFRESH) DECLARE_SCAN_CODE(SC_WEBSTOP) DECLARE_SCAN_CODE(SC_WEBFORWARD) DECLARE_SCAN_CODE(SC_WEBBACK) DECLARE_SCAN_CODE(SC_MYCOMPUTER) DECLARE_SCAN_CODE(SC_MAIL) DECLARE_SCAN_CODE(SC_MEDIASELECT) #undef DECLARE_SCAN_CODE #endif memset(mVirtualKeyToScanCode, 0, VLK_MAX); memset(mScanCodeToVirtualKey, 0, SC_MAX); #define ADD_MAP(_keyName) \ mVirtualKeyToScanCode[VLK_##_keyName] = SC_##_keyName; \ mScanCodeToVirtualKey[SC_##_keyName] = VLK_##_keyName; #define ADD_MAP2(_virtualKey, _scanCode) \ mVirtualKeyToScanCode[VLK_##_virtualKey] = SC_##_scanCode; \ mScanCodeToVirtualKey[SC_##_scanCode] = VLK_##_virtualKey; ADD_MAP(0) ADD_MAP(1) ADD_MAP(2) ADD_MAP(3) ADD_MAP(4) ADD_MAP(5) ADD_MAP(6) ADD_MAP(7) ADD_MAP(8) ADD_MAP(9) ADD_MAP(A) ADD_MAP(B) ADD_MAP(C) ADD_MAP(D) ADD_MAP(E) ADD_MAP(F) ADD_MAP(G) ADD_MAP(H) ADD_MAP(I) ADD_MAP(J) ADD_MAP(K) ADD_MAP(L) ADD_MAP(M) ADD_MAP(N) ADD_MAP(O) ADD_MAP(P) ADD_MAP(Q) ADD_MAP(R) ADD_MAP(S) ADD_MAP(T) ADD_MAP(U) ADD_MAP(V) ADD_MAP(W) ADD_MAP(X) ADD_MAP(Y) ADD_MAP(Z) ADD_MAP(F1) ADD_MAP(F2) ADD_MAP(F3) ADD_MAP(F4) ADD_MAP(F5) ADD_MAP(F6) ADD_MAP(F7) ADD_MAP(F8) ADD_MAP(F9) ADD_MAP(F10) ADD_MAP(F11) ADD_MAP(F12) ADD_MAP(F13) ADD_MAP(F14) ADD_MAP(F15) ADD_MAP(NUMPAD0) ADD_MAP(NUMPAD1) ADD_MAP(NUMPAD2) ADD_MAP(NUMPAD3) ADD_MAP(NUMPAD4) ADD_MAP(NUMPAD5) ADD_MAP(NUMPAD6) ADD_MAP(NUMPAD7) ADD_MAP(NUMPAD8) ADD_MAP(NUMPAD9) ADD_MAP(ESCAPE) ADD_MAP(TAB) ADD_MAP(RETURN) ADD_MAP(SPACE) ADD_MAP(BACK) ADD_MAP2(SCROLL, SCROLL) ADD_MAP2(PAUSE, PAUSE) ADD_MAP2(OEM_3, GRAVE) ADD_MAP2(OEM_MINUS, MINUS) ADD_MAP2(OEM_PLUS, EQUALS) ADD_MAP2(OEM_5, BACKSLASH) ADD_MAP2(OEM_4, LBRACKET) ADD_MAP2(OEM_6, RBRACKET) ADD_MAP2(CAPITAL, CAPITAL) ADD_MAP2(OEM_1, SEMICOLON) ADD_MAP2(OEM_7, APOSTROPHE) ADD_MAP2(SHIFT, LSHIFT) ADD_MAP2(OEM_COMMA, COMMA) ADD_MAP2(OEM_PERIOD, PERIOD) ADD_MAP2(OEM_2, SLASH) ADD_MAP2(CONTROL, LCONTROL) ADD_MAP2(LWIN, LWIN) ADD_MAP2(RWIN, RWIN) ADD_MAP2(APPS, APPS) ADD_MAP2(MENU, LMENU) ADD_MAP2(LEFT, LEFT) ADD_MAP2(RIGHT, RIGHT) ADD_MAP2(UP, UP) ADD_MAP2(DOWN, DOWN) ADD_MAP2(INSERT, INSERT) ADD_MAP2(DELETE, DELETE) ADD_MAP2(HOME, HOME) ADD_MAP2(END, END) ADD_MAP2(PRIOR, PGUP) ADD_MAP2(NEXT, PGDOWN) ADD_MAP2(SNAPSHOT, SYSRQ) ADD_MAP2(NUMLOCK, NUMLOCK) ADD_MAP2(DIVIDE, DIVIDE) ADD_MAP2(MULTIPLY, MULTIPLY) ADD_MAP2(SUBTRACT, SUBTRACT) ADD_MAP2(ADD, ADD) ADD_MAP2(DECIMAL, DECIMAL) ADD_MAP(NUMPAD0) ADD_MAP(NUMPAD1) ADD_MAP(NUMPAD2) ADD_MAP(NUMPAD3) ADD_MAP(NUMPAD4) ADD_MAP(NUMPAD5) ADD_MAP(NUMPAD6) ADD_MAP(NUMPAD7) ADD_MAP(NUMPAD8) ADD_MAP(NUMPAD9) #undef ADD_MAP #undef ADD_MAP2 } int VirtualKeyToScanCode(WPARAM _virtualKey) const { if (_virtualKey < VLK_MAX) return (int)mVirtualKeyToScanCode[_virtualKey]; return 0; } int ScanCodeToVirtualKey(int _scanCode) const { if (_scanCode < SC_MAX) return (int)mScanCodeToVirtualKey[_scanCode]; return 0; } #ifdef INPUT_KEY_NAME std::string_view VirtualKeyToName(WPARAM _virtualKey) const { if (_virtualKey < VLK_MAX) return mVirtualKeyToName[_virtualKey]; return {}; } std::string_view ScanCodeToName(int _scanCode) const { if (_scanCode < SC_MAX) return mScanCodeToName[_scanCode]; return {}; } #endif private: unsigned char mVirtualKeyToScanCode[VLK_MAX]; unsigned char mScanCodeToVirtualKey[SC_MAX]; #ifdef INPUT_KEY_NAME std::vector mVirtualKeyToName; std::vector mScanCodeToName; #endif }; const Table& getTable() { static Table table; return table; } int VirtualKeyToScanCode(WPARAM _virtualKey) { const Table& table = getTable(); return table.VirtualKeyToScanCode(_virtualKey); } int ScanCodeToVirtualKey(int _scanCode) { const Table& table = getTable(); return table.ScanCodeToVirtualKey(_scanCode); } #ifdef INPUT_KEY_NAME std::string_view VirtualKeyToName(WPARAM _virtualKey) { const Table& table = getTable(); return table.VirtualKeyToName(_virtualKey); } std::string_view ScanCodeToName(int _scanCode) { const Table& table = getTable(); return table.ScanCodeToName(_scanCode); } #endif #if MYGUI_PLATFORM == MYGUI_PLATFORM_WIN32 int VirtualKeyToText(WPARAM _virtualKey) { static WCHAR deadKey = 0; BYTE keyState[256]; HKL layout = GetKeyboardLayout(0); if (GetKeyboardState(keyState) == 0) return 0; WCHAR buff[3] = {0, 0, 0}; int ascii = ToUnicodeEx((UINT)_virtualKey, 0, keyState, buff, 3, 0, layout); if (ascii == 1 && deadKey != '\0') { // A dead key is stored and we have just converted a character key // Combine the two into a single character WCHAR wcBuff[3] = {buff[0], deadKey, '\0'}; WCHAR out[3]; deadKey = '\0'; if (FoldStringW(MAP_PRECOMPOSED, (LPWSTR)wcBuff, 3, (LPWSTR)out, 3)) return out[0]; } else if (ascii == 1) { // We have a single character deadKey = '\0'; return buff[0]; } else if (ascii == 2) { // Convert a non-combining diacritical mark into a combining diacritical mark // Combining versions range from 0x300 to 0x36F; only 5 (for French) have been mapped below // http://www.fileformat.info/info/unicode/block/combining_diacritical_marks/images.htm switch (buff[0]) { case 0x5E: // Circumflex accent: в deadKey = 0x302; break; case 0x60: // Grave accent: а deadKey = 0x300; break; case 0xA8: // Diaeresis: ь deadKey = 0x308; break; case 0xB4: // Acute accent: й deadKey = 0x301; break; case 0xB8: // Cedilla: з deadKey = 0x327; break; default: deadKey = buff[0]; break; } } return 0; } int ScanCodeToText(int _scanCode) { HKL layout = GetKeyboardLayout(0); unsigned int vk = MapVirtualKeyEx((UINT)_scanCode, 3 /*MAPVK_VSC_TO_VK_EX*/, layout); if (vk == 0) return 0; return VirtualKeyToText(vk); } #endif } #endif // INPUT_CONVERTER_H_ mygui-3.4.3+dfsg/Common/Input/SDL/000077500000000000000000000000001451556753500165635ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/Input/SDL/InputManager.cpp000066400000000000000000000227201451556753500216640ustar00rootroot00000000000000#include "Precompiled.h" #include "InputManager.h" namespace input { InputManager::InputManager() { // build the virtual key map and mouse button between SDL and MyGUI buildVKeyMap(); buildMouseButtonMap(); } struct KeyMapItem { int sdlKey; MyGUI::KeyCode myguiKey; }; static KeyMapItem mapItems[] = { {0, MyGUI::KeyCode::None}, {SDLK_UNKNOWN, MyGUI::KeyCode::None}, {SDLK_ESCAPE, MyGUI::KeyCode::Escape}, {SDLK_1, MyGUI::KeyCode::One}, {SDLK_2, MyGUI::KeyCode::Two}, {SDLK_3, MyGUI::KeyCode::Three}, {SDLK_4, MyGUI::KeyCode::Four}, {SDLK_5, MyGUI::KeyCode::Five}, {SDLK_6, MyGUI::KeyCode::Six}, {SDLK_7, MyGUI::KeyCode::Seven}, {SDLK_8, MyGUI::KeyCode::Eight}, {SDLK_9, MyGUI::KeyCode::Nine}, {SDLK_0, MyGUI::KeyCode::Zero}, {SDLK_MINUS, MyGUI::KeyCode::Minus}, {SDLK_EQUALS, MyGUI::KeyCode::Equals}, {SDLK_BACKSPACE, MyGUI::KeyCode::Backspace}, {SDLK_TAB, MyGUI::KeyCode::Tab}, {SDLK_q, MyGUI::KeyCode::Q}, {SDLK_w, MyGUI::KeyCode::W}, {SDLK_e, MyGUI::KeyCode::E}, {SDLK_r, MyGUI::KeyCode::R}, {SDLK_t, MyGUI::KeyCode::T}, {SDLK_y, MyGUI::KeyCode::Y}, {SDLK_u, MyGUI::KeyCode::U}, {SDLK_i, MyGUI::KeyCode::I}, {SDLK_o, MyGUI::KeyCode::O}, {SDLK_p, MyGUI::KeyCode::P}, {SDLK_LEFTBRACKET, MyGUI::KeyCode::LeftBracket}, {SDLK_RIGHTBRACKET, MyGUI::KeyCode::RightBracket}, {SDLK_RETURN, MyGUI::KeyCode::Return}, {SDLK_LCTRL, MyGUI::KeyCode::LeftControl}, {SDLK_a, MyGUI::KeyCode::A}, {SDLK_s, MyGUI::KeyCode::S}, {SDLK_d, MyGUI::KeyCode::D}, {SDLK_f, MyGUI::KeyCode::F}, {SDLK_g, MyGUI::KeyCode::G}, {SDLK_h, MyGUI::KeyCode::H}, {SDLK_j, MyGUI::KeyCode::J}, {SDLK_k, MyGUI::KeyCode::K}, {SDLK_l, MyGUI::KeyCode::L}, {SDLK_SEMICOLON, MyGUI::KeyCode::Semicolon}, {SDLK_QUOTEDBL, MyGUI::KeyCode::Apostrophe}, {SDLK_BACKQUOTE, MyGUI::KeyCode::Grave}, {SDLK_LSHIFT, MyGUI::KeyCode::LeftShift}, {SDLK_BACKSLASH, MyGUI::KeyCode::Backslash}, {SDLK_z, MyGUI::KeyCode::Z}, {SDLK_x, MyGUI::KeyCode::X}, {SDLK_c, MyGUI::KeyCode::C}, {SDLK_v, MyGUI::KeyCode::V}, {SDLK_b, MyGUI::KeyCode::B}, {SDLK_n, MyGUI::KeyCode::N}, {SDLK_m, MyGUI::KeyCode::M}, {SDLK_COMMA, MyGUI::KeyCode::Comma}, {SDLK_PERIOD, MyGUI::KeyCode::Period}, {SDLK_SLASH, MyGUI::KeyCode::Slash}, {SDLK_RSHIFT, MyGUI::KeyCode::RightShift}, {SDLK_KP_MULTIPLY, MyGUI::KeyCode::Multiply}, {SDLK_LALT, MyGUI::KeyCode::LeftAlt}, {SDLK_SPACE, MyGUI::KeyCode::Space}, {SDLK_CAPSLOCK, MyGUI::KeyCode::Capital}, {SDLK_F1, MyGUI::KeyCode::F1}, {SDLK_F2, MyGUI::KeyCode::F2}, {SDLK_F3, MyGUI::KeyCode::F3}, {SDLK_F4, MyGUI::KeyCode::F4}, {SDLK_F5, MyGUI::KeyCode::F5}, {SDLK_F6, MyGUI::KeyCode::F6}, {SDLK_F7, MyGUI::KeyCode::F7}, {SDLK_F8, MyGUI::KeyCode::F8}, {SDLK_F9, MyGUI::KeyCode::F9}, {SDLK_F10, MyGUI::KeyCode::F10}, {SDLK_NUMLOCKCLEAR, MyGUI::KeyCode::NumLock}, {SDLK_SCROLLLOCK, MyGUI::KeyCode::ScrollLock}, {SDLK_KP_7, MyGUI::KeyCode::Numpad7}, {SDLK_KP_8, MyGUI::KeyCode::Numpad8}, {SDLK_KP_9, MyGUI::KeyCode::Numpad9}, {SDLK_KP_MINUS, MyGUI::KeyCode::Subtract}, {SDLK_KP_4, MyGUI::KeyCode::Numpad4}, {SDLK_KP_5, MyGUI::KeyCode::Numpad5}, {SDLK_KP_6, MyGUI::KeyCode::Numpad6}, {SDLK_KP_PLUS, MyGUI::KeyCode::Add}, {SDLK_KP_1, MyGUI::KeyCode::Numpad1}, {SDLK_KP_2, MyGUI::KeyCode::Numpad2}, {SDLK_KP_3, MyGUI::KeyCode::Numpad3}, {SDLK_KP_0, MyGUI::KeyCode::Numpad0}, {SDLK_KP_PERIOD, MyGUI::KeyCode::Decimal}, //{, MyGUI::KeyCode::OEM_102}, {SDLK_F11, MyGUI::KeyCode::F11}, {SDLK_F12, MyGUI::KeyCode::F12}, {SDLK_F13, MyGUI::KeyCode::F13}, {SDLK_F14, MyGUI::KeyCode::F14}, {SDLK_F15, MyGUI::KeyCode::F15}, //{, MyGUI::KeyCode::Kana}, //{, MyGUI::KeyCode::ABNT_C1}, //{, MyGUI::KeyCode::Convert}, //{, MyGUI::KeyCode::NoConvert}, //{, MyGUI::KeyCode::Yen}, //{, MyGUI::KeyCode::ABNT_C2}, {SDLK_KP_EQUALS, MyGUI::KeyCode::NumpadEquals}, //{, MyGUI::KeyCode::PrevTrack}, //{, MyGUI::KeyCode::At}, //{, MyGUI::KeyCode::Colon}, //{, MyGUI::KeyCode::Underline}, //{, MyGUI::KeyCode::Kanji}, //{, MyGUI::KeyCode::Stop}, //{, MyGUI::KeyCode::AX}, //{, MyGUI::KeyCode::Unlabeled}, //{, MyGUI::KeyCode::NextTrack}, {SDLK_KP_DIVIDE, MyGUI::KeyCode::NumpadEnter}, {SDLK_RCTRL, MyGUI::KeyCode::RightControl}, //{, MyGUI::KeyCode::Mute}, //{, MyGUI::KeyCode::Calculator}, //{, MyGUI::KeyCode::PlayPause}, //{, MyGUI::KeyCode::MediaStop}, //{, MyGUI::KeyCode::VolumeDown}, //{, MyGUI::KeyCode::VolumeUp}, //{, MyGUI::KeyCode::WebHome}, //{, MyGUI::KeyCode::NumpadComma}, {SDLK_KP_DIVIDE, MyGUI::KeyCode::Divide}, {SDLK_SYSREQ, MyGUI::KeyCode::SysRq}, {SDLK_RALT, MyGUI::KeyCode::RightAlt}, {SDLK_PAUSE, MyGUI::KeyCode::Pause}, {SDLK_HOME, MyGUI::KeyCode::Home}, {SDLK_UP, MyGUI::KeyCode::ArrowUp}, {SDLK_PAGEUP, MyGUI::KeyCode::PageUp}, {SDLK_LEFT, MyGUI::KeyCode::ArrowLeft}, {SDLK_RIGHT, MyGUI::KeyCode::ArrowRight}, {SDLK_END, MyGUI::KeyCode::End}, {SDLK_DOWN, MyGUI::KeyCode::ArrowDown}, {SDLK_PAGEDOWN, MyGUI::KeyCode::PageDown}, {SDLK_INSERT, MyGUI::KeyCode::Insert}, {SDLK_DELETE, MyGUI::KeyCode::Delete}, {SDLK_LGUI, MyGUI::KeyCode::LeftWindows}, //{, MyGUI::KeyCode::RightWindow}, {SDLK_RGUI, MyGUI::KeyCode::RightWindows}, {SDLK_APPLICATION, MyGUI::KeyCode::AppMenu}}; void InputManager::buildVKeyMap() { mSDLVKeyMap.clear(); for (const auto& mapItem : mapItems) mSDLVKeyMap.insert(std::pair(mapItem.sdlKey, mapItem.myguiKey)); } void InputManager::buildMouseButtonMap() { mSDLMouseMap.clear(); mSDLMouseMap.insert(std::pair(SDL_BUTTON_LEFT, MyGUI::MouseButton::Left)); mSDLMouseMap.insert(std::pair(SDL_BUTTON_RIGHT, MyGUI::MouseButton::Right)); mSDLMouseMap.insert(std::pair(SDL_BUTTON_MIDDLE, MyGUI::MouseButton::Middle)); } void InputManager::createInput() { MyGUI::Gui::getInstance().eventFrameStart += MyGUI::newDelegate(this, &InputManager::frameEvent); // Removes default MyGUI system clipboard implementation, which is supported on Windows only MyGUI::ClipboardManager::getInstance().eventClipboardChanged.clear(); MyGUI::ClipboardManager::getInstance().eventClipboardRequested.clear(); // Set the cross-platform SDL system clipboard handler MyGUI::ClipboardManager::getInstance().eventClipboardChanged += MyGUI::newDelegate(this, &InputManager::onClipboardChanged); MyGUI::ClipboardManager::getInstance().eventClipboardRequested += MyGUI::newDelegate(this, &InputManager::onClipboardRequested); } void InputManager::destroyInput() { MyGUI::ClipboardManager::getInstance().eventClipboardChanged -= MyGUI::newDelegate(this, &InputManager::onClipboardChanged); MyGUI::ClipboardManager::getInstance().eventClipboardRequested -= MyGUI::newDelegate(this, &InputManager::onClipboardRequested); } void InputManager::updateCursorPosition() { } void InputManager::frameEvent(float _time) { computeMouseMove(); } void InputManager::computeMouseMove() { if (mMouseMove) { injectMouseMove(mMouseX, mMouseY, mMouseZ); mMouseMove = false; } } bool InputManager::mouseMoved(const SDL_MouseMotionEvent& evt) { mMouseX = evt.x; mMouseY = evt.y; mMouseMove = true; return true; } bool InputManager::mousePressed(const SDL_MouseButtonEvent& evt) { computeMouseMove(); injectMousePress(mMouseX, mMouseY, mSDLMouseMap[evt.button]); return true; } bool InputManager::mouseReleased(const SDL_MouseButtonEvent& evt) { computeMouseMove(); injectMouseRelease(mMouseX, mMouseY, mSDLMouseMap[evt.button]); return true; } bool InputManager::keyPressed(SDL_Keycode key, const SDL_TextInputEvent* evt) { if (mSDLVKeyMap.count(key) == 0) { return false; } MyGUI::KeyCode myGuiKeyCode = mSDLVKeyMap[key]; if (evt == nullptr) { injectKeyPress(myGuiKeyCode, 0); } else { MyGUI::UString ustring(evt->text); MyGUI::UString::utf32string utf32string = ustring.asUTF32(); for (unsigned int it : utf32string) { injectKeyPress(myGuiKeyCode, it); } } return true; } bool InputManager::keyReleased(const SDL_KeyboardEvent& key) { if (mSDLVKeyMap.count(key.keysym.sym) == 0) { return false; } injectKeyRelease(mSDLVKeyMap[key.keysym.sym]); return true; } bool InputManager::mouseWheelMoved(const SDL_MouseWheelEvent& evt) { mMouseZ += evt.y; mMouseMove = true; return true; } void InputManager::captureInput() { } void InputManager::setInputViewSize(int _width, int _height) { mWidth = _width; mHeight = _height; checkPosition(); } void InputManager::setMousePosition(int _x, int _y) { mMouseX = _x; mMouseY = _y; checkPosition(); } void InputManager::checkPosition() { if (mMouseX < 0) mMouseX = 0; else if (mMouseX >= mWidth) mMouseX = mWidth - 1; if (mMouseY < 0) mMouseY = 0; else if (mMouseY >= mHeight) mMouseY = mHeight - 1; } void InputManager::onClipboardChanged(std::string_view _type, std::string_view _data) { if (_type == "Text") SDL_SetClipboardText(MyGUI::TextIterator::getOnlyText(MyGUI::UString(_data)).asUTF8().c_str()); } void InputManager::onClipboardRequested(std::string_view _type, std::string& _data) { if (_type != "Text") return; char* text = SDL_GetClipboardText(); if (text) { // MyGUI's clipboard might still have color information, to retain that information, only set the new text // if it actually changed (clipboard inserted by an external application) if (MyGUI::TextIterator::getOnlyText(_data) != text) _data = text; } SDL_free(text); } } // namespace input mygui-3.4.3+dfsg/Common/Input/SDL/InputManager.h000066400000000000000000000037071451556753500213350ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 09/2009 */ #ifndef INPUT_MANAGER_H_ #define INPUT_MANAGER_H_ #include #include namespace input { class InputManager { public: InputManager(); virtual ~InputManager() = default; void createInput(); void destroyInput(); void captureInput(); void setInputViewSize(int _width, int _height); // following five methods are to be implemented in BaseManager class virtual void injectMouseMove(int _absx, int _absy, int _absz) { } virtual void injectMousePress(int _absx, int _absy, MyGUI::MouseButton _id) { } virtual void injectMouseRelease(int _absx, int _absy, MyGUI::MouseButton _id) { } virtual void injectKeyPress(MyGUI::KeyCode _key, MyGUI::Char _text) { } virtual void injectKeyRelease(MyGUI::KeyCode _key) { } virtual void onFileDrop(const std::wstring& _filename) { } virtual bool onWindowClose(size_t _handle) { return true; } void setMousePosition(int _x, int _y); void updateCursorPosition(); protected: void frameEvent(float _time); void computeMouseMove(); void onClipboardChanged(std::string_view _type, std::string_view _data); void onClipboardRequested(std::string_view _type, std::string& _data); virtual bool mouseMoved(const SDL_MouseMotionEvent& evt); virtual bool mousePressed(const SDL_MouseButtonEvent& evt); virtual bool mouseReleased(const SDL_MouseButtonEvent& evt); virtual bool keyPressed(SDL_Keycode key, const SDL_TextInputEvent* evt); virtual bool keyReleased(const SDL_KeyboardEvent& key); virtual bool mouseWheelMoved(const SDL_MouseWheelEvent& evt); void checkPosition(); void buildVKeyMap(); void buildMouseButtonMap(); private: int mMouseX{0}; int mMouseY{0}; int mMouseZ{0}; bool mMouseMove{false}; int mWidth{0}; int mHeight{0}; std::map mSDLVKeyMap; std::map mSDLMouseMap; }; } // namespace input #endif // INPUT_MANAGER_H_ mygui-3.4.3+dfsg/Common/Input/SDL/PointerManager.cpp000066400000000000000000000045321451556753500222060ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 1/2009 */ #include "Precompiled.h" #include "PointerManager.h" #include #include "ResourceSDLPointer.h" namespace input { PointerManager::~PointerManager() { SDL_FreeCursor(mCursor); } void PointerManager::createPointerManager() { MyGUI::PointerManager& manager = MyGUI::PointerManager::getInstance(); manager.setVisible(false); manager.eventChangeMousePointer += MyGUI::newDelegate(this, &PointerManager::notifyChangeMousePointer); const std::string& resourceCategory = MyGUI::ResourceManager::getInstance().getCategoryName(); MyGUI::FactoryManager::getInstance().registerFactory(resourceCategory); } void PointerManager::destroyPointerManager() { const std::string& resourceCategory = MyGUI::ResourceManager::getInstance().getCategoryName(); MyGUI::FactoryManager::getInstance().unregisterFactory(resourceCategory); MyGUI::PointerManager& manager = MyGUI::PointerManager::getInstance(); manager.eventChangeMousePointer -= MyGUI::newDelegate(this, &PointerManager::notifyChangeMousePointer); } void PointerManager::setPointerVisible(bool _value) { SDL_ShowCursor(static_cast(_value)); } void PointerManager::notifyChangeMousePointer(std::string_view _name) { if (mManagerPointer) { setPointer(_name); } } void PointerManager::setPointerName(std::string_view _name) { mManagerPointer = false; setPointer(_name); } void PointerManager::updateSDLPointer(SDL_SystemCursor _newCursor) { SDL_FreeCursor(mCursor); mCursor = SDL_CreateSystemCursor(_newCursor); SDL_SetCursor(mCursor); } void PointerManager::setPointer(std::string_view _name) { MapPointer::iterator iter = mMapPointer.find(_name); if (iter != mMapPointer.end()) { updateSDLPointer(iter->second); } else { MyGUI::IResource* resource_generic = MyGUI::ResourceManager::getInstance().getByName(_name, false); if (resource_generic != nullptr) { ResourceSDLPointer* resource = resource_generic->castType(false); if (resource != nullptr) { mMapPointer.emplace(_name, resource->getPointerType()); updateSDLPointer(resource->getPointerType()); } } } } void PointerManager::loadPointerResources() { MyGUI::ResourceManager::getInstance().load("PointersSDL.xml"); } } // namespace input mygui-3.4.3+dfsg/Common/Input/SDL/PointerManager.h000066400000000000000000000015471451556753500216560ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 11/2009 */ #ifndef POINTER_MANAGER_H_ #define POINTER_MANAGER_H_ #include #include #include #include namespace input { class PointerManager { public: virtual ~PointerManager(); void createPointerManager(); void destroyPointerManager(); void setPointerVisible(bool _value); void setPointerName(std::string_view _name); void loadPointerResources(); private: void notifyChangeMousePointer(std::string_view _name); void updateSDLPointer(SDL_SystemCursor _newCursor); bool isMouseInClient(); void setPointer(std::string_view _name); private: using MapPointer = std::map>; MapPointer mMapPointer; bool mManagerPointer{true}; SDL_Cursor* mCursor{nullptr}; }; } // namespace input #endif // POINTER_MANAGER_H_ mygui-3.4.3+dfsg/Common/Input/SDL/ResourceSDLPointer.cpp000066400000000000000000000034421451556753500227650ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 11/2009 @module */ #include "ResourceSDLPointer.h" namespace input { void ResourceSDLPointer::deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) { Base::deserialization(_node, _version); MyGUI::xml::ElementEnumerator info = _node->getElementEnumerator(); while (info.next()) { if (info->getName() == "Property") { std::string_view key = info->findAttribute("key"); if (key == "SourceFile") { //std::string path = MyGUI::DataManager::getInstance().getDataPath(info->getContent()); //mCursorType = (size_t)LoadCursorFromFileA(path.c_str()); } else if (key == "SourceSystem") { const std::string& value = info->getContent(); if (value == "SDL_SYSTEM_CURSOR_ARROW") mCursorType = SDL_SYSTEM_CURSOR_ARROW; else if (value == "SDL_SYSTEM_CURSOR_IBEAM") mCursorType = SDL_SYSTEM_CURSOR_IBEAM; else if (value == "SDL_SYSTEM_CURSOR_WAIT") mCursorType = SDL_SYSTEM_CURSOR_WAIT; else if (value == "SDL_SYSTEM_CURSOR_CROSSHAIR") mCursorType = SDL_SYSTEM_CURSOR_CROSSHAIR; else if (value == "SDL_SYSTEM_CURSOR_SIZENWSE") mCursorType = SDL_SYSTEM_CURSOR_SIZENWSE; else if (value == "SDL_SYSTEM_CURSOR_SIZENESW") mCursorType = SDL_SYSTEM_CURSOR_SIZENESW; else if (value == "SDL_SYSTEM_CURSOR_SIZEWE") mCursorType = SDL_SYSTEM_CURSOR_SIZEWE; else if (value == "SDL_SYSTEM_CURSOR_SIZENS") mCursorType = SDL_SYSTEM_CURSOR_SIZENS; else if (value == "SDL_SYSTEM_CURSOR_SIZEALL") mCursorType = SDL_SYSTEM_CURSOR_SIZEALL; else if (value == "SDL_SYSTEM_CURSOR_NO") mCursorType = SDL_SYSTEM_CURSOR_NO; else if (value == "SDL_SYSTEM_CURSOR_HAND") mCursorType = SDL_SYSTEM_CURSOR_HAND; } } } } } mygui-3.4.3+dfsg/Common/Input/SDL/ResourceSDLPointer.h000066400000000000000000000011261451556753500224270ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 11/2009 @module */ #ifndef RESOURCE_W32_POINTER_H_ #define RESOURCE_W32_POINTER_H_ #include "MyGUI_Prerequest.h" #include "MyGUI_IResource.h" #include namespace input { class ResourceSDLPointer : public MyGUI::IResource { MYGUI_RTTI_DERIVED(ResourceSDLPointer) public: void deserialization(MyGUI::xml::ElementPtr _node, MyGUI::Version _version) override; SDL_SystemCursor getPointerType() { return mCursorType; } private: SDL_SystemCursor mCursorType{SDL_NUM_SYSTEM_CURSORS}; }; } #endif // RESOURCE_W32_POINTER_H_ mygui-3.4.3+dfsg/Common/ItemBox/000077500000000000000000000000001451556753500164115ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/ItemBox/BaseCellView.h000066400000000000000000000007301451556753500210670ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 07/2008 @module */ #ifndef BASE_CELL_VIEW_H_ #define BASE_CELL_VIEW_H_ #include #include "BaseLayout/BaseLayout.h" namespace wraps { template class BaseCellView : public BaseLayout { public: using Type = DataType; protected: BaseCellView(std::string_view _layout, MyGUI::Widget* _parent) : BaseLayout(_layout, _parent) { } }; } // namespace wraps #endif // BASE_CELL_VIEW_H_ mygui-3.4.3+dfsg/Common/ItemBox/BaseItemBox.h000066400000000000000000000117631451556753500207340ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 07/2008 @module */ #ifndef BASE_ITEM_BOX_H_ #define BASE_ITEM_BOX_H_ #include #include "BaseLayout/BaseLayout.h" #include "ItemDropInfo.h" namespace wraps { template class BaseItemBox : public BaseLayout { public: using DataType = typename CellType::Type; public: BaseItemBox(MyGUI::Widget* _parent) : BaseLayout(std::string_view{}, _parent) { mBoxItems = mMainWidget->castType(); mBoxItems->setUserData(static_cast(this)); mBoxItems->requestCreateWidgetItem = MyGUI::newDelegate(this, &BaseItemBox::requestCreateWidgetItem); mBoxItems->requestCoordItem = MyGUI::newDelegate(this, &BaseItemBox::requestCoordWidgetItem); mBoxItems->requestDrawItem = MyGUI::newDelegate(this, &BaseItemBox::requestUpdateWidgetItem); mBoxItems->eventStartDrag += MyGUI::newDelegate(this, &BaseItemBox::notifyStartDrop); mBoxItems->eventRequestDrop += MyGUI::newDelegate(this, &BaseItemBox::notifyRequestDrop); mBoxItems->eventDropResult += MyGUI::newDelegate(this, &BaseItemBox::notifyEndDrop); mBoxItems->eventChangeDDState += MyGUI::newDelegate(this, &BaseItemBox::notifyDropState); mBoxItems->eventNotifyItem += MyGUI::newDelegate(this, &BaseItemBox::notifyNotifyItem); mBoxItems->eventToolTip += MyGUI::newDelegate(this, &BaseItemBox::notifyToolTip); } ~BaseItemBox() override { mBoxItems->requestCreateWidgetItem = nullptr; mBoxItems->requestCoordItem = nullptr; mBoxItems->requestDrawItem = nullptr; mBoxItems->eventStartDrag -= MyGUI::newDelegate(this, &BaseItemBox::notifyStartDrop); mBoxItems->eventRequestDrop -= MyGUI::newDelegate(this, &BaseItemBox::notifyRequestDrop); mBoxItems->eventDropResult -= MyGUI::newDelegate(this, &BaseItemBox::notifyEndDrop); mBoxItems->eventChangeDDState -= MyGUI::newDelegate(this, &BaseItemBox::notifyDropState); mBoxItems->eventNotifyItem -= MyGUI::newDelegate(this, &BaseItemBox::notifyNotifyItem); mBoxItems->eventToolTip -= MyGUI::newDelegate(this, &BaseItemBox::notifyToolTip); for (typename VectorCellView::iterator iter = mListCellView.begin(); iter != mListCellView.end(); ++iter) { delete *iter; } mListCellView.clear(); } void addItem(DataType _data) { mBoxItems->addItem(_data); } void removeItem(size_t _index) { mBoxItems->removeItemAt(_index); } void removeAllItems() { mBoxItems->removeAllItems(); } void setItemData(size_t _index, DataType _data) { mBoxItems->setItemDataAt(_index, _data); } template ValueType* getItemDataAt(size_t _index, bool _throw = true) { return mBoxItems->getItemDataAt(_index, _throw); } private: void requestCreateWidgetItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item) { CellType* cell = new CellType(_item); _item->setUserData(cell); mListCellView.push_back(cell); } void requestCoordWidgetItem(MyGUI::ItemBox* _sender, MyGUI::IntCoord& _coord, bool _drop) { CellType::getCellDimension(_sender, _coord, _drop); } void requestUpdateWidgetItem(MyGUI::ItemBox* _sender, MyGUI::Widget* _item, const MyGUI::IBDrawItemInfo& _data) { CellType* cell = *_item->getUserData(); cell->update(_data, *mBoxItems->getItemDataAt(_data.index)); } void notifyStartDrop(MyGUI::DDContainer* _sender, const MyGUI::DDItemInfo& _info, bool& _result) { eventStartDrag(this, DDItemInfo(_info), _result); } void notifyRequestDrop(MyGUI::DDContainer* _sender, const MyGUI::DDItemInfo& _info, bool& _result) { eventRequestDrop(this, DDItemInfo(_info), _result); } void notifyEndDrop(MyGUI::DDContainer* _sender, const MyGUI::DDItemInfo& _info, bool _result) { eventDropResult(this, DDItemInfo(_info), _result); } void notifyDropState(MyGUI::DDContainer* _sender, MyGUI::DDItemState _state) { eventChangeDDState(this, _state); } void notifyNotifyItem(MyGUI::ItemBox* _sender, const MyGUI::IBNotifyItemData& _info) { eventNotifyItem(this, _info); } void notifyToolTip(MyGUI::Widget* _sender, const MyGUI::ToolTipInfo& _info) { if (_info.index == MyGUI::ITEM_NONE) eventToolTip(this, _info, DataType()); else eventToolTip(this, _info, *mBoxItems->getItemDataAt(_info.index)); } public: MyGUI::delegates::Delegate eventStartDrag; MyGUI::delegates::Delegate eventRequestDrop; MyGUI::delegates::Delegate eventDropResult; MyGUI::delegates::Delegate eventChangeDDState; MyGUI::delegates::Delegate eventNotifyItem; MyGUI::delegates::Delegate eventToolTip; MyGUI::ItemBox* getItemBox() const { return mBoxItems; } private: using VectorCellView = std::vector; VectorCellView mListCellView; MyGUI::ItemBox* mBoxItems; }; } // namespace wraps #endif // BASE_ITEM_BOX_H_ mygui-3.4.3+dfsg/Common/ItemBox/ItemDropInfo.h000066400000000000000000000012271451556753500211230ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 07/2008 @module */ #ifndef ITEM_DROP_INFO_H_ #define ITEM_DROP_INFO_H_ #include #include "BaseLayout/BaseLayout.h" namespace wraps { struct DDItemInfo { DDItemInfo(const MyGUI::DDItemInfo& _info) : sender(*_info.sender->getUserData()), sender_index(_info.sender_index), receiver(_info.receiver ? *_info.receiver->getUserData() : nullptr), receiver_index(_info.receiver_index) { } wraps::BaseLayout* sender; size_t sender_index; wraps::BaseLayout* receiver; size_t receiver_index; }; } // namespace wraps #endif // ITEM_DROP_INFO_H_ mygui-3.4.3+dfsg/Common/MessageBox/000077500000000000000000000000001451556753500170775ustar00rootroot00000000000000mygui-3.4.3+dfsg/Common/MessageBox/MessageBox.h000066400000000000000000000253071451556753500213140ustar00rootroot00000000000000/*! @file @author Albert Semenov @date 12/2010 */ #ifndef MESSAGE_BOX_H_ #define MESSAGE_BOX_H_ #include #include "MessageBoxStyle.h" #include "BaseLayout/BaseLayout.h" namespace MyGUI { class Message; using EventHandle_MessageBoxPtrMessageStyle = delegates::MultiDelegate; class Message : public wraps::BaseLayout { public: Message() : wraps::BaseLayout("MessageBox.layout"), mWidgetText(nullptr), mInfoOk(MessageBoxStyle::None), mInfoCancel(MessageBoxStyle::None), mSmoothShow(false), mIcon(nullptr), mLeftOffset1(0), mLeftOffset2(0) { initialise(); } Message(std::string_view _layoutName) : wraps::BaseLayout(_layoutName), mWidgetText(nullptr), mInfoOk(MessageBoxStyle::None), mInfoCancel(MessageBoxStyle::None), mSmoothShow(false), mIcon(nullptr), mLeftOffset1(0), mLeftOffset2(0) { initialise(); } ~Message() override { mWidgetText = nullptr; mIcon = nullptr; } /** Set caption text*/ void setCaption(const UString& _value) { mMainWidget->castType()->setCaption(_value); } /** Set message text*/ void setMessageText(const UString& _value) { if (mWidgetText != nullptr) mWidgetText->setCaption(_value); updateSize(); } /** Create button with specific name*/ MessageBoxStyle addButtonName(const UString& _name) { if (mVectorButton.size() >= MessageBoxStyle::_countUserButtons) { MYGUI_LOG(Warning, "Too many buttons in message box, ignored"); return MessageBoxStyle::None; } // бит, номер кнопки + смещение до Button1 MessageBoxStyle info = MessageBoxStyle( MessageBoxStyle::Enum(MYGUI_FLAG(mVectorButton.size() + MessageBoxStyle::_indexUserButton1))); // запоминаем кнопки для отмены и подтверждения if (mVectorButton.empty()) mInfoOk = info; mInfoCancel = info; Widget* widget = mMainWidget->createWidgetT(mButtonType, mButtonSkin, IntCoord(), Align::Left | Align::Bottom); Button* button = widget->castType