Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8071 for code/branches/kicklib


Ignore:
Timestamp:
Mar 14, 2011, 3:53:38 AM (14 years ago)
Author:
rgrieder
Message:

Merged ois_update branch (before it was renamed to mac_osx) into kicklib branch.

Location:
code/branches/kicklib
Files:
1 deleted
92 edited
11 copied

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib

  • code/branches/kicklib/CMakeLists.txt

    r7383 r8071  
    101101OPTION(ORXONOX_RELEASE "Enable when building restributable releases" FALSE)
    102102
     103IF(APPLE)
     104  # Set 10.5 as the base SDK by default
     105  SET(XCODE_ATTRIBUTE_SDKROOT macosx10.5)
     106
     107  # 10.6 sets x86_64 as the default architecture.
     108  # Because Carbon isn't supported on 64-bit and we still need it, force the architectures to ppc and i386
     109  IF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
     110    SET(CMAKE_OSX_ARCHITECTURES "i386")
     111  ENDIF()
     112  IF(CMAKE_OSX_ARCHITECTURES MATCHES "ppc64")
     113    SET(CMAKE_OSX_ARCHITECTURES "ppc")
     114  ENDIF()
     115  IF(NOT CMAKE_OSX_ARCHITECTURES)
     116    SET(CMAKE_OSX_ARCHITECTURES "i386")
     117  ENDIF()
     118ENDIF()
     119
    103120########### Subfolders and Subscripts ###########
     121
     122# General build and compiler options and configurations
     123INCLUDE(CompilerConfig)
    104124
    105125# Library finding
    106126INCLUDE(LibraryConfig)
    107 
    108 # General build and compiler options and configurations
    109 INCLUDE(CompilerConfig)
    110127
    111128# Configure installation paths and options
  • code/branches/kicklib/cmake/CompilerConfigGCC.cmake

    r7458 r8071  
    2626INCLUDE(FlagUtilities)
    2727INCLUDE(CompareVersionStrings)
     28INCLUDE(CheckCXXCompilerFlag)
    2829
    2930# Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC
     
    3637  OUTPUT_VARIABLE GCC_VERSION
    3738)
    38 
    39 # Complain about incompatibilities
    40 COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)
    41 IF(NOT _compare_result LESS 0)
    42   IF(${Boost_VERSION} LESS 103700)
    43     MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")
    44   ENDIF()
    45 ENDIF()
    4639
    4740# GCC may not support #pragma GCC system_header correctly when using
     
    7265
    7366# CMake doesn't seem to set the PIC flags right on certain 64 bit systems
     67# Todo: MinGW too?
    7468IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
    7569  ADD_COMPILER_FLAGS("-fPIC" CACHE)
     70ENDIF()
     71
     72# Use SSE if possible
     73# Commented because this might not work for cross compiling
     74#CHECK_CXX_COMPILER_FLAG(-msse _gcc_have_sse)
     75#IF(_gcc_have_sse)
     76#  ADD_COMPILER_FLAGS("-msse" CACHE)
     77#ENDIF()
     78
     79IF(NOT MINGW)
     80  # Have GCC visibility?
     81  CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" _gcc_have_visibility)
     82  IF(_gcc_have_visibility)
     83    # Note: There is a possible bug with the flag in gcc < 4.2 and Debug versions
     84    COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.2.0" _compare_result)
     85    IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" OR _compare_result GREATER -1)
     86      ADD_COMPILER_FLAGS("-DORXONOX_GCC_VISIBILITY -fvisibility=default -fvisibility-inlines-hidden" CACHE)
     87    ENDIF()
     88  ENDIF(_gcc_have_visibility)
    7689ENDIF()
    7790
  • code/branches/kicklib/cmake/CompilerConfigMSVC.cmake

    r8057 r8071  
    6060
    6161# Overwrite CMake default flags here for the individual configurations
    62 SET_COMPILER_FLAGS("-MDd -Od -Zi -D_DEBUG -RTC1" Debug          CACHE)
    63 SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG"       Release        CACHE)
    64 SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG"       RelWithDebInfo CACHE)
    65 SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG"       MinSizeRel     CACHE)
     62SET_COMPILER_FLAGS("-MDd -Od -Oi -Zi -D_DEBUG -RTC1" Debug          CACHE)
     63SET_COMPILER_FLAGS("-MD  -O2         -DNDEBUG"       Release        CACHE)
     64SET_COMPILER_FLAGS("-MD  -O2     -Zi -DNDEBUG"       RelWithDebInfo CACHE)
     65SET_COMPILER_FLAGS("-MD  -O1         -DNDEBUG"       MinSizeRel     CACHE)
     66
     67# Enable non standard floating point optimisations
     68# Note: It hasn't been checked yet whether we have code that might break
     69#ADD_COMPILER_FLAGS("-fp:fast" CACHE)
    6670
    6771# No iterator checking for release builds (MSVC 8 dosn't understand this though)
  • code/branches/kicklib/cmake/LibraryConfig.cmake

    r8066 r8071  
    4040# On Windows using a package causes way less problems
    4141SET(_option_msg "Set this to true to use precompiled dependecy archives")
    42 IF(WIN32)
     42IF(WIN32 OR APPLE)
    4343  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" ON)
    44 ELSE(WIN32)
     44ELSE()
    4545  OPTION(DEPENDENCY_PACKAGE_ENABLE "${_option_msg}" FALSE)
    46 ENDIF(WIN32)
     46ENDIF()
    4747
    4848# Scripts for specific library and CMake config
    4949INCLUDE(LibraryConfigTardis)
    50 INCLUDE(LibraryConfigApple)
     50#INCLUDE(LibraryConfigOSX)
    5151
    5252IF(DEPENDENCY_PACKAGE_ENABLE)
     
    7575                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
    7676  ELSE()
    77     INCLUDE(PackageConfigMinGW)
    78     INCLUDE(PackageConfigMSVC)
    79     INCLUDE(PackageConfig) # For both msvc and mingw
     77    IF(WIN32)
     78      INCLUDE(PackageConfigMinGW)
     79      INCLUDE(PackageConfigMSVC)
     80      INCLUDE(PackageConfig) # For both msvc and mingw
     81    ELSEIF(APPLE)
     82      INCLUDE(PackageConfigOSX)
     83    ENDIF(WIN32)
    8084  ENDIF()
    8185ENDIF(DEPENDENCY_PACKAGE_ENABLE)
     
    152156# No auto linking, so this option is useless anyway
    153157MARK_AS_ADVANCED(Boost_LIB_DIAGNOSTIC_DEFINITIONS)
     158# Complain about incompatibilities
     159IF(GCC_VERSION)
     160  COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)
     161  IF(NOT _compare_result LESS 0)
     162    IF(${Boost_VERSION} LESS 103700)
     163      MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")
     164    ENDIF()
     165  ENDIF()
     166ENDIF()
    154167
    155168
  • code/branches/kicklib/cmake/PackageConfig.cmake

    r8064 r8071  
    2424 #    Library files are treated separately.
    2525 #
    26 
    27 # Check package version info
    28 # MAJOR: Breaking change
    29 # MINOR: No breaking changes by the dependency package
    30 #        For example any code running on 3.0 should still run on 3.1
    31 #        But you can specify that the code only runs on 3.1 and higher
    32 #        or 4.0 and higher (so both 3.1 and 4.0 will work).
    33 IF(MSVC)
    34   SET(ALLOWED_MINIMUM_VERSIONS 4.3 6.0)
    35 ELSE()
    36   SET(ALLOWED_MINIMUM_VERSIONS 6.0)
    37 ENDIF()
    38 
    39 IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
    40   SET(DEPENDENCY_VERSION 1.0)
    41 ELSE()
    42   # Get version from file
    43   FILE(READ ${DEPENDENCY_PACKAGE_DIR}/version.txt _file_content)
    44   SET(_match)
    45   STRING(REGEX MATCH "([0-9]+.[0-9]+)" _match ${_file_content})
    46   IF(_match)
    47     SET(DEPENDENCY_VERSION ${_match})
    48   ELSE()
    49     MESSAGE(FATAL_ERROR "The version.txt file in the dependency file has corrupt version information.")
    50   ENDIF()
    51 ENDIF()
    52 
    53 INCLUDE(CompareVersionStrings)
    54 SET(_version_match FALSE)
    55 FOREACH(_version ${ALLOWED_MINIMUM_VERSIONS})
    56   # Get major version
    57   STRING(REGEX REPLACE "^([0-9]+)\\..*$" "\\1" _major_version "${_version}")
    58   COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_major_version} _result TRUE)
    59   IF(_result EQUAL 0)
    60     COMPARE_VERSION_STRINGS(${DEPENDENCY_VERSION} ${_version} _result FALSE)
    61     IF(NOT _result LESS 0)
    62       SET(_version_match TRUE)
    63     ENDIF()
    64   ENDIF()
    65 ENDFOREACH(_version)
    66 IF(NOT _version_match)
    67   MESSAGE(FATAL_ERROR "Your dependency package version is ${DEPENDENCY_VERSION}\n"
    68           "Possible required versions: ${ALLOWED_MINIMUM_VERSIONS}\n"
    69           "You can get a new version from www.orxonox.net")
    70 ENDIF()
    7126
    7227IF(NOT _INTERNAL_PACKAGE_MESSAGE)
  • code/branches/kicklib/cmake/PackageConfigMSVC.cmake

    r8057 r8071  
    2727
    2828IF(MSVC)
     29
     30  INCLUDE(CheckPackageVersion)
     31  CHECK_PACKAGE_VERSION(4.3 6.0)
    2932
    3033  # 64 bit system?
  • code/branches/kicklib/cmake/PackageConfigMinGW.cmake

    r8068 r8071  
    2828IF(MINGW)
    2929
     30  INCLUDE(CheckPackageVersion)
     31  CHECK_PACKAGE_VERSION(6.0)
     32
    3033  # 64 bit system?
    3134  IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
  • code/branches/kicklib/cmake/tools/CheckOGREPlugins.cmake

    r7163 r8071  
    5353      NAMES ${_plugin}
    5454      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
    55       PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin
     55      PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin Ogre.framework/Resources
    5656    )
    5757    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
    5858      NAMES ${_plugin}d ${_plugin}_d ${_plugin}
    5959      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
    60       PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin
     60      PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin Ogre.framework/Resources
    6161    )
    6262    # We only need at least one render system. Check at the end.
  • code/branches/kicklib/cmake/tools/FindALUT.cmake

    r7163 r8071  
    1 # - Locate FreeAlut
     1# Find ALUT includes and library
     2#
    23# This module defines
    3 #  ALUT_LIBRARY
    4 #  ALUT_FOUND, if false, do not try to link against Alut
    5 #  ALUT_INCLUDE_DIR, where to find the headers
     4#  ALUT_INCLUDE_DIR
     5#  ALUT_LIBRARY, the library to link against to use ALUT.
     6#  ALUT_FOUND, If false, do not try to use ALUT
    67#
    7 # $ALUTDIR is an environment variable that would
    8 # correspond to the ./configure --prefix=$ALUTDIR
    9 # used in building Alut.
     8# Copyright © 2007, Matt Williams
     9# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
     10# of the ETH Zurich (removed later on)
    1011#
    11 # Created by Eric Wing. This was influenced by the FindSDL.cmake module.
    12 # On OSX, this will prefer the Framework version (if found) over others.
    13 # People will have to manually change the cache values of
    14 # ALUT_LIBRARY to override this selection.
    15 # Tiger will include OpenAL as part of the System.
    16 # But for now, we have to look around.
    17 # Other (Unix) systems should be able to utilize the non-framework paths.
     12# Redistribution and use is allowed according to the terms of the BSD license.
    1813#
    1914# Several changes and additions by Fabian 'x3n' Landau
    20 # Some simplifications by Adrian Friedli and Reto Grieder
     15# Lots of simplifications by Adrian Friedli
     16# Version checking by Reto Grieder
     17# Adaption of the OGRE find script to ALUT by Kevin Young
    2118#                 > www.orxonox.net <
    2219
    23 INCLUDE(FindPackageHandleStandardArgs)
     20INCLUDE(FindPackageHandleAdvancedArgs)
    2421INCLUDE(HandleLibraryTypes)
    2522
    26 FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
    27   PATHS
    28   $ENV{ALUTDIR}
    29   ~/Library/Frameworks/OpenAL.framework
    30   /Library/Frameworks/OpenAL.framework
    31   /System/Library/Frameworks/OpenAL.framework # Tiger
    32   PATH_SUFFIXES include include/OpenAL include/AL Headers
     23FIND_PATH(ALUT_INCLUDE_DIR alut.h
     24  PATHS $ENV{ALUTDIR}
     25  PATH_SUFFIXES include include/AL ALUT
     26)
     27FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
     28  NAMES ALUT alut
     29  PATHS $ENV{ALUTDIR}
     30  PATH_SUFFIXES lib bin/Release bin/release Release release ALUT
     31)
     32FIND_LIBRARY(ALUT_LIBRARY_DEBUG
     33  NAMES ALUTD alutd alut_d alutD alut_D
     34  PATHS $ENV{ALUTDIR}
     35  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug ALUT
    3336)
    3437
    35 # I'm not sure if I should do a special casing for Apple. It is
    36 # unlikely that other Unix systems will find the framework path.
    37 # But if they do ([Next|Open|GNU]Step?),
    38 # do they want the -framework option also?
    39 IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
    40 
    41   STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
    42   IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
    43       OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
    44       )
    45     # String is in default search path, don't need to use -F
    46     SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
    47   ELSE()
    48     # String is not /Library/Frameworks, need to use -F
    49     SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
    50   ENDIF()
    51   # Clear the temp variable so nobody can see it
    52   SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
    53 
    54 ELSE()
    55   FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
    56     NAMES alut
    57     PATHS $ENV{ALUTDIR}
    58     PATH_SUFFIXES lib libs
    59   )
    60   FIND_LIBRARY(ALUT_LIBRARY_DEBUG
    61     NAMES alutd alut_d alutD alut_D
    62     PATHS $ENV{ALUTDIR}
    63     PATH_SUFFIXES lib libs
    64   )
    65 ENDIF()
    66 
    6738# Handle the REQUIRED argument and set ALUT_FOUND
    68 FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
    69     ALUT_LIBRARY_OPTIMIZED
    70     ALUT_INCLUDE_DIR
     39# Also check the version requirements
     40FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ALUT DEFAULT_MSG
     41  ALUT_LIBRARY_OPTIMIZED
     42  ALUT_INCLUDE_DIR
    7143)
    7244
     
    7547
    7648MARK_AS_ADVANCED(
    77     ALUT_INCLUDE_DIR
    78     ALUT_LIBRARY_OPTIMIZED
    79     ALUT_LIBRARY_DEBUG
     49  ALUT_INCLUDE_DIR
     50  ALUT_LIBRARY_OPTIMIZED
     51  ALUT_LIBRARY_DEBUG
    8052)
  • code/branches/kicklib/cmake/tools/GenerateToluaBindings.cmake

    r7415 r8071  
    3232 #    RUNTIME_LIBRARY_DIRECTORY - Working directory
    3333 #
     34
     35# Workaround for XCode: The folder where the bind files are written to has
     36# to be present beforehand.
     37# We have to do this here because the header files are all stored in a single
     38# location per configuration.
     39IF(CMAKE_CONFIGURATION_TYPES)
     40  FOREACH(_dir ${CMAKE_CONFIGURATION_TYPES})
     41    FILE(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/src/toluabind/${_dir}")
     42  ENDFOREACH(_dir)
     43ENDIF()
    3444
    3545FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
  • code/branches/kicklib/cmake/tools/TargetUtilities.cmake

    r8057 r8071  
    169169    GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files
    170170                            INPUTFILES ${_arg_TOLUA_FILES})
     171    # Workaround for XCode: The folder where the bind files are written to has
     172    # to be present beforehand.
     173    IF(CMAKE_CONFIGURATION_TYPES)
     174      FOREACH(_dir ${CMAKE_CONFIGURATION_TYPES})
     175        FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_dir})
     176      ENDFOREACH(_dir)
     177    ENDIF()
    171178  ENDIF()
    172179
  • code/branches/kicklib/data/gui/scripts/AudioMenu.lua

    r7928 r8071  
    3232    table.insert(themeList, "Default")
    3333    table.insert(themeList, "Drum n' Bass")
     34    table.insert(themeList, "8-Bit Style")
     35    table.insert(themeList, "Corny Jazz")
    3436    for k,v in pairs(themeList) do
    3537        item = CEGUI.createListboxTextItem(v)
     
    3941    if orxonox.getConfig("MoodManager", "mood_") == "dnb" then
    4042        listboxwindow:setItemSelectState(1,true)
     43    elseif orxonox.getConfig("MoodManager", "mood_") == "eightbit" then
     44        listboxwindow:setItemSelectState(2,true)
     45    elseif orxonox.getConfig("MoodManager", "mood_") == "jazzy" then
     46        listboxwindow:setItemSelectState(3,true)
    4147    else
    4248        listboxwindow:setItemSelectState(0,true)
     
    168174    if listboxwindow:isItemSelected(1) then
    169175        orxonox.config("MoodManager", "mood_", "dnb")
     176    elseif listboxwindow:isItemSelected(2) then
     177        orxonox.config("MoodManager", "mood_", "eightbit")
     178    elseif listboxwindow:isItemSelected(3) then
     179        orxonox.config("MoodManager", "mood_", "jazzy")
    170180    else
    171181        orxonox.config("MoodManager", "mood_", "default")
  • code/branches/kicklib/src/CMakeLists.txt

    r8061 r8071  
    6969# Set the search paths for include files
    7070INCLUDE_DIRECTORIES(
     71  # OrxonoxConfig.h
     72  ${CMAKE_CURRENT_BINARY_DIR}
     73
     74  # All includes in "externals" should be prefixed with the path
     75  # relative to "external" to avoid conflicts
     76  ${CMAKE_CURRENT_SOURCE_DIR}/external
     77  # Include directories needed even if only included by Orxonox
     78  ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
     79  ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
     80
    7181  # External
    7282  ${OGRE_INCLUDE_DIR}
     
    8494  ${DIRECTX_INCLUDE_DIR}
    8595  ${ZLIB_INCLUDE_DIR}
    86 
    87   # All includes in "externals" should be prefixed with the path
    88   # relative to "external" to avoid conflicts
    89   ${CMAKE_CURRENT_SOURCE_DIR}/external
    90   # Include directories needed even if only included by Orxonox
    91   ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet
    92   ${CMAKE_CURRENT_SOURCE_DIR}/external/ois
    93 
    94   # OrxonoxConfig.h
    95   ${CMAKE_CURRENT_BINARY_DIR}
    9696)
    9797
  • code/branches/kicklib/src/OrxonoxConfig.cmake

    r7980 r8071  
    3232
    3333# Global switch to disable Precompiled Header Files
    34 IF(PCH_COMPILER_SUPPORT)
     34# Note: PCH temporarily disabled on Mac because of severe problems
     35IF(PCH_COMPILER_SUPPORT AND NOT APPLE)
    3536  OPTION(PCH_ENABLE "Global PCH switch" TRUE)
    3637ENDIF()
     
    5354ENDIF()
    5455
    55 # 32/64 bit system check
    56 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
    57   SET(ORXONOX_ARCH_64 TRUE)
    58 ELSE()
    59   SET(ORXONOX_ARCH_32 TRUE)
    60 ENDIF()
    61 
    6256# Platforms
    6357SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
     
    7468  CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
    7569ENDIF(MSVC)
     70
     71# Part of a woraround for OS X warnings. See OrxonoxConfig.h.in
     72IF(HAVE_STDINT_H)
     73  SET(HAVE_STDINT_H 1)
     74ELSE()
     75  SET(HAVE_STDINT_H 0)
     76ENDIF()
    7677
    7778# Check iso646.h include (literal operators)
  • code/branches/kicklib/src/OrxonoxConfig.h.in

    r7818 r8071  
    8080
    8181// Architecture
    82 #cmakedefine ORXONOX_ARCH_32
    83 #cmakedefine ORXONOX_ARCH_64
     82#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
     83#   define ORXONOX_ARCH_64
     84#else
     85#   define ORXONOX_ARCH_32
     86#endif
    8487
    8588// See if we can use __forceinline or if we need to use __inline instead
    8689#cmakedefine HAVE_FORCEINLINE
    87 #ifndef FORCEINLINE
     90#ifndef ORX_FORCEINLINE
    8891#  ifdef HAVE_FORCEINLINE
    89 #    define FORCEINLINE __forceinline
     92#    define ORX_FORCEINLINE __forceinline
    9093#  else
    91 #    define FORCEINLINE __inline
     94#    define ORX_FORCEINLINE __inline
    9295#  endif
    9396#endif
     
    158161#endif
    159162
    160 #cmakedefine HAVE_STDINT_H
    161 #ifdef HAVE_STDINT_H
     163// On OS X some headers already define HAVE_STDINT_H and that spits out
     164// some warnings. Therefore we use this syntax.
     165// Note: This requires some extra code in OrxonoxConfig.cmake
     166#if @HAVE_STDINT_H@
    162167#  include <stdint.h>
    163168#elif defined(ORXONOX_COMPILER_MSVC)
  • code/branches/kicklib/src/SpecialConfig.h.in

    r7941 r8071  
    9292
    9393    // OGRE PLUGINS
     94    // Apple has trouble finding OGRE plugins because of its install-name convention
     95    // Adopting the executable_path structure for later use in app bundles
    9496#ifdef NDEBUG
    9597    const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@";
    9698#  ifdef DEPENDENCY_PACKAGE_ENABLE
    97     const char ogrePluginsDirectory[] = ".";
     99#    ifdef ORXONOX_PLATFORM_APPLE
     100       const char ogrePluginsDirectory[] = "@executable_path/../Plugins";
     101#    else
     102       const char ogrePluginsDirectory[] = ".";
     103#    endif
    98104#  else
    99105    const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";
     
    102108    const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@";
    103109#  ifdef DEPENDENCY_PACKAGE_ENABLE
    104     const char ogrePluginsDirectory[] = ".";
     110#    ifdef ORXONOX_PLATFORM_APPLE
     111       const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
     112#    else
     113       const char ogrePluginsDirectory[] = ".";
     114#    endif
    105115#  else
    106116    const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";
  • code/branches/kicklib/src/external/bullet/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp

    r7983 r8071  
    3838int gNumGjkChecks = 0;
    3939
     40#ifdef check
     41struct CompilerError
     42{
     43    void CompilerError() {}
     44};
     45#endif
    4046
    4147btGjkPairDetector::btGjkPairDetector(const btConvexShape* objectA,const btConvexShape* objectB,btSimplexSolverInterface* simplexSolver,btConvexPenetrationDepthSolver*  penetrationDepthSolver)
  • code/branches/kicklib/src/external/ogreceguirenderer/CMakeLists.txt

    r7163 r8071  
    3434  DEFINE_SYMBOL
    3535    "OGRE_GUIRENDERER_EXPORTS"
    36   VERSION
    37     1.4.9
    3836  LINK_LIBRARIES
     37    ${Boost_SYSTEM_LIBRARY}
     38    ${Boost_THREAD_LIBRARY}
     39    ${Boost_DATE_TIME_LIBRARY}
    3940    ${OGRE_LIBRARY}
    4041    ${CEGUI_LIBRARY}
  • code/branches/kicklib/src/external/ois/CMakeLists.txt

    r5929 r8071  
    3131  OISKeyboard.h
    3232  OISMouse.h
     33  OISMultiTouch.h
    3334  OISObject.h
    3435  OISPrereqs.h
    3536
    36 COMPILATION_BEGIN OISCompilation.cpp
     37  #COMPILATION_BEGIN OISCompilation.cpp
    3738  OISEffect.cpp
    3839  OISException.cpp
     
    4243  OISKeyboard.cpp
    4344  OISObject.cpp
    44 COMPILATION_END
     45  #COMPILATION_END
    4546)
    4647IF(WIN32)
     
    5152  ADD_SUBDIRECTORY(linux)
    5253ENDIF()
    53 
    54 INCLUDE_DIRECTORIES(.)
    5554
    5655ORXONOX_ADD_LIBRARY(ois_orxonox
     
    6665IF(WIN32)
    6766  TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES})
     67ELSEIF(APPLE)
     68  TARGET_LINK_LIBRARIES(ois_orxonox "/System/Library/Frameworks/IOKit.framework" "/System/Library/Frameworks/Carbon.framework")
    6869ENDIF()
  • code/branches/kicklib/src/external/ois/OIS.h

    r5781 r8071  
    2929#include "OISKeyboard.h"
    3030#include "OISJoyStick.h"
     31#include "OISMultiTouch.h"
    3132#include "OISInputManager.h"
    3233#include "OISFactoryCreator.h"
  • code/branches/kicklib/src/external/ois/OISConfig.h

    r5781 r8071  
    7070@remarks
    7171        Build in support for Win32 XInput (Xbox 360 Controller)
    72 @notes
    73         Not Yet Implemented
    7472*/
    7573//#define OIS_WIN32_XINPUT_SUPPORT
  • code/branches/kicklib/src/external/ois/OISInputManager.cpp

    r5781 r8071  
    3737#elif defined OIS_APPLE_PLATFORM
    3838#  include "mac/MacInputManager.h"
     39#elif defined OIS_IPHONE_PLATFORM
     40#  include "iphone/iPhoneInputManager.h"
    3941#elif defined OIS_XBOX_PLATFORM
    4042#  include "xbox/XBoxInputManager.h"
     
    5961        m_wiiMoteSupport(0)
    6062{
     63    mFactories.clear();
     64    mFactoryObjects.clear();
    6165}
    6266
     
    111115#elif defined OIS_APPLE_PLATFORM
    112116        im = new MacInputManager();
     117#elif defined OIS_IPHONE_PLATFORM
     118        im = new iPhoneInputManager();
    113119#else
    114120        OIS_EXCEPT(E_General, "No platform library.. check build platform defines!");
  • code/branches/kicklib/src/external/ois/OISKeyboard.h

    r5781 r8071  
    184184        {
    185185        public:
    186                 KeyEvent( Object* obj, KeyCode kc, unsigned int txt ) : EventArg(obj), key(kc), text(txt) {}
     186                KeyEvent(Object* obj, KeyCode kc, unsigned int txt) : EventArg(obj), key(kc), text(txt) {}
    187187                virtual ~KeyEvent() {}
    188188
     
    201201        public:
    202202                virtual ~KeyListener() {}
    203                 virtual bool keyPressed( const KeyEvent &arg ) = 0;
    204                 virtual bool keyReleased( const KeyEvent &arg ) = 0;           
     203                virtual bool keyPressed(const KeyEvent &arg) = 0;
     204                virtual bool keyReleased(const KeyEvent &arg) = 0;             
    205205        };
    206206
     
    220220                        A KeyCode to check
    221221                */
    222                 virtual bool isKeyDown( KeyCode key ) const = 0;
     222                virtual bool isKeyDown(KeyCode key) const = 0;
    223223
    224224                /**
     
    229229                        Send a pointer to a class derived from KeyListener or 0 to clear the callback
    230230                */
    231                 virtual void setEventCallback( KeyListener *keyListener ) { mListener = keyListener;}
     231                virtual void setEventCallback(KeyListener *keyListener) { mListener = keyListener;}
    232232
    233233                /**
     
    254254                        Off, Unicode, Ascii
    255255                */
    256                 virtual void setTextTranslation( TextTranslationMode mode );
     256                virtual void setTextTranslation(TextTranslationMode mode);
    257257
    258258                /**
     
    272272                        The string as determined from the current locale
    273273                */
    274                 virtual const std::string& getAsString( KeyCode kc ) = 0;
     274                virtual const std::string& getAsString(KeyCode kc) = 0;
    275275
    276276                //! Enum of bit position of modifer
     
    286286                        Check modifier status
    287287                */
    288                 bool isModifierDown( Modifier mod ) const;
     288                bool isModifierDown(Modifier mod) const;
    289289
    290290                /**
     
    293293                        (in the form of 1 is down and 0 is up)
    294294                */
    295                 virtual void copyKeyStates( char keys[256] ) const = 0;
     295                virtual void copyKeyStates(char keys[256]) const = 0;
    296296               
    297297        protected:
  • code/branches/kicklib/src/external/ois/OISPrereqs.h

    r7163 r8071  
    7979#       endif
    8080#elif defined( __APPLE_CC__ ) // Apple OS X
    81 #       define OIS_APPLE_PLATFORM
    82 #       undef _OISExport
    83 #       define _OISExport __attribute__((visibility("default")))
     81    // Device                                       Simulator
     82#   if __IPHONE_OS_VERSION_MIN_REQUIRED >= 20201 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 20000
     83//#   if __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 30000
     84#       define OIS_IPHONE_PLATFORM
     85#   else
     86#       define OIS_APPLE_PLATFORM
     87#   endif
     88#   undef _OISExport
     89#   define _OISExport __attribute__((visibility("default")))
    8490#else //Probably Linux
    8591#       define OIS_LINUX_PLATFORM
     
    95101//-------------- Common Classes, Enums, and Typdef's -------------------------//
    96102#define OIS_VERSION_MAJOR 1
    97 #define OIS_VERSION_MINOR 2
     103#define OIS_VERSION_MINOR 4
    98104#define OIS_VERSION_PATCH 0
    99 #define OIS_VERSION_NAME "Smash"
     105#define OIS_VERSION_NAME "1.4.0"
    100106
    101107#define OIS_VERSION ((OIS_VERSION_MAJOR << 16) | (OIS_VERSION_MINOR << 8) | OIS_VERSION_PATCH)
     
    110116        class Mouse;
    111117        class JoyStick;
     118    class MultiTouch;
    112119        class KeyListener;
    113120        class MouseListener;
     121    class MultiTouchListener;
    114122        class JoyStickListener;
    115123        class Interface;
     
    130138    enum Type
    131139        {
    132                 OISUnknown   = 0,
    133                 OISKeyboard  = 1,
    134                 OISMouse     = 2,
    135                 OISJoyStick  = 3,
    136                 OISTablet    = 4
     140                OISUnknown       = 0,
     141                OISKeyboard      = 1,
     142                OISMouse         = 2,
     143                OISJoyStick      = 3,
     144                OISTablet        = 4,
     145                OISMultiTouch    = 5
    137146        };
    138147
  • code/branches/kicklib/src/external/ois/ReadMe.txt

    r5781 r8071  
    55The zlib/libpng License
    66
    7 Copyright (c) 2005-2007 Phillip Castaneda (pjcast -- www.wreckedgames.com)
     7Copyright (c) 2005-2010 Phillip Castaneda (pjcast -- www.wreckedgames.com)
    88
    99This software is provided 'as-is', without any express or implied warranty. In no
     
    4646Win32/
    4747        Contains Visual Studio .Net Solution Files
    48         Contains CodeBlocks + MinGW + StlPort project files for OIS
     48        Contains CodeBlocks project files for OIS
    4949       
    5050        ---- Dependencies ------------------------------------------------------
    5151        DirectInput 8
    52         Ogre & CEGUI 0.4.0 If building CEGUIOgre OIS Demo
    5352
    54         SDL/
    55                 A test bed for an OIS InputManager with SDL as the backend. Not recommended;
    56                 however, useful for platforms with non-native OIS ports for temporary use.
    5753
    5854Linux/
    5955        ---- Dependencies ------------------------------------------------------
    6056        X11
    61         Ogre (GLX Platform) & CEGUI 0.4.0 If building CEGUIOgre OIS Demo
    62         Newer Linux Kernel (2.6+ ?) for Event API - else, use --disable-joyevents
     57        Newer Linux Kernel (2.6+ ?) for Event API
    6358
    6459        Steps to build on Linux:
     
    6964        ---- Configure build options --------------------------------------------
    7065        ./configure --help              --- List all configure options
    71         ./configure --disable-ogre      --- Disables CEGUIOgre ActionMapping Demo
    72         ./configure --disable-joyevents --- Uses /dev/input/jsX instead of
    73                                             /dev/input/eventX
     66
    7467
    7568LinuxCB/
     
    8073
    8174Mac/
    82        
    83         XCode-1.5/
    84                 Non-complete native OIS port.
    85 
    8675        XCode-2.2/
    87                 Working, complete, OIS port to OSX using SDL as a backend.
     76                Working, mostly complete OSX vackend.
  • code/branches/kicklib/src/external/ois/VERSION

    r5781 r8071  
    1 OIS v1_2 CVS updated on 2009/01/24
    2 Note that this is not CVS HEAD, but v1_2 branch!
    3 
     1OIS SVN trunk updated on 2010/10/07 (revision 26)
     2https://wgois.svn.sourceforge.net/svnroot/wgois/ois/trunk/
  • code/branches/kicklib/src/external/ois/changes_orxonox.diff

    r7163 r8071  
    1010                        //Ignorable Dll interface warning...
    1111 #           if !defined(OIS_MINGW_COMPILER)
     12
     13
    1214--- linux/EventHelpers.cpp      (revision 5668)
    1315+++ linux/EventHelpers.cpp      (working copy)
     
    3739+++ win32/Win32ForceFeedback.cpp
    3840@@ -25,7 +25,7 @@
    39  #include <Math.h>
     41 #include <math.h>
    4042 
    4143 // 0 = No trace; 1 = Important traces; 2 = Debug traces
     
    4547 #if (defined (_DEBUG) || defined(OIS_WIN32_JOYFF_DEBUG))
    4648   #include <iostream>
     49
     50
     51--- mac/MacHIDManager.cpp
     52+++ mac/MacHIDManager.cpp
     53@@ -406,6 +406,7 @@
     54                        switch(iType)
     55                        {
     56                                case OISJoyStick:
     57+                {
     58                                        int totalDevs = totalDevices(iType);
     59                                        int freeDevs = freeDevices(iType);
     60                                        int devID = totalDevs - freeDevs;
     61@@ -413,6 +414,7 @@
     62                                        obj = new MacJoyStick((*it)->combinedKey, bufferMode, *it, creator, devID);
     63                                        (*it)->inUse = true;
     64                                        return obj;
     65+                }
     66                                case OISTablet:
     67                                        //Create MacTablet
     68                                        break;
  • code/branches/kicklib/src/external/ois/linux/LinuxInputManager.cpp

    r5781 r8071  
    4040        hideMouse = true;
    4141        mGrabs = true;
    42         useXRepeat = false;
    4342        keyboardUsed = mouseUsed = false;
    4443
     
    7473
    7574        //--------- Keyboard Settings ------------//
    76         i = paramList.find("XAutoRepeatOn");
    77         if( i != paramList.end() )
    78                 if( i->second == "true" )
    79                         useXRepeat = true;
    80 
    8175        i = paramList.find("x11_keyboard_grab");
    8276        if( i != paramList.end() )
     
    172166        {
    173167                if( keyboardUsed == false )
    174                         obj = new LinuxKeyboard(this, bufferMode, grabKeyboard, useXRepeat);
     168                        obj = new LinuxKeyboard(this, bufferMode, grabKeyboard);
    175169                break;
    176170        }
  • code/branches/kicklib/src/external/ois/linux/LinuxInputManager.h

    r5781 r8071  
    101101                bool mGrabs;
    102102                bool hideMouse;
    103 
    104                 //! By default, keyboard disables XRepeatRate
    105                 bool useXRepeat;
    106103        };
    107104}
  • code/branches/kicklib/src/external/ois/linux/LinuxJoyStickEvents.cpp

    r5781 r8071  
    9696        //We are in non blocking mode - we just read once, and try to fill up buffer
    9797        input_event js[JOY_BUFFERSIZE];
    98         int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
    99         if( ret <= 0 )
    100                 return;
    101 
    102         //Determine how many whole events re read up
    103         ret /= sizeof(struct input_event);
    104         for(int i = 0; i < ret; ++i)
     98        while(true)
    10599        {
    106                 switch(js[i].type)
     100                int ret = read(mJoyStick, &js, sizeof(struct input_event) * JOY_BUFFERSIZE);
     101        if( ret < 0 )
     102                        break;
     103
     104                //Determine how many whole events re read up
     105                ret /= sizeof(struct input_event);
     106                for(int i = 0; i < ret; ++i)
    107107                {
    108                 case EV_KEY:  //Button
    109                 {
    110                         int button = mButtonMap[js[i].code];
    111 
    112                         #ifdef OIS_LINUX_JOY_DEBUG
    113                           cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl;
    114                         #endif
    115 
    116                         //Check to see whether push or released event...
    117                         if(js[i].value)
    118                         {
    119                                 mState.mButtons[button] = true;
    120                                 if( mBuffered && mListener )
    121                                         if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return;
    122                         }
    123                         else
    124                         {
    125                                 mState.mButtons[button] = false;
    126                                 if( mBuffered && mListener )
    127                                         if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return;
    128                         }
    129                         break;
    130                 }
    131 
    132                 case EV_ABS:  //Absolute Axis
    133                 {
    134                         //A Stick (BrakeDefine is the highest possible Axis)
    135                         if( js[i].code <= ABS_BRAKE )
    136                         {
    137                                 int axis = mAxisMap[js[i].code];
    138                                 assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" );
    139 
    140                                 axisMoved[axis] = true;
    141 
    142                                 //check for rescaling:
    143                                 if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS )
    144                                 {       //Scale is perfect
    145                                         mState.mAxes[axis].abs = js[i].value;
     108                        switch(js[i].type)
     109                        {
     110                        case EV_KEY:  //Button
     111                        {
     112                                int button = mButtonMap[js[i].code];
     113
     114                                #ifdef OIS_LINUX_JOY_DEBUG
     115                                  cout << "\nButton Code: " << js[i].code << ", OIS Value: " << button << endl;
     116                                #endif
     117
     118                                //Check to see whether push or released event...
     119                                if(js[i].value)
     120                                {
     121                                        mState.mButtons[button] = true;
     122                                        if( mBuffered && mListener )
     123                                                if(!mListener->buttonPressed(JoyStickEvent(this,mState), button)) return;
    146124                                }
    147125                                else
    148                                 {       //Rescale
    149                                         float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max);
    150                                         mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion));
     126                                {
     127                                        mState.mButtons[button] = false;
     128                                        if( mBuffered && mListener )
     129                                                if(!mListener->buttonReleased(JoyStickEvent(this,mState), button)) return;
    151130                                }
    152                         }
    153                         else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed
    154                         {
    155                                 //Normalise the POV to between 0-7
    156                                 //Even is X Axis, Odd is Y Axis
    157                                 unsigned char LinuxPovNumber = js[i].code - 16;
    158                                 short OIS_POVIndex = POV_MASK[LinuxPovNumber];
    159 
    160                                 //Handle X Axis first (Even) (left right)
    161                                 if((LinuxPovNumber & 0x0001) == 0)
     131                                break;
     132                        }
     133
     134                        case EV_ABS:  //Absolute Axis
     135                        {
     136                                //A Stick (BrakeDefine is the highest possible Axis)
     137                                if( js[i].code <= ABS_BRAKE )
    162138                                {
    163                                         //Why do this? Because, we use a bit field, and when this axis is east,
    164                                         //it can't possibly be west too. So clear out the two X axes, then refil
    165                                         //it in with the new direction bit.
    166                                         //Clear the East/West Bit Flags first
    167                                         mState.mPOV[OIS_POVIndex].direction &= 0x11110011;
    168                                         if( js[i].value == -1 ) //Left
    169                                                 mState.mPOV[OIS_POVIndex].direction |= Pov::West;
    170                                         else if( js[i].value == 1 ) //Right
    171                                                 mState.mPOV[OIS_POVIndex].direction |= Pov::East;
     139                                        int axis = mAxisMap[js[i].code];
     140                                        assert( axis < 32 && "Too many axes (Max supported is 32). Report this to OIS forums!" );
     141
     142                                        axisMoved[axis] = true;
     143
     144                                        //check for rescaling:
     145                                        if( mRanges[axis].min == JoyStick::MIN_AXIS && mRanges[axis].max != JoyStick::MAX_AXIS )
     146                                        {       //Scale is perfect
     147                                                mState.mAxes[axis].abs = js[i].value;
     148                                        }
     149                                        else
     150                                        {       //Rescale
     151                                                float proportion = (float)(js[i].value-mRanges[axis].max)/(float)(mRanges[axis].min-mRanges[axis].max);
     152                                                mState.mAxes[axis].abs = (int)(32767.0f - (65535.0f * proportion));
     153                                        }
    172154                                }
    173                                 //Handle Y Axis (Odd) (up down)
    174                                 else
     155                                else if( js[i].code <= ABS_HAT3Y ) //A POV - Max four POVs allowed
    175156                                {
    176                                         //Clear the North/South Bit Flags first
    177                                         mState.mPOV[OIS_POVIndex].direction &= 0x11111100;
    178                                         if( js[i].value == -1 ) //Up
    179                                                 mState.mPOV[OIS_POVIndex].direction |= Pov::North;
    180                                         else if( js[i].value == 1 ) //Down
    181                                                 mState.mPOV[OIS_POVIndex].direction |= Pov::South;
     157                                        //Normalise the POV to between 0-7
     158                                        //Even is X Axis, Odd is Y Axis
     159                                        unsigned char LinuxPovNumber = js[i].code - 16;
     160                                        short OIS_POVIndex = POV_MASK[LinuxPovNumber];
     161
     162                                        //Handle X Axis first (Even) (left right)
     163                                        if((LinuxPovNumber & 0x0001) == 0)
     164                                        {
     165                                                //Why do this? Because, we use a bit field, and when this axis is east,
     166                                                //it can't possibly be west too. So clear out the two X axes, then refil
     167                                                //it in with the new direction bit.
     168                                                //Clear the East/West Bit Flags first
     169                                                mState.mPOV[OIS_POVIndex].direction &= 0x11110011;
     170                                                if( js[i].value == -1 ) //Left
     171                                                        mState.mPOV[OIS_POVIndex].direction |= Pov::West;
     172                                                else if( js[i].value == 1 ) //Right
     173                                                        mState.mPOV[OIS_POVIndex].direction |= Pov::East;
     174                                        }
     175                                        //Handle Y Axis (Odd) (up down)
     176                                        else
     177                                        {
     178                                                //Clear the North/South Bit Flags first
     179                                                mState.mPOV[OIS_POVIndex].direction &= 0x11111100;
     180                                                if( js[i].value == -1 ) //Up
     181                                                        mState.mPOV[OIS_POVIndex].direction |= Pov::North;
     182                                                else if( js[i].value == 1 ) //Down
     183                                                        mState.mPOV[OIS_POVIndex].direction |= Pov::South;
     184                                        }
     185
     186                                        if( mBuffered && mListener )
     187                                                if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false )
     188                                                        return;
    182189                                }
    183 
    184                                 if( mBuffered && mListener )
    185                                         if( mListener->povMoved( JoyStickEvent(this,mState), OIS_POVIndex) == false )
    186                                                 return;
    187                         }
    188                         break;
    189                 }
    190 
    191                
    192                 case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?)
    193 #ifdef OIS_LINUX_JOY_DEBUG
    194                     cout << "\nWarning: Relatives axes not supported yet" << endl;
    195 #endif
    196                         break;
    197                 default: break;
     190                                break;
     191                        }
     192
     193                       
     194                        case EV_REL: //Relative Axes (Do any joystick actually have a relative axis?)
     195        #ifdef OIS_LINUX_JOY_DEBUG
     196                                cout << "\nWarning: Relatives axes not supported yet" << endl;
     197        #endif
     198                                break;
     199                        default: break;
     200                        }
    198201                }
    199202        }
  • code/branches/kicklib/src/external/ois/linux/LinuxKeyboard.cpp

    r5781 r8071  
    3333#include <iostream>
    3434//-------------------------------------------------------------------//
    35 LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat)
     35LinuxKeyboard::LinuxKeyboard(InputManager* creator, bool buffered, bool grab)
    3636        : Keyboard(creator->inputSystemName(), buffered, 0, creator)
    3737{
     
    4343        grabKeyboard = grab;
    4444        keyFocusLost = false;
    45 
    46         xAutoRepeat = useXRepeat;
    47         oldXAutoRepeat = false;
    4845
    4946        //X Key Map to KeyCode
     
    213210
    214211        keyFocusLost = false;
    215 
    216         if( xAutoRepeat == false )
    217         {
    218                 //We do not want to blindly turn on autorepeat later when quiting if
    219                 //it was not on to begin with.. So, let us check and see first
    220                 XKeyboardState old;
    221                 XGetKeyboardControl( display, &old );
    222                 oldXAutoRepeat = false;
    223 
    224                 if( old.global_auto_repeat == AutoRepeatModeOn )
    225                         oldXAutoRepeat = true;
    226 
    227                 XAutoRepeatOff( display );
    228         }
    229212}
    230213
     
    234217        if( display )
    235218        {
    236                 if( oldXAutoRepeat )
    237                         XAutoRepeatOn(display);
    238 
    239219                if( grabKeyboard )
    240220                        XUngrabKeyboard(display, CurrentTime);
     
    303283
    304284        while( XPending(display) > 0 )
    305         {               XNextEvent(display, &event);            if( KeyPress == event.type )
     285        {
     286                XNextEvent(display, &event);            if(KeyPress == event.type)
    306287                {
    307288                        unsigned int character = 0;
    308289
    309                         if( mTextMode != Off )
     290                        if(mTextMode != Off)
    310291                        {
    311292                                unsigned char buffer[6] = {0,0,0,0,0,0};
     
    332313                        if( event.xkey.state & Mod1Mask && key == XK_Tab )
    333314                                linMan->_setGrabState(false);
    334                 }               else if( KeyRelease == event.type )
     315                }
     316                else if(KeyRelease == event.type)
    335317                {
    336                         //Mask out the modifier states X sets.. or we will get improper values
    337                         event.xkey.state &= ~ShiftMask;
    338                         event.xkey.state &= ~LockMask;
    339 
    340                         //Else, it is a valid key release
    341                         XLookupString(&event.xkey,NULL,0,&key,NULL);
    342                         _injectKeyUp(key);              }
     318                        if(!_isKeyRepeat(event))
     319                        {
     320                                //Mask out the modifier states X sets.. or we will get improper values
     321                                event.xkey.state &= ~ShiftMask;
     322                                event.xkey.state &= ~LockMask;
     323
     324                                XLookupString(&event.xkey,NULL,0,&key,NULL);
     325                                _injectKeyUp(key);
     326                        }
     327                }
    343328        }
    344329
  • code/branches/kicklib/src/external/ois/linux/LinuxKeyboard.h

    r5781 r8071  
    3434        {
    3535        public:
    36                 LinuxKeyboard(InputManager* creator, bool buffered, bool grab, bool useXRepeat );
     36                LinuxKeyboard(InputManager* creator, bool buffered, bool grab);
    3737                virtual ~LinuxKeyboard();
    3838
     
    5959
    6060        protected:
     61                inline bool _isKeyRepeat(XEvent &event)
     62                {
     63                        //When a key is repeated, there will be two events: released, followed by another immediate pressed. So check to see if another pressed is present     
     64                        if(!XPending(display))
     65                                return false;
     66
     67                        XEvent e;
     68                        XPeekEvent(display, &e);
     69                        if(e.type == KeyPress && e.xkey.keycode == event.xkey.keycode && (e.xkey.time - event.xkey.time) < 2)
     70                        {
     71                                XNextEvent(display, &e);
     72                                return true;
     73                        }
     74
     75                        return false;
     76                }
     77
    6178                bool _injectKeyDown( KeySym key, int text );
    6279                bool _injectKeyUp( KeySym key );
     
    7592                bool keyFocusLost;
    7693
    77                 bool xAutoRepeat;
    78                 bool oldXAutoRepeat;
    79 
    8094                std::string mGetString;
    8195        };
  • code/branches/kicklib/src/external/ois/linux/LinuxMouse.cpp

    r5781 r8071  
    173173
    174174                        //Compute this frames Relative X & Y motion
    175                         mState.X.rel = event.xmotion.x - oldXMouseX;
    176                         mState.Y.rel = event.xmotion.y - oldXMouseY;
     175                        int dx = event.xmotion.x - oldXMouseX;
     176                        int dy = event.xmotion.y - oldXMouseY;
    177177               
    178178                        //Store old values for next time to compute relative motion
     
    180180                        oldXMouseY = event.xmotion.y;
    181181
    182                         mState.X.abs += mState.X.rel;
    183                         mState.Y.abs += mState.Y.rel;
     182                        mState.X.abs += dx;
     183                        mState.Y.abs += dy;
     184                        mState.X.rel += dx;
     185                        mState.Y.rel += dy;
    184186
    185187                        //Check to see if we are grabbing the mouse to the window (requires clipping and warping)
  • code/branches/kicklib/src/external/ois/linux/LinuxPrereqs.h

    r5781 r8071  
    3232
    3333//! Max number of elements to collect from buffered input
    34 #define JOY_BUFFERSIZE 10
     34#define JOY_BUFFERSIZE 64
    3535
    3636namespace OIS
  • code/branches/kicklib/src/external/ois/mac/CMakeLists.txt

    r5929 r8071  
    33  MacHIDManager.h
    44  MacInputManager.h
     5  MacJoyStick.h
    56  MacKeyboard.h
    67  MacMouse.h
    78  MacPrereqs.h
    89
    9 COMPILATION_BEGIN OISMacCompilation.cpp
     10  #COMPILATION_BEGIN OISMacCompilation.cpp
    1011  MacHelpers.cpp
    1112  MacHIDManager.cpp
    1213  MacInputManager.cpp
     14  MacJoyStick.cpp
    1315  MacKeyboard.cpp
    1416  MacMouse.cpp
    15 COMPILATION_END
     17  #COMPILATION_END
    1618)
  • code/branches/kicklib/src/external/ois/mac/MacHIDManager.cpp

    r5781 r8071  
    2020 
    2121 3. This notice may not be removed or altered from any source distribution.
    22 */
     22 */
    2323#include "mac/MacHIDManager.h"
     24#include "mac/MacJoyStick.h"
    2425#include "OISException.h"
    2526#include "OISObject.h"
     
    4243{
    4344        CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName));
    44 
     45       
    4546        if(temp && CFGetTypeID(temp) == CFArrayGetTypeID())
    4647                return (CFArrayRef)temp;
     
    5354{
    5455        CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName));
    55 
     56       
    5657        if(temp && CFGetTypeID(temp) == CFStringGetTypeID())
    5758                return (CFStringRef)temp;
     
    6465{
    6566        CFTypeRef temp = CFDictionaryGetValue(dict, OIS_CFString(keyName));
    66 
     67       
    6768        if(temp && CFGetTypeID(temp) == CFNumberGetTypeID())
    6869                return (CFNumberRef)temp;
     
    8384{
    8485        CFTypeRef temp = CFArrayGetValueAtIndex(array, idx);
    85 
     86       
    8687        if(temp && CFGetTypeID(temp) == CFDictionaryGetTypeID())
    8788                return (CFDictionaryRef)temp;
     
    9394int getInt32(CFNumberRef ref)
    9495{
    95    int r = 0;
    96    if (r)
    97       CFNumberGetValue(ref, kCFNumberIntType, &r);
    98    return r;
     96        int r = 0;
     97        if (r)
     98                CFNumberGetValue(ref, kCFNumberIntType, &r);
     99        return r;
    99100}
    100101
     
    111112//------------------------------------------------------------------------------------------------------//
    112113void MacHIDManager::initialize()
     114{
     115        //Make the search more specific by adding usage flags
     116        int usage = kHIDUsage_GD_Joystick;
     117        int page = kHIDPage_GenericDesktop;
     118       
     119        io_iterator_t iterator = lookUpDevices(usage, page);
     120       
     121        if(iterator)
     122                iterateAndOpenDevices(iterator);
     123       
     124        //Doesn't support multiple usage flags, iterate twice
     125        usage = kHIDUsage_GD_GamePad;
     126        iterator = lookUpDevices(usage, page);
     127       
     128        if(iterator)
     129                iterateAndOpenDevices(iterator);
     130}
     131
     132//------------------------------------------------------------------------------------------------------//
     133io_iterator_t MacHIDManager::lookUpDevices(int usage, int page)
    113134{
    114135        CFMutableDictionaryRef deviceLookupMap = IOServiceMatching(kIOHIDDeviceKey);
    115136        if(!deviceLookupMap)
    116137                OIS_EXCEPT(E_General, "Could not setup HID device search parameters");
    117 
    118         //Make the search more specific by adding usage flags
    119         int usage = kHIDUsage_GD_GamePad | kHIDUsage_GD_Joystick,
    120             page  = kHIDPage_GenericDesktop;
    121 
    122         CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage),
    123                                 pageRef  = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
    124 
     138       
     139        CFNumberRef usageRef = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &usage);
     140        CFNumberRef pageRef  = CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &page);
     141       
    125142        CFDictionarySetValue(deviceLookupMap, CFSTR(kIOHIDPrimaryUsageKey), usageRef);
    126143        CFDictionarySetValue(deviceLookupMap, CFSTR(kIOHIDPrimaryUsagePageKey), pageRef);
    127 
     144       
    128145        //IOServiceGetMatchingServices consumes the map so we do not have to release it ourself
    129146        io_iterator_t iterator = 0;
    130147        IOReturn result = IOServiceGetMatchingServices(kIOMasterPortDefault, deviceLookupMap, &iterator);
    131         if (result == kIOReturnSuccess && iterator)
    132         {
    133                 io_object_t hidDevice = 0;
    134                 while ((hidDevice = IOIteratorNext(iterator)) !=0)
     148       
     149        CFRelease(usageRef);
     150        CFRelease(pageRef);
     151       
     152        if(result == kIOReturnSuccess)
     153        {
     154                return iterator;
     155        }
     156        //TODO: Throw exception instead?
     157        else
     158        {
     159                return 0;
     160        }
     161}
     162
     163//------------------------------------------------------------------------------------------------------//
     164void MacHIDManager::iterateAndOpenDevices(io_iterator_t iterator)
     165{
     166        io_object_t hidDevice = 0;
     167        while ((hidDevice = IOIteratorNext(iterator)) !=0)
     168        {
     169                //Get the current registry items property map
     170                CFMutableDictionaryRef propertyMap = 0;
     171                if (IORegistryEntryCreateCFProperties(hidDevice, &propertyMap, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS && propertyMap)
    135172                {
    136                         //Get the current registry items property map
    137                         CFMutableDictionaryRef propertyMap = 0;
    138                         if (IORegistryEntryCreateCFProperties(hidDevice, &propertyMap, kCFAllocatorDefault, kNilOptions) == KERN_SUCCESS && propertyMap)
     173                        //Go through device to find all needed info
     174                        HidInfo* hid = enumerateDeviceProperties(propertyMap);
     175                       
     176                        if(hid)
    139177                        {
    140                                 //Go through device to find all needed info
    141                                 HidInfo* hid = enumerateDeviceProperties(propertyMap);
    142                                 if(hid)
    143                                         mDeviceList.push_back(hid);
    144                                        
    145178                                //todo - we need to hold an open interface so we do not have to enumerate again later
    146179                                //should be able to watch for device removals also
    147 
    148                                 /// Testing opening / closing interface
    149                                 //IOCFPlugInInterface **pluginInterface = NULL;
    150                                 //SInt32 score = 0;
    151                                 //if (IOCreatePlugInInterfaceForService(hidDevice, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInterface, &score) == kIOReturnSuccess)
    152                                 //{
    153                                 //      IOHIDDeviceInterface **interface;
    154                                 //      HRESULT pluginResult = (*pluginInterface)->QueryInterface(pluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void **)&(interface));
    155                                 //      if(pluginResult == S_OK)
    156                                 //              cout << "Successfully created plugin interface for device\n";
    157                                 //      else
    158                                 //              cout << "Not able to create plugin interface\n";
    159 
    160                                 //      IODestroyPlugInInterface(pluginInterface);
    161 
    162                                 //      if ((*interface)->open(interface, 0) == KERN_SUCCESS)
    163                                 //              cout << "Opened interface.\n";
    164                                 //      else
    165                                 //              cout << "Failed to open\n";
    166 
    167                                 //      (*interface)->close(interface);
    168                                 //}
    169                                 //
     180                               
     181                                // Testing opening / closing interface
     182                                IOCFPlugInInterface **pluginInterface = NULL;
     183                                SInt32 score = 0;
     184                                if (IOCreatePlugInInterfaceForService(hidDevice, kIOHIDDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &pluginInterface, &score) == kIOReturnSuccess)
     185                                {
     186                                        IOHIDDeviceInterface **interface;
     187                                       
     188                                        HRESULT pluginResult = (*pluginInterface)->QueryInterface(pluginInterface, CFUUIDGetUUIDBytes(kIOHIDDeviceInterfaceID), (void **)&(interface));
     189                                       
     190                                        if(pluginResult != S_OK)
     191                                                OIS_EXCEPT(E_General, "Not able to create plugin interface");
     192                                       
     193                                        IODestroyPlugInInterface(pluginInterface);
     194                                       
     195                                        hid->interface = interface;
     196                                       
     197                                        //Check for duplicates - some devices have multiple usage
     198                                        if(std::find(mDeviceList.begin(), mDeviceList.end(), hid) == mDeviceList.end())
     199                                                mDeviceList.push_back(hid);
     200                                }
    170201                        }
    171202                }
    172 
    173                 IOObjectRelease(iterator);
    174         }
    175 
    176         CFRelease(usageRef);
    177         CFRelease(pageRef);
     203        }
     204       
     205        IOObjectRelease(iterator);
    178206}
    179207
     
    188216        if (str)
    189217                info->vendor = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());
    190 
     218       
    191219        str = getDictionaryItemAsRef<CFStringRef>(propertyMap, kIOHIDProductKey);
    192220        if (str)
    193221                info->productKey = CFStringGetCStringPtr(str, CFStringGetSystemEncoding());
    194                
     222       
    195223        info->combinedKey = info->vendor + " " + info->productKey;
    196 
     224       
    197225        //Go through all items in this device (i.e. buttons, hats, sticks, axes, etc)
    198226        CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(propertyMap, kIOHIDElementKey);
     
    200228                for (int i = 0; i < CFArrayGetCount(array); i++)
    201229                        parseDeviceProperties(getArrayItemAsRef<CFDictionaryRef>(array, i));
    202 
     230       
    203231        return info;
    204232}
     
    209237        if(!properties)
    210238                return;
    211 
     239       
    212240        CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(properties, kIOHIDElementKey);
    213241        if (array)
     
    227255                                        switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsagePageKey)))
    228256                                        {
    229                                         case kHIDPage_GenericDesktop:
    230                                                 switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))
     257                                                case kHIDPage_GenericDesktop:
     258                                                        switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))
    231259                                                {
    232                                                 case kHIDUsage_GD_Pointer:
    233                                                         cout << "\tkHIDUsage_GD_Pointer\n";
    234                                                         parseDevicePropertiesGroup(element);
     260                                                        case kHIDUsage_GD_Pointer:
     261                                                                cout << "\tkHIDUsage_GD_Pointer\n";
     262                                                                parseDevicePropertiesGroup(element);
     263                                                                break;
     264                                                        case kHIDUsage_GD_X:
     265                                                        case kHIDUsage_GD_Y:
     266                                                        case kHIDUsage_GD_Z:
     267                                                        case kHIDUsage_GD_Rx:
     268                                                        case kHIDUsage_GD_Ry:
     269                                                        case kHIDUsage_GD_Rz:
     270                                                                cout << "\tAxis\n";
     271                                                                break;
     272                                                        case kHIDUsage_GD_Slider:
     273                                                        case kHIDUsage_GD_Dial:
     274                                                        case kHIDUsage_GD_Wheel:
     275                                                                cout << "\tUnsupported kHIDUsage_GD_Wheel\n";
     276                                                                break;
     277                                                        case kHIDUsage_GD_Hatswitch:
     278                                                                cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";
     279                                                                break;
     280                                                }
    235281                                                        break;
    236                                                 case kHIDUsage_GD_X:
    237                                                 case kHIDUsage_GD_Y:
    238                                                 case kHIDUsage_GD_Z:
    239                                                 case kHIDUsage_GD_Rx:
    240                                                 case kHIDUsage_GD_Ry:
    241                                                 case kHIDUsage_GD_Rz:
    242                                                         cout << "\tAxis\n";
     282                                                case kHIDPage_Button:
     283                                                        cout << "\tkHIDPage_Button\n";
    243284                                                        break;
    244                                                 case kHIDUsage_GD_Slider:
    245                                                 case kHIDUsage_GD_Dial:
    246                                                 case kHIDUsage_GD_Wheel:
    247                                                         cout << "\tUnsupported kHIDUsage_GD_Wheel\n";
    248                                                         break;
    249                                                 case kHIDUsage_GD_Hatswitch:
    250                                                         cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";
    251                                                         break;
    252                                                 }
    253                                                 break;
    254                                         case kHIDPage_Button:
    255                                                 cout << "\tkHIDPage_Button\n";
    256                                                 break;
    257285                                        }
    258286                                }
     
    267295        if(!properties)
    268296                return;
    269 
     297       
    270298        CFArrayRef array = getDictionaryItemAsRef<CFArrayRef>(properties, kIOHIDElementKey);
    271299        if(array)
     
    278306                                switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsagePageKey)))
    279307                                {
    280                                 case kHIDPage_GenericDesktop:
    281                                         switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))
     308                                        case kHIDPage_GenericDesktop:
     309                                                switch(getInt32(getDictionaryItemAsRef<CFNumberRef>(element, kIOHIDElementUsageKey)))
    282310                                        {
    283                                         case kHIDUsage_GD_X:
    284                                         case kHIDUsage_GD_Y:
    285                                         case kHIDUsage_GD_Z:
    286                                         case kHIDUsage_GD_Rx:
    287                                         case kHIDUsage_GD_Ry:
    288                                         case kHIDUsage_GD_Rz:
    289                                                 cout << "\t\tAxis\n";
     311                                                case kHIDUsage_GD_X:
     312                                                case kHIDUsage_GD_Y:
     313                                                case kHIDUsage_GD_Z:
     314                                                case kHIDUsage_GD_Rx:
     315                                                case kHIDUsage_GD_Ry:
     316                                                case kHIDUsage_GD_Rz:
     317                                                        cout << "\t\tAxis\n";
     318                                                        break;
     319                                                case kHIDUsage_GD_Slider:
     320                                                case kHIDUsage_GD_Dial:
     321                                                case kHIDUsage_GD_Wheel:
     322                                                        cout << "\tUnsupported - kHIDUsage_GD_Wheel\n";
     323                                                        break;
     324                                                case kHIDUsage_GD_Hatswitch:
     325                                                        cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";
     326                                                        break;
     327                                        }
    290328                                                break;
    291                                         case kHIDUsage_GD_Slider:
    292                                         case kHIDUsage_GD_Dial:
    293                                         case kHIDUsage_GD_Wheel:
    294                                                 cout << "\tUnsupported - kHIDUsage_GD_Wheel\n";
     329                                        case kHIDPage_Button:
    295330                                                break;
    296                                         case kHIDUsage_GD_Hatswitch:
    297                                                 cout << "\tUnsupported - kHIDUsage_GD_Hatswitch\n";
    298                                                 break;
    299                                         }
    300                                         break;
    301                                 case kHIDPage_Button:
    302                                         break;
    303331                                }
    304332                        }
     
    317345                        ret.insert(std::make_pair((*it)->type, (*it)->combinedKey));
    318346        }
    319 
     347       
    320348        return ret;
    321349}
     
    326354        int ret = 0;
    327355        HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end();
    328 
     356       
    329357        for(; it != end; ++it)
    330358        {
     
    341369        int ret = 0;
    342370        HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end();
    343 
     371       
    344372        for(; it != end; ++it)
    345373        {
     
    347375                        ret++;
    348376        }
    349 
     377       
    350378        return ret;
    351379}
     
    355383{
    356384        HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end();
    357 
     385       
    358386        for(; it != end; ++it)
    359387        {
     
    367395//--------------------------------------------------------------------------------//
    368396Object* MacHIDManager::createObject(InputManager* creator, Type iType, bool bufferMode,
    369                                                                           const std::string & vendor)
     397                                                                        const std::string & vendor)
    370398{
    371399        Object *obj = 0;
    372 
     400       
    373401        HidInfoList::iterator it = mDeviceList.begin(), end = mDeviceList.end();
    374402        for(; it != end; ++it)
     
    376404                if((*it)->inUse == false && (*it)->type == iType && (vendor == "" || (*it)->combinedKey == vendor))
    377405                {
    378                         //create device
     406                        switch(iType)
     407                        {
     408                                case OISJoyStick:
     409                {
     410                                        int totalDevs = totalDevices(iType);
     411                                        int freeDevs = freeDevices(iType);
     412                                        int devID = totalDevs - freeDevs;
     413                                       
     414                                        obj = new MacJoyStick((*it)->combinedKey, bufferMode, *it, creator, devID);
     415                                        (*it)->inUse = true;
     416                                        return obj;
     417                }
     418                                case OISTablet:
     419                                        //Create MacTablet
     420                                        break;
     421                                default:
     422                                        break;
     423                        }
    379424                }
    380425        }
    381 
    382         if( obj == 0 )
    383                 OIS_EXCEPT(E_InputDeviceNonExistant, "No devices match requested type.");
    384 
     426       
    385427        return obj;
    386428}
  • code/branches/kicklib/src/external/ois/mac/MacHIDManager.h

    r5781 r8071  
    7070
    7171                void initialize();
     72               
     73                void iterateAndOpenDevices(io_iterator_t iterator);
     74                io_iterator_t lookUpDevices(int usage, int page);
    7275
    7376                //FactoryCreator Overrides
  • code/branches/kicklib/src/external/ois/mac/MacInputManager.cpp

    r5781 r8071  
    188188        }
    189189        default:
     190        {
     191                obj = mHIDManager->createObject(creator, iType, bufferMode, vendor);
    190192                break;
     193        }
    191194        }
    192195
  • code/branches/kicklib/src/external/ois/mac/MacKeyboard.cpp

    r5781 r8071  
    199199        char macChar;
    200200       
    201         // TODO clean this up
    202201        if (mTextMode == Unicode)
    203202        {
    204203                //get string size
    205204                UInt32 stringsize;
    206                 //status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, 0, &stringsize, NULL);
    207                 //status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar)*10, NULL, &text );
    208205                status = GetEventParameter( theEvent, 'kuni', typeUnicodeText, NULL, sizeof(UniChar) * 10, &stringsize, &text );
    209                 std::cout << "String length: " << stringsize << std::endl;
    210                
    211                 //wstring unitext;
    212                 //for (int i=0;i<10;i++) unitext += (wchar_t)text[i];
    213                 //wcout << "Unicode out: " << unitext << endl;
    214206               
    215207                if(stringsize > 0)
  • code/branches/kicklib/src/external/ois/win32/Win32ForceFeedback.cpp

    r5929 r8071  
    2121    3. This notice may not be removed or altered from any source distribution.
    2222*/
    23 #include "Win32/Win32ForceFeedback.h"
     23#include "win32/Win32ForceFeedback.h"
    2424#include "OISException.h"
    25 #include <Math.h>
     25#include <math.h>
    2626
    2727// 0 = No trace; 1 = Important traces; 2 = Debug traces
  • code/branches/kicklib/src/external/ois/win32/Win32ForceFeedback.h

    r5781 r8071  
    2626#include "OISPrereqs.h"
    2727#include "OISForceFeedback.h"
    28 #include "Win32/Win32Prereqs.h"
     28#include "win32/Win32Prereqs.h"
    2929
    3030namespace OIS
  • code/branches/kicklib/src/external/ois/win32/Win32InputManager.cpp

    r5781 r8071  
    2121    3. This notice may not be removed or altered from any source distribution.
    2222*/
    23 #include "Win32/Win32InputManager.h"
    24 #include "Win32/Win32Keyboard.h"
    25 #include "Win32/Win32Mouse.h"
    26 #include "Win32/Win32JoyStick.h"
     23#include "win32/Win32InputManager.h"
     24#include "win32/Win32KeyBoard.h"
     25#include "win32/Win32Mouse.h"
     26#include "win32/Win32JoyStick.h"
    2727#include "OISException.h"
    2828
     
    7575        hInst = GetModuleHandle(0);
    7676
    77         //Create the input system
     77        //Create the device
    7878        hr = DirectInput8Create( hInst, DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID**)&mDirectInput, NULL );
    7979    if (FAILED(hr))     
     
    118118{
    119119        //Enumerate all attached devices
    120         mDirectInput->EnumDevices(NULL , _DIEnumDevCallback, this, DIEDFL_ATTACHEDONLY);
     120        mDirectInput->EnumDevices(NULL, _DIEnumDevCallback, this, DIEDFL_ATTACHEDONLY);
     121
     122#ifdef OIS_WIN32_XINPUT_SUPPORT
     123        //let's check how many possible XInput devices we may have (max 4)...
     124        for(int i = 0; i < 3; ++i)
     125        {
     126                XINPUT_STATE state;
     127                if(XInputGetState(i, &state) != ERROR_DEVICE_NOT_CONNECTED)
     128                {       //Once we found 1, just check our whole list against devices
     129                        Win32JoyStick::CheckXInputDevices(unusedJoyStickList);
     130                        break;
     131                }
     132        }
     133#endif
    121134}
    122135
     
    134147        {
    135148                JoyStickInfo jsInfo;
     149                jsInfo.isXInput = false;
     150                jsInfo.productGuid = lpddi->guidProduct;
    136151                jsInfo.deviceID = lpddi->guidInstance;
    137152                jsInfo.vendor = lpddi->tszInstanceName;
  • code/branches/kicklib/src/external/ois/win32/Win32InputManager.h

    r5781 r8071  
    2626#include "OISInputManager.h"
    2727#include "OISFactoryCreator.h"
    28 #include "Win32/Win32Prereqs.h"
     28#include "win32/Win32Prereqs.h"
    2929
    3030namespace OIS
  • code/branches/kicklib/src/external/ois/win32/Win32JoyStick.cpp

    r5781 r8071  
    2121    3. This notice may not be removed or altered from any source distribution.
    2222*/
    23 #include "Win32/Win32JoyStick.h"
    24 #include "Win32/Win32InputManager.h"
    25 #include "Win32/Win32ForceFeedback.h"
     23#include "win32/Win32JoyStick.h"
     24#include "win32/Win32InputManager.h"
     25#include "win32/Win32ForceFeedback.h"
    2626#include "OISEvents.h"
    2727#include "OISException.h"
    2828
    2929#include <cassert>
     30#include <wbemidl.h>
     31#include <oleauto.h>
     32//#include <wmsstd.h>
     33#ifndef SAFE_RELEASE
     34#define SAFE_RELEASE(x) \
     35   if(x != NULL)        \
     36   {                    \
     37      x->Release();     \
     38      x = NULL;         \
     39   }
     40#endif
     41
     42#ifdef OIS_WIN32_XINPUT_SUPPORT
     43#       pragma comment(lib, "xinput.lib")
     44#endif
    3045
    3146//DX Only defines macros for the JOYSTICK not JOYSTICK2, so fix it
     
    4055#define DIJOFS_SLIDER3(n) (FIELD_OFFSET(DIJOYSTATE2, rglFSlider)+(n) * sizeof(LONG))
    4156
     57#define XINPUT_TRANSLATED_BUTTON_COUNT 12
     58#define XINPUT_TRANSLATED_AXIS_COUNT 6
     59
    4260using namespace OIS;
    4361
    4462//--------------------------------------------------------------------------------------------------//
    45 Win32JoyStick::Win32JoyStick( InputManager* creator, IDirectInput8* pDI,
    46         bool buffered, DWORD coopSettings, const JoyStickInfo &info )
    47         : JoyStick(info.vendor, buffered, info.devId, creator)
    48 {
    49         mDirectInput = pDI;
    50         coopSetting = coopSettings;
    51         mJoyStick = 0;
    52 
    53         deviceGuid = info.deviceID;
    54 
    55         ff_device = 0;
     63Win32JoyStick::Win32JoyStick( InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings, const JoyStickInfo &info ) :
     64        JoyStick(info.vendor, buffered, info.devId, creator),
     65        mDirectInput(pDI),
     66        coopSetting(coopSettings),
     67        mJoyStick(0),
     68        mJoyInfo(info),
     69        mFfDevice(0)
     70{
    5671}
    5772
     
    5974Win32JoyStick::~Win32JoyStick()
    6075{
    61         delete ff_device;
     76        delete mFfDevice;
    6277
    6378        if(mJoyStick)
     
    6984
    7085        //Return joystick to pool
    71         JoyStickInfo js;
    72         js.deviceID = deviceGuid;
    73         js.devId = mDevID;
    74         js.vendor = mVendor;
    75         static_cast<Win32InputManager*>(mCreator)->_returnJoyStick(js);
     86        static_cast<Win32InputManager*>(mCreator)->_returnJoyStick(mJoyInfo);
    7687}
    7788
     
    7990void Win32JoyStick::_initialize()
    8091{
    81         //Clear old state
    82         mState.mAxes.clear();
    83 
    84         if (ff_device)
    85         {
    86                 delete ff_device;
    87                 ff_device = 0;
    88         }
    89 
    90         // Create direct input joystick device.
    91         if(FAILED(mDirectInput->CreateDevice(deviceGuid, &mJoyStick, NULL)))
    92                 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> Could not initialize joy device!");
    93 
    94         // Set DIJoystick2 data format.
    95         if(FAILED(mJoyStick->SetDataFormat(&c_dfDIJoystick2)))
    96                 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> data format error!");
    97 
    98         // Set cooperative level as specified when creating input manager.
    99         HWND hwin = ((Win32InputManager*)mCreator)->getWindowHandle();
    100         if(FAILED(mJoyStick->SetCooperativeLevel( hwin, coopSetting)))
    101                 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> failed to set cooperation level!");
    102 
    103         // Set buffer size.
    104         DIPROPDWORD dipdw;
    105         dipdw.diph.dwSize       = sizeof(DIPROPDWORD);
    106         dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
    107         dipdw.diph.dwObj        = 0;
    108         dipdw.diph.dwHow        = DIPH_DEVICE;
    109         dipdw.dwData            = JOYSTICK_DX_BUFFERSIZE;
    110 
    111         if( FAILED(mJoyStick->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)) )
    112                 OIS_EXCEPT( E_General, "Win32JoyStick::_initialize >> Failed to set buffer size property" );
    113 
    114         // Enumerate all axes/buttons/sliders/force feedback/etc before aquiring
    115         _enumerate();
    116 
    117         mState.clear();
    118 
    119         capture();
     92    if (mJoyInfo.isXInput)
     93    {
     94        _enumerate();
     95    }
     96    else
     97    {
     98            //Clear old state
     99            mState.mAxes.clear();
     100
     101            delete mFfDevice;
     102            mFfDevice = 0;
     103
     104            DIPROPDWORD dipdw;
     105
     106            dipdw.diph.dwSize       = sizeof(DIPROPDWORD);
     107            dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER);
     108            dipdw.diph.dwObj        = 0;
     109            dipdw.diph.dwHow        = DIPH_DEVICE;
     110            dipdw.dwData            = JOYSTICK_DX_BUFFERSIZE;
     111
     112            if(FAILED(mDirectInput->CreateDevice(mJoyInfo.deviceID, &mJoyStick, NULL)))
     113                    OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> Could not initialize joy device!");
     114
     115            if(FAILED(mJoyStick->SetDataFormat(&c_dfDIJoystick2)))
     116                    OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> data format error!");
     117
     118            HWND hwin = ((Win32InputManager*)mCreator)->getWindowHandle();
     119
     120            if(FAILED(mJoyStick->SetCooperativeLevel( hwin, coopSetting)))
     121                    OIS_EXCEPT( E_General, "Win32JoyStick::_initialize() >> failed to set cooperation level!");
     122
     123            if( FAILED(mJoyStick->SetProperty(DIPROP_BUFFERSIZE, &dipdw.diph)) )
     124                    OIS_EXCEPT( E_General, "Win32Mouse::Win32Mouse >> Failed to set buffer size property" );
     125
     126            //Enumerate all axes/buttons/sliders/etc before aquiring
     127            _enumerate();
     128
     129            mState.clear();
     130
     131            capture();
     132    }
    120133}
    121134
     
    123136void Win32JoyStick::_enumerate()
    124137{
    125         // Get joystick capabilities.
    126         mDIJoyCaps.dwSize = sizeof(DIDEVCAPS);
    127         if( FAILED(mJoyStick->GetCapabilities(&mDIJoyCaps)) )
    128                 OIS_EXCEPT( E_General, "Win32JoyStick::_enumerate >> Failed to get capabilities" );
    129 
    130         // => Number of POVs
    131         mPOVs = (short)mDIJoyCaps.dwPOVs;
    132 
    133         // => Number of buttons and axes.
    134         mState.mButtons.resize(mDIJoyCaps.dwButtons);
    135         mState.mAxes.resize(mDIJoyCaps.dwAxes);
    136 
    137         // Enumerate all Force Feedback effects (if any)
    138         mJoyStick->EnumEffects(DIEnumEffectsCallback, this, DIEFT_ALL);
    139 
    140         //Reset the axis mapping enumeration value
    141         _AxisNumber = 0;
    142 
    143         // Enumerate and set axis constraints (and check FF Axes)
    144         mJoyStick->EnumObjects(DIEnumDeviceObjectsCallback, this, DIDFT_AXIS);
     138    if (mJoyInfo.isXInput)
     139    {
     140        mPOVs = 1;
     141
     142        mState.mButtons.resize(XINPUT_TRANSLATED_BUTTON_COUNT);
     143            mState.mAxes.resize(XINPUT_TRANSLATED_AXIS_COUNT);
     144    }
     145    else
     146    {
     147                // Get joystick capabilities.
     148                mDIJoyCaps.dwSize = sizeof(DIDEVCAPS);
     149                if( FAILED(mJoyStick->GetCapabilities(&mDIJoyCaps)) )
     150                        OIS_EXCEPT( E_General, "Win32JoyStick::_enumerate >> Failed to get capabilities" );
     151
     152            mPOVs = (short)mDIJoyCaps.dwPOVs;
     153
     154            mState.mButtons.resize(mDIJoyCaps.dwButtons);
     155            mState.mAxes.resize(mDIJoyCaps.dwAxes);
     156
     157            //Reset the axis mapping enumeration value
     158            _AxisNumber = 0;
     159
     160            //Enumerate Force Feedback (if any)
     161            mJoyStick->EnumEffects(DIEnumEffectsCallback, this, DIEFT_ALL);
     162
     163            //Enumerate and set axis constraints (and check FF Axes)
     164            mJoyStick->EnumObjects(DIEnumDeviceObjectsCallback, this, DIDFT_AXIS);
     165    }
    145166}
    146167
     
    191212        if((lpddoi->dwFlags & DIDOI_FFACTUATOR) != 0 )
    192213        {
    193                 if( _this->ff_device )
     214                if( _this->mFfDevice )
    194215                {
    195                         _this->ff_device->_addFFAxis();
     216                        _this->mFfDevice->_addFFAxis();
    196217                }
    197218        }
     
    200221        //as DInput has no API to query the device for these capabilities
    201222        //(the only way to know is to try them ...)
    202         if( _this->ff_device )
    203         {
    204             _this->ff_device->_setGainSupport(true);
    205             _this->ff_device->_setAutoCenterSupport(true);
     223        if( _this->mFfDevice )
     224        {
     225            _this->mFfDevice->_setGainSupport(true);
     226            _this->mFfDevice->_setAutoCenterSupport(true);
    206227        }
    207228
     
    215236
    216237        //Create the FF instance only after we know there is at least one effect type
    217         if( _this->ff_device == 0 )
    218           _this->ff_device = new Win32ForceFeedback(_this->mJoyStick, &_this->mDIJoyCaps);
    219 
    220         _this->ff_device->_addEffectSupport( pdei );
     238        if( _this->mFfDevice == 0 )
     239                _this->mFfDevice = new Win32ForceFeedback(_this->mJoyStick, &_this->mDIJoyCaps);
     240
     241        _this->mFfDevice->_addEffectSupport(pdei);
    221242
    222243        return DIENUM_CONTINUE;
     
    226247void Win32JoyStick::capture()
    227248{
     249#ifdef OIS_WIN32_XINPUT_SUPPORT
     250        //handle xbox controller differently
     251    if (mJoyInfo.isXInput)
     252        {
     253                captureXInput();
     254                return;
     255        }
     256#endif
     257
     258        //handle directinput based devices
    228259        DIDEVICEOBJECTDATA diBuff[JOYSTICK_DX_BUFFERSIZE];
    229260        DWORD entries = JOYSTICK_DX_BUFFERSIZE;
     
    241272
    242273                // Poll the device to read the current state
    243             mJoyStick->Poll();
     274                mJoyStick->Poll();
    244275                hr = mJoyStick->GetDeviceData( sizeof(DIDEVICEOBJECTDATA), diBuff, &entries, 0 );
    245276                //Perhaps the user just tabbed away
     
    353384
    354385//--------------------------------------------------------------------------------------------------//
     386void Win32JoyStick::captureXInput()
     387{
     388#ifdef OIS_WIN32_XINPUT_SUPPORT
     389    XINPUT_STATE inputState;
     390        if (XInputGetState((DWORD)mJoyInfo.xInputDev, &inputState) != ERROR_SUCCESS)
     391        memset(&inputState, 0, sizeof(inputState));
     392
     393    //Sticks and triggers
     394        int value;
     395    bool axisMoved[XINPUT_TRANSLATED_AXIS_COUNT] = {false,false,false,false,false,false};
     396
     397        //LeftY
     398        value = -(int)inputState.Gamepad.sThumbLY;
     399        mState.mAxes[0].rel = value - mState.mAxes[0].abs;
     400        mState.mAxes[0].abs = value;
     401        if(mState.mAxes[0].rel != 0)
     402        axisMoved[0] = true;
     403
     404        //LeftX
     405    mState.mAxes[1].rel = inputState.Gamepad.sThumbLX - mState.mAxes[1].abs;
     406    mState.mAxes[1].abs = inputState.Gamepad.sThumbLX;
     407
     408        if(mState.mAxes[1].rel != 0)
     409        axisMoved[1] = true;
     410
     411        //RightY
     412        value = -(int)inputState.Gamepad.sThumbRY;           
     413    mState.mAxes[2].rel = value - mState.mAxes[2].abs;
     414    mState.mAxes[2].abs = value;
     415        if(mState.mAxes[2].rel != 0)
     416        axisMoved[2] = true;
     417
     418        //RightX
     419    mState.mAxes[3].rel = inputState.Gamepad.sThumbRX - mState.mAxes[3].abs;
     420    mState.mAxes[3].abs = inputState.Gamepad.sThumbRX;
     421        if(mState.mAxes[3].rel != 0)
     422                axisMoved[3] = true;
     423
     424        //Left trigger
     425    value = inputState.Gamepad.bLeftTrigger * 129;
     426        if(value > JoyStick::MAX_AXIS)
     427                value = JoyStick::MAX_AXIS;
     428
     429    mState.mAxes[4].rel = value - mState.mAxes[4].abs;
     430    mState.mAxes[4].abs = value;
     431        if(mState.mAxes[4].rel != 0)
     432                axisMoved[4] = true;
     433
     434        //Right trigger
     435    value = (int)inputState.Gamepad.bRightTrigger * 129;
     436        if(value > JoyStick::MAX_AXIS)
     437                value = JoyStick::MAX_AXIS;
     438
     439        mState.mAxes[5].rel = value - mState.mAxes[5].abs;
     440    mState.mAxes[5].abs = value;
     441        if(mState.mAxes[5].rel != 0)
     442                axisMoved[5] = true;
     443   
     444    //POV
     445    int previousPov = mState.mPOV[0].direction;       
     446    int& pov = mState.mPOV[0].direction;
     447    pov = Pov::Centered;       
     448    if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP)
     449        pov |= Pov::North;
     450    else if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN)
     451        pov |= Pov::South;
     452    if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)
     453        pov |= Pov::West;
     454    else if (inputState.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT)
     455        pov |= Pov::East;
     456   
     457    //Buttons - The first 4 buttons don't need to be checked since they represent the dpad
     458    bool previousButtons[XINPUT_TRANSLATED_BUTTON_COUNT];
     459    std::copy(mState.mButtons.begin(), mState.mButtons.end(), previousButtons);
     460    for (size_t i = 0; i < XINPUT_TRANSLATED_BUTTON_COUNT; i++)
     461        mState.mButtons[i] = (inputState.Gamepad.wButtons & (1 << (i + 4))) != 0;
     462
     463    //Send events
     464    if (mBuffered && mListener)
     465    {
     466            JoyStickEvent joystickEvent(this, mState);
     467
     468            //Axes
     469            for (int i = 0; i < XINPUT_TRANSLATED_AXIS_COUNT; i++)
     470        {
     471                    if (axisMoved[i] && !mListener->axisMoved(joystickEvent, i))
     472                            return;
     473        }
     474
     475        //POV
     476        if (previousPov != pov && !mListener->povMoved(joystickEvent, 0))
     477            return;
     478
     479        //Buttons
     480        for (int i = 0; i < XINPUT_TRANSLATED_BUTTON_COUNT; i++)
     481        {
     482            if (!previousButtons[i] && mState.mButtons[i])
     483            {
     484                if (!mListener->buttonPressed(joystickEvent, i))
     485                    return;
     486            }
     487            else if (previousButtons[i] && !mState.mButtons[i])
     488            {
     489                if (!mListener->buttonReleased(joystickEvent, i))
     490                    return;
     491            }
     492        }
     493    }
     494#endif
     495}
     496
     497//--------------------------------------------------------------------------------------------------//
    355498bool Win32JoyStick::_doButtonClick( int button, DIDEVICEOBJECTDATA& di )
    356499{
     
    410553Interface* Win32JoyStick::queryInterface(Interface::IType type)
    411554{
    412         //Thought about using covariant return type here.. however,
    413         //some devices may allow LED light changing, or other interface stuff
    414 
    415         if( ff_device && type == Interface::ForceFeedback )
    416                 return ff_device;
     555        if( mFfDevice && type == Interface::ForceFeedback )
     556                return mFfDevice;
    417557        else
    418558                return 0;
    419559}
     560
     561//--------------------------------------------------------------------------------------------------//
     562void Win32JoyStick::CheckXInputDevices(JoyStickInfoList &joys)
     563{
     564    IWbemLocator*           pIWbemLocator  = NULL;
     565    IEnumWbemClassObject*   pEnumDevices   = NULL;
     566    IWbemClassObject*       pDevices[20]   = {0};
     567    IWbemServices*          pIWbemServices = NULL;
     568    BSTR                    bstrNamespace  = NULL;
     569    BSTR                    bstrDeviceID   = NULL;
     570    BSTR                    bstrClassName  = NULL;
     571    DWORD                   uReturned      = 0;
     572    bool                    bIsXinputDevice= false;
     573        DWORD                   iDevice        = 0;
     574        int                     xDevice        = 0;
     575    VARIANT                 var;
     576    HRESULT                 hr;
     577
     578        if(joys.size() == 0)
     579                return;
     580
     581    // CoInit if needed
     582    hr = CoInitialize(NULL);
     583    bool bCleanupCOM = SUCCEEDED(hr);
     584
     585    // Create WMI
     586    hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*)&pIWbemLocator);
     587    if( FAILED(hr) || pIWbemLocator == NULL )
     588        goto LCleanup;
     589
     590    bstrNamespace = SysAllocString( L"\\\\.\\root\\cimv2" );
     591        if( bstrNamespace == NULL )
     592                goto LCleanup;
     593
     594    bstrClassName = SysAllocString( L"Win32_PNPEntity" );
     595        if( bstrClassName == NULL )
     596                goto LCleanup;
     597
     598    bstrDeviceID  = SysAllocString( L"DeviceID" );
     599        if( bstrDeviceID == NULL )
     600                goto LCleanup;
     601   
     602    // Connect to WMI
     603    hr = pIWbemLocator->ConnectServer( bstrNamespace, NULL, NULL, 0L, 0L, NULL, NULL, &pIWbemServices );
     604    if( FAILED(hr) || pIWbemServices == NULL )
     605        goto LCleanup;
     606
     607    // Switch security level to IMPERSONATE.
     608    CoSetProxyBlanket(pIWbemServices, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, NULL, RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE );                   
     609
     610    hr = pIWbemServices->CreateInstanceEnum( bstrClassName, 0, NULL, &pEnumDevices );
     611    if( FAILED(hr) || pEnumDevices == NULL )
     612        goto LCleanup;
     613
     614    // Loop over all devices
     615    for( ;; )
     616    {
     617        // Get 20 at a time
     618        hr = pEnumDevices->Next(5000, 20, pDevices, &uReturned);
     619        if( FAILED(hr) )
     620            goto LCleanup;
     621
     622        if( uReturned == 0 )
     623            break;
     624
     625        for(iDevice = 0; iDevice < uReturned; iDevice++)
     626        {
     627            // For each device, get its device ID
     628            hr = pDevices[iDevice]->Get(bstrDeviceID, 0L, &var, NULL, NULL);
     629            if(SUCCEEDED(hr) && var.vt == VT_BSTR && var.bstrVal != NULL)
     630            {
     631                // Check if the device ID contains "IG_".  If it does, then it's an XInput device - This information can not be found from DirectInput
     632                if(wcsstr(var.bstrVal, L"IG_"))
     633                {
     634                    // If it does, then get the VID/PID from var.bstrVal
     635                    DWORD dwPid = 0, dwVid = 0;
     636                    WCHAR* strVid = wcsstr( var.bstrVal, L"VID_" );
     637                    if(strVid && swscanf_s( strVid, L"VID_%4X", &dwVid ) != 1)
     638                                                dwVid = 0;
     639
     640                    WCHAR* strPid = wcsstr( var.bstrVal, L"PID_" );
     641                    if(strPid && swscanf_s( strPid, L"PID_%4X", &dwPid ) != 1)
     642                        dwPid = 0;
     643
     644                    // Compare the VID/PID to the DInput device
     645                    DWORD dwVidPid = MAKELONG(dwVid, dwPid);
     646                                        for(JoyStickInfoList::iterator i = joys.begin(); i != joys.end(); ++i)
     647                                        {
     648                                                if(dwVidPid == i->productGuid.Data1)
     649                                                {
     650                                                        i->isXInput = true;
     651                                                        i->xInputDev = xDevice;
     652                                                }
     653                                        }
     654
     655                                        if(joys.size() == 0)
     656                                                goto LCleanup;
     657                }
     658            }
     659
     660            SAFE_RELEASE(pDevices[iDevice]);
     661        }
     662    }
     663
     664LCleanup:
     665    if(bstrNamespace)
     666        SysFreeString(bstrNamespace);
     667
     668    if(bstrDeviceID)
     669        SysFreeString(bstrDeviceID);
     670
     671    if(bstrClassName)
     672        SysFreeString(bstrClassName);
     673
     674    for(iDevice=0; iDevice < 20; iDevice++)
     675        SAFE_RELEASE(pDevices[iDevice]);
     676
     677    SAFE_RELEASE(pEnumDevices);
     678    SAFE_RELEASE(pIWbemLocator);
     679    SAFE_RELEASE(pIWbemServices);
     680
     681    if(bCleanupCOM)
     682        CoUninitialize();
     683}
  • code/branches/kicklib/src/external/ois/win32/Win32JoyStick.h

    r5781 r8071  
    2525
    2626#include "OISJoyStick.h"
    27 #include "Win32/Win32Prereqs.h"
     27#include "win32/Win32Prereqs.h"
    2828
    2929namespace OIS
     
    4141                virtual void capture();
    4242
     43                //! hanlde xinput
     44                void captureXInput();
     45
    4346                /** @copydoc Object::queryInterface */
    4447                virtual Interface* queryInterface(Interface::IType type);
     
    4649                /** @copydoc Object::_initialize */
    4750                virtual void _initialize();
     51
     52                /**
     53                @remarks
     54                        Enum each PNP device using WMI and check each device ID to see if it contains
     55                        "IG_" (ex. "VID_045E&PID_028E&IG_00").  If it does, then it's an XInput device
     56                        Unfortunately this information can not be found by just using DirectInput
     57                */
     58                static void CheckXInputDevices(JoyStickInfoList &joys);
    4859
    4960        protected:
     
    6172                IDirectInputDevice8* mJoyStick;
    6273                DIDEVCAPS mDIJoyCaps;
     74                DWORD coopSetting;
    6375
    64                 DWORD coopSetting;
    65                 GUID deviceGuid;
     76        JoyStickInfo mJoyInfo;
    6677
    6778                //! A force feedback device
    68                 Win32ForceFeedback* ff_device;
     79                Win32ForceFeedback* mFfDevice;
    6980
    7081                //! Mapping
  • code/branches/kicklib/src/external/ois/win32/Win32KeyBoard.cpp

    r5781 r8071  
    2121    3. This notice may not be removed or altered from any source distribution.
    2222*/
    23 #include "Win32/Win32InputManager.h"
    24 #include "Win32/Win32KeyBoard.h"
     23#include "win32/Win32InputManager.h"
     24#include "win32/Win32KeyBoard.h"
    2525#include "OISException.h"
    2626#include "OISEvents.h"
     
    287287
    288288//--------------------------------------------------------------------------------------------------//
    289 const std::string& Win32Keyboard::getAsString( KeyCode kc )
     289const std::string& Win32Keyboard::getAsString(KeyCode kc)
    290290{
    291291        char temp[256];
     
    297297        prop.diph.dwHow = DIPH_BYOFFSET;
    298298
    299         if ( SUCCEEDED( mKeyboard->GetProperty( DIPROP_KEYNAME, &prop.diph ) ) )
     299        if (SUCCEEDED(mKeyboard->GetProperty(DIPROP_KEYNAME, &prop.diph)))
    300300        {
    301301                // convert the WCHAR in "wsz" to multibyte
    302                 if ( WideCharToMultiByte( CP_ACP, 0, prop.wsz, -1, temp, sizeof(temp), NULL, NULL) )
    303                         return mGetString.assign( temp );
     302                if (WideCharToMultiByte(CP_ACP, 0, prop.wsz, -1, temp, sizeof(temp), NULL, NULL))
     303                        return mGetString.assign(temp);
    304304        }
    305305
    306306        std::stringstream ss;
    307307        ss << "Key_" << (int)kc;
    308         return mGetString.assign( ss.str() );
     308        return mGetString.assign(ss.str());
    309309}
    310310
  • code/branches/kicklib/src/external/ois/win32/Win32KeyBoard.h

    r5781 r8071  
    2525
    2626#include "OISKeyboard.h"
    27 #include "Win32/Win32Prereqs.h"
     27#include "win32/Win32Prereqs.h"
    2828
    2929namespace OIS
     
    4242                        A combination of DI Flags (see DX Help for info on input device settings)
    4343                */
    44                 Win32Keyboard( InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings );
     44                Win32Keyboard(InputManager* creator, IDirectInput8* pDI, bool buffered, DWORD coopSettings);
    4545                virtual ~Win32Keyboard();
    4646
    4747                /** @copydoc Keyboard::isKeyDown */
    48                 virtual bool isKeyDown( KeyCode key ) const;
     48                virtual bool isKeyDown(KeyCode key) const;
    4949               
    5050                /** @copydoc Keyboard::getAsString */
    51                 virtual const std::string& getAsString( KeyCode kc );
     51                virtual const std::string& getAsString(KeyCode kc);
    5252
    5353                /** @copydoc Keyboard::copyKeyStates */
    54                 virtual void copyKeyStates( char keys[256] ) const;
     54                virtual void copyKeyStates(char keys[256]) const;
    5555
    5656                /** @copydoc Object::setBuffered */
  • code/branches/kicklib/src/external/ois/win32/Win32Mouse.cpp

    r5781 r8071  
    2121    3. This notice may not be removed or altered from any source distribution.
    2222*/
    23 #include "Win32/Win32Mouse.h"
    24 #include "Win32/Win32InputManager.h"
     23#include "win32/Win32Mouse.h"
     24#include "win32/Win32InputManager.h"
    2525#include "OISException.h"
    2626#include "OISEvents.h"
  • code/branches/kicklib/src/external/ois/win32/Win32Mouse.h

    r5781 r8071  
    2525
    2626#include "OISMouse.h"
    27 #include "Win32/Win32Prereqs.h"
     27#include "win32/Win32Prereqs.h"
    2828
    2929namespace OIS
  • code/branches/kicklib/src/external/ois/win32/Win32Prereqs.h

    r5781 r8071  
    2929#include <dinput.h>
    3030
     31#ifdef OIS_WIN32_XINPUT_SUPPORT
     32#       include <XInput.h>
     33#endif
     34
    3135//Max number of elements to collect from buffered DirectInput
    3236#define KEYBOARD_DX_BUFFERSIZE 17
    33 #define MOUSE_DX_BUFFERSIZE 64
    34 #define JOYSTICK_DX_BUFFERSIZE 124
     37#define MOUSE_DX_BUFFERSIZE 128
     38#define JOYSTICK_DX_BUFFERSIZE 129
    3539
    3640//MinGW defines
     
    5559                int devId;
    5660                GUID deviceID;
     61                GUID productGuid;
    5762                std::string vendor;
     63        bool isXInput;
     64                int xInputDev;
    5865        };
    5966
    60         typedef std::vector< JoyStickInfo > JoyStickInfoList;
     67        typedef std::vector<JoyStickInfo> JoyStickInfoList;
    6168}
    6269
  • code/branches/kicklib/src/libraries/core/Core.cc

    r7872 r8071  
    8181
    8282    SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");
     83#ifndef ORXONOX_PLATFORM_APPLE
    8384    SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)");
     85#endif
    8486
    8587#ifdef ORXONOX_PLATFORM_WINDOWS
     
    156158        this->setConfigValues();
    157159
    158         // create persistent io console
     160#ifndef ORXONOX_PLATFORM_APPLE
     161        // Create persistent IO console
    159162        if (CommandLineParser::getValue("noIOConsole").getBool())
    160163        {
     
    163166        if (this->bStartIOConsole_)
    164167            this->ioConsole_.reset(new IOConsole());
     168#endif
    165169
    166170        // creates the class hierarchy for all classes with factories
  • code/branches/kicklib/src/libraries/core/CorePrereqs.h

    r8066 r8071  
    5454#    endif
    5555#  endif
    56 #elif defined ( ORXONOX_GCC_VISIBILITY )
     56#  define _CorePrivate
     57#elif defined (ORXONOX_GCC_VISIBILITY)
    5758#  define _CoreExport  __attribute__ ((visibility("default")))
     59#  define _CorePrivate __attribute__ ((visibility("hidden")))
    5860#else
    5961#  define _CoreExport
     62#  define _CorePrivate
    6063#endif
    6164
  • code/branches/kicklib/src/libraries/core/DynLib.cc

    r6417 r8071  
    4242#endif
    4343
    44 #ifdef ORXONOX_PLATFORM_LINUX
     44#ifdef ORXONOX_PLATFORM_UNIX
    4545#  include <dlfcn.h>
    4646#endif
    4747
    4848#ifdef ORXONOX_PLATFORM_APPLE
    49 include <macPlugins.h>
     49 include <OSX/macUtils.h> // OGRE include
    5050#endif
    5151
     
    7575        if (name.substr(name.length() - 3, 3) != ".so")
    7676           name += ".so";
     77#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
     78        // dlopen() does not add .dylib to the filename, like windows does for .dll
     79        if (name.substr(name.length() - 6, 6) != ".dylib")
     80            name += ".dylib";
     81#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32
     82        // Although LoadLibraryEx will add .dll itself when you only specify the library name,
     83        // if you include a relative path then it does not. So, add it to be sure.
     84        if (name.substr(name.length() - 4, 4) != ".dll")
     85            name += ".dll";
    7786#endif
    7887
     
    127136        LocalFree( lpMsgBuf );
    128137        return ret;
    129 #elif defined(ORXONOX_PLATFORM_LINUX)
     138#elif defined(ORXONOX_PLATFORM_UNIX)
    130139        return std::string(dlerror());
    131 #elif defined(ORXONOX_PLATFORM_APPLE)
    132         return std::string(mac_errorBundle());
    133140#else
    134141        return "";
    135142#endif
    136143    }
    137 
    138144}
  • code/branches/kicklib/src/libraries/core/DynLib.h

    r7401 r8071  
    5252typedef struct HINSTANCE__* hInstance;
    5353
    54 #elif defined(ORXONOX_PLATFORM_LINUX)
     54#elif defined(ORXONOX_PLATFORM_UNIX)
    5555#    define DYNLIB_HANDLE void*
    5656#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
    5757#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
    5858#    define DYNLIB_UNLOAD( a ) dlclose( a )
    59 
    60 #elif defined(ORXONOX_PLATFORM_APPLE)
    61 #    define DYNLIB_HANDLE CFBundleRef
    62 #    define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
    63 #    define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
    64 #    define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
    6559#endif
    6660
     
    116110
    117111    protected:
    118 
    119112        /// Handle to the loaded library.
    120113        DYNLIB_HANDLE m_hInst;
  • code/branches/kicklib/src/libraries/core/GUIManager.cc

    r8067 r8071  
    436436    void GUIManager::buttonPressed(MouseButtonCode::ByEnum id)
    437437    {
     438        //guiSystem_->injectMouseButtonDown(convertButton(id));
    438439        this->protectedCall(boost::bind(&CEGUI::System::injectMouseButtonDown, _1, convertButton(id)));
    439440    }
  • code/branches/kicklib/src/libraries/core/GraphicsManager.cc

    r8066 r8071  
    269269
    270270        Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, ogreWindowEventListener_.get());
    271 
     271               
     272// HACK
     273#ifdef ORXONOX_PLATFORM_APPLE
     274        //INFO: This will give our window focus, and not lock it to the terminal
     275        ProcessSerialNumber psn = {0, kCurrentProcess};
     276        TransformProcessType(&psn, kProcessTransformToForegroundApplication);
     277        SetFrontProcess(&psn);
     278#endif
     279// End of HACK
     280               
    272281        // create a full screen default viewport
    273282        // Note: This may throw when adding a viewport with an existing z-order!
  • code/branches/kicklib/src/libraries/core/Identifier.h

    r7401 r8071  
    123123
    124124            /// Returns the unique ID of the class.
    125             FORCEINLINE unsigned int getClassID() const { return this->classID_; }
     125            ORX_FORCEINLINE unsigned int getClassID() const { return this->classID_; }
    126126
    127127            /// Returns the list of all existing objects of this class.
     
    486486    */
    487487    template <class T, class U>
    488     FORCEINLINE T orxonox_cast(U* source)
     488    ORX_FORCEINLINE T orxonox_cast(U* source)
    489489    {
    490490#ifdef ORXONOX_COMPILER_MSVC
  • code/branches/kicklib/src/libraries/core/OrxonoxClass.h

    r7938 r8071  
    135135                Returns NULL if the no pointer was found.
    136136            */
    137             FORCEINLINE void* getDerivedPointer(unsigned int classID)
     137            ORX_FORCEINLINE void* getDerivedPointer(unsigned int classID)
    138138            {
    139139                for (int i = this->objectPointers_.size() - 1; i >= 0; --i)
     
    146146
    147147            /// Version of getDerivedPointer with template
    148             template <class T> FORCEINLINE T* getDerivedPointer(unsigned int classID)
     148            template <class T> ORX_FORCEINLINE T* getDerivedPointer(unsigned int classID)
    149149            {   return static_cast<T*>(this->getDerivedPointer(classID));   }
    150150            /// Const version of getDerivedPointer with template
    151             template <class T> FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
     151            template <class T> ORX_FORCEINLINE const T* getDerivedPointer(unsigned int classID) const
    152152            {   return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID);   }
    153153
  • code/branches/kicklib/src/libraries/core/PathConfig.cc

    r8066 r8071  
    9797#elif defined(ORXONOX_PLATFORM_APPLE)
    9898        char buffer[1024];
    99         unsigned long path_len = 1023;
     99        uint32_t path_len = 1023;
    100100        if (_NSGetExecutablePath(buffer, &path_len))
    101101            ThrowException(General, "Could not retrieve executable path.");
     
    127127#endif
    128128
    129         executablePath_ = bf::path(buffer);
    130 #ifndef ORXONOX_PLATFORM_APPLE
    131         executablePath_ = executablePath_.branch_path(); // remove executable name
    132 #endif
     129        // Remove executable filename
     130        executablePath_ = bf::path(buffer).branch_path();
    133131
    134132        /////////////////////
     
    208206
    209207            // Get user directory
    210 #  ifdef ORXONOX_PLATFORM_UNIX /* Apple? */
     208#ifdef ORXONOX_PLATFORM_UNIX
    211209            char* userDataPathPtr(getenv("HOME"));
    212 #  else
     210#elif ORXONOX_PLATFORM_APPLE
     211            char* userDataPathPtr(getenv("HOME"));
     212#else
    213213            char* userDataPathPtr(getenv("APPDATA"));
    214 #  endif
     214#endif
    215215            if (userDataPathPtr == NULL)
    216216                ThrowException(General, "Could not retrieve user data path.");
  • code/branches/kicklib/src/libraries/core/Super.h

    r7401 r8071  
    9494        struct SuperFunctionCondition<functionnumber, T, 0, templatehack2> \
    9595        { \
    96             static void check() \
     96            static void superCheck() \
    9797            { \
    9898                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0)); \
    99                 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check(); \
     99                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
    100100            } \
    101101            \
     
    132132        struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
    133133        { \
    134             static void check() \
    135             { \
    136                 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::check(); \
     134            static void superCheck() \
     135            { \
     136                SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
    137137            } \
    138138        };
     
    150150        struct SuperFunctionCondition<functionnumber, T, 0, templatehack2>
    151151        {
    152             static void check()
     152            static void superCheck()
    153153            {
    154154                // This call to the apply-function is the whole check. By calling the function with
     
    156156                SuperFunctionCondition<functionnumber, T, 0, templatehack2>::apply(static_cast<T*>(0));
    157157
    158                 // Go go the check for of next super-function (functionnumber + 1)
    159                 SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::check();
     158                // Go go the superCheck for of next super-function (functionnumber + 1)
     159                SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck();
    160160            }
    161161
     
    202202        struct SuperFunctionCondition<functionnumber, baseclass, 0, templatehack2> \
    203203        { \
    204             // The check function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
    205             static void check() \
    206             { \
    207                 SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::check(); \
     204            // The superCheck function acts like the fallback - it advances to the check for the next super-function (functionnumber + 1)
     205            static void superCheck() \
     206            { \
     207                SuperFunctionCondition<functionnumber + 1, baseclass, 0, templatehack2>::superCheck(); \
    208208            } \
    209209        };
     
    303303        struct SuperFunctionCondition
    304304        {
    305             static void check() {}
     305            static void superCheck() {}
    306306        };
    307307
     
    338338            struct SuperFunctionCondition<functionnumber, T, templatehack1, templatehack2> \
    339339            { \
    340                 static void check() \
     340                static void superCheck() \
    341341                { \
    342                     SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::check(); \
     342                    SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck(); \
    343343                } \
    344344            }; \
     
    421421            // If this function gets called, the header-file of the super function is not
    422422            // included, so this fallback template (templatehack not specialized) is used
    423             static void check()
     423            static void superCheck()
    424424            {
    425425                // Calls the condition-check of the next super-function (functionnumber + 1)
    426                 SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::check();
     426                SuperFunctionCondition<functionnumber + 1, T, templatehack1, templatehack2>::superCheck();
    427427            }
    428428        };
     
    574574        virtual void createSuperFunctionCaller() const
    575575        {
    576             SuperFunctionCondition<0, T, 0, 0>::check();
     576            SuperFunctionCondition<0, T, 0, 0>::superCheck();
    577577        }
    578578
  • code/branches/kicklib/src/libraries/core/command/Functor.h

    r7871 r8071  
    244244            FunctorMember(O* object = 0) : object_(object), bSafeMode_(false) {}
    245245            virtual ~FunctorMember() { if (this->bSafeMode_) { this->unregisterObject(this->object_); } }
     246            virtual ~FunctorMember() {}
    246247
    247248            /// Calls the function-pointer with up to five arguments and an object. In case of a static-function, the object can be NULL. @return Returns the return-value of the function (if any; MT_Type::Null otherwise)
  • code/branches/kicklib/src/libraries/core/input/InputDevice.h

    r7271 r8071  
    184184    protected:
    185185        //! Common code for all button pressed events (updates pressed buttons list and calls the input states)
    186         FORCEINLINE void buttonPressed(ButtonTypeParam button)
     186        ORX_FORCEINLINE void buttonPressed(ButtonTypeParam button)
    187187        {
    188188            // check whether the button already is in the list (can happen when focus was lost)
     
    201201
    202202        //! Common code for all button released events (updates pressed buttons list and calls the input states)
    203         FORCEINLINE void buttonReleased(ButtonTypeParam button)
     203        ORX_FORCEINLINE void buttonReleased(ButtonTypeParam button)
    204204        {
    205205            // remove the button from the pressedButtons_ list
  • code/branches/kicklib/src/libraries/core/input/InputState.h

    r7401 r8071  
    176176    };
    177177
    178     FORCEINLINE void InputState::update(float dt)
     178    ORX_FORCEINLINE void InputState::update(float dt)
    179179    {
    180180        for (unsigned int i = 0; i < handlers_.size(); ++i)
     
    183183    }
    184184
    185     FORCEINLINE void InputState::update(float dt, unsigned int device)
     185    ORX_FORCEINLINE void InputState::update(float dt, unsigned int device)
    186186    {
    187187        switch (device)
     
    205205
    206206    template <typename EventType, class ButtonTypeParam>
    207     FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button)
     207    ORX_FORCEINLINE void InputState::buttonEvent(unsigned int device, ButtonTypeParam button)
    208208    {
    209209        assert(device < handlers_.size());
     
    216216    }
    217217
    218     FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
     218    ORX_FORCEINLINE void InputState::mouseMoved(IntVector2 abs, IntVector2 rel, IntVector2 clippingSize)
    219219    {
    220220        if (handlers_[mouseIndex_s] != NULL)
     
    222222    }
    223223
    224     FORCEINLINE void InputState::mouseScrolled(int abs, int rel)
     224    ORX_FORCEINLINE void InputState::mouseScrolled(int abs, int rel)
    225225    {
    226226        if (handlers_[mouseIndex_s] != NULL)
     
    228228    }
    229229
    230     FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)
     230    ORX_FORCEINLINE void InputState::joyStickAxisMoved(unsigned int device, unsigned int axis, float value)
    231231    {
    232232        assert(device < handlers_.size());
  • code/branches/kicklib/src/libraries/network/LANDiscoverable.cc

    r7801 r8071  
    2929#include "LANDiscoverable.h"
    3030
    31 #include "NetworkPrereqs.h"
    32 #include "packet/ServerInformation.h"
    33 
    3431#include <enet/enet.h>
    3532#include <cassert>
    3633#include <cstring>
     34
     35#include "util/Debug.h"
     36#include "packet/ServerInformation.h"
    3737
    3838namespace orxonox
  • code/branches/kicklib/src/libraries/network/NetworkPrereqs.h

    r7801 r8071  
    5252#    endif
    5353#  endif
    54 #elif defined ( ORXONOX_GCC_VISIBILITY )
     54#  define _NetworkPrivate
     55#elif defined (ORXONOX_GCC_VISIBILITY)
    5556#  define _NetworkExport  __attribute__ ((visibility("default")))
     57#  define _NetworkPrivate __attribute__ ((visibility("hidden")))
    5658#else
    5759#  define _NetworkExport
     60#  define _NetworkPrivate
    5861#endif
    5962
  • code/branches/kicklib/src/libraries/tools/BulletConversions.h

    r5781 r8071  
    4343    struct ConverterExplicit<orxonox::Vector3, btVector3>
    4444    {
    45         FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input)
     45        ORX_FORCEINLINE static bool convert(btVector3* output, const orxonox::Vector3& input)
    4646        {
    4747            output->setX(input.x);
     
    5656    struct ConverterExplicit<btVector3, orxonox::Vector3>
    5757    {
    58         FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input)
     58        ORX_FORCEINLINE static bool convert(orxonox::Vector3* output, const btVector3& input)
    5959        {
    6060            output->x = input.x();
     
    6969    struct ConverterExplicit<orxonox::Quaternion, btQuaternion>
    7070    {
    71         FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input)
     71        ORX_FORCEINLINE static bool convert(btQuaternion* output, const orxonox::Quaternion& input)
    7272        {
    7373            output->setW(input.w);
     
    8383    struct ConverterExplicit<btQuaternion, orxonox::Quaternion>
    8484    {
    85         FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input)
     85        ORX_FORCEINLINE static bool convert(orxonox::Quaternion* output, const btQuaternion& input)
    8686        {
    8787            output->w = input.w();
  • code/branches/kicklib/src/libraries/tools/ToolsPrereqs.h

    r7163 r8071  
    5252#    endif
    5353#  endif
    54 #elif defined ( ORXONOX_GCC_VISIBILITY )
     54#  define _ToolsPrivate
     55#elif defined (ORXONOX_GCC_VISIBILITY)
    5556#  define _ToolsExport  __attribute__ ((visibility("default")))
     57#  define _ToolsPrivate __attribute__ ((visibility("hidden")))
    5658#else
    5759#  define _ToolsExport
     60#  define _ToolsPrivate
    5861#endif
    5962
  • code/branches/kicklib/src/libraries/util/Convert.h

    r7401 r8071  
    143143    struct ConverterFallback
    144144    {
    145         FORCEINLINE static bool convert(ToType* output, const FromType& input)
     145        ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input)
    146146        {
    147147            COUT(2) << "Could not convert value of type " << typeid(FromType).name()
     
    155155    struct ConverterFallback<FromType*, ToType*>
    156156    {
    157         FORCEINLINE static bool convert(ToType** output, FromType* const input)
     157        ORX_FORCEINLINE static bool convert(ToType** output, FromType* const input)
    158158        {
    159159            ToType* temp = dynamic_cast<ToType*>(input);
     
    182182struct ConverterStringStream
    183183{
    184     FORCEINLINE static bool convert(ToType* output, const FromType& input)
     184    ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input)
    185185    {
    186186        return orxonox::ConverterFallback<FromType, ToType>::convert(output, input);
     
    198198    /// Fallback operator <<() (delegates to orxonox::ConverterFallback)
    199199    template <class FromType>
    200     FORCEINLINE bool operator <<(std::ostream& outstream,  const FromType& input)
     200    ORX_FORCEINLINE bool operator <<(std::ostream& outstream,  const FromType& input)
    201201    {
    202202        std::string temp;
     
    215215struct ConverterStringStream<FromType, std::string>
    216216{
    217     FORCEINLINE static bool convert(std::string* output, const FromType& input)
     217    ORX_FORCEINLINE static bool convert(std::string* output, const FromType& input)
    218218    {
    219219        using namespace fallbackTemplates;
     
    241241    /// Fallback operator >>() (delegates to orxonox::ConverterFallback)
    242242    template <class ToType>
    243     FORCEINLINE bool operator >>(std::istream& instream, ToType& output)
     243    ORX_FORCEINLINE bool operator >>(std::istream& instream, ToType& output)
    244244    {
    245245        std::string input(static_cast<std::istringstream&>(instream).str());
     
    252252struct ConverterStringStream<std::string, ToType>
    253253{
    254     FORCEINLINE static bool convert(ToType* output, const std::string& input)
     254    ORX_FORCEINLINE static bool convert(ToType* output, const std::string& input)
    255255    {
    256256        using namespace fallbackTemplates;
     
    276276    /// %Template delegates to ::ConverterStringStream
    277277    template <class FromType, class ToType>
    278     FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>)
     278    ORX_FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<false>)
    279279    {
    280280        return ConverterStringStream<FromType, ToType>::convert(output, input);
     
    283283    /// Makes an implicit cast from \a FromType to \a ToType
    284284    template <class FromType, class ToType>
    285     FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>)
     285    ORX_FORCEINLINE bool convertImplicitely(ToType* output, const FromType& input, Loki::Int2Type<true>)
    286286    {
    287287        (*output) = static_cast<ToType>(input);
     
    303303    {
    304304        enum { probe = ImplicitConversion<FromType, ToType>::exists };
    305         FORCEINLINE static bool convert(ToType* output, const FromType& input)
     305        ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input)
    306306        {
    307307            // Use the probe's value to delegate to the right function
     
    327327    */
    328328    template <class FromType, class ToType>
    329     FORCEINLINE bool convertValue(ToType* output, const FromType& input)
     329    ORX_FORCEINLINE bool convertValue(ToType* output, const FromType& input)
    330330    {
    331331        return ConverterExplicit<FromType, ToType>::convert(output, input);
     
    348348    */
    349349    template<class FromType, class ToType>
    350     FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
     350    ORX_FORCEINLINE bool convertValue(ToType* output, const FromType& input, const ToType& fallback)
    351351    {
    352352        if (convertValue(output, input))
     
    361361    /// Directly returns the converted value, but uses the fallback on failure. @see convertValue
    362362    template<class FromType, class ToType>
    363     FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
     363    ORX_FORCEINLINE ToType getConvertedValue(const FromType& input, const ToType& fallback)
    364364    {
    365365        ToType output;
     
    380380    */
    381381    template<class ToType, class FromType>
    382     FORCEINLINE ToType multi_cast(const FromType& input)
     382    ORX_FORCEINLINE ToType multi_cast(const FromType& input)
    383383    {
    384384        ToType output;
     
    395395    struct ConverterExplicit<const char*, ToType>
    396396    {
    397         FORCEINLINE static bool convert(ToType* output, const char* input)
     397        ORX_FORCEINLINE static bool convert(ToType* output, const char* input)
    398398        {
    399399            return convertValue<std::string, ToType>(output, input);
     
    405405    struct ConverterExplicit<char, std::string>
    406406    {
    407         FORCEINLINE static bool convert(std::string* output, const char input)
     407        ORX_FORCEINLINE static bool convert(std::string* output, const char input)
    408408        {
    409409            *output = input;
     
    415415    struct ConverterExplicit<unsigned char, std::string>
    416416    {
    417         FORCEINLINE static bool convert(std::string* output, const unsigned char input)
     417        ORX_FORCEINLINE static bool convert(std::string* output, const unsigned char input)
    418418        {
    419419            *output = input;
     
    425425    struct ConverterExplicit<std::string, char>
    426426    {
    427         FORCEINLINE static bool convert(char* output, const std::string& input)
     427        ORX_FORCEINLINE static bool convert(char* output, const std::string& input)
    428428        {
    429429            if (!input.empty())
     
    438438    struct ConverterExplicit<std::string, unsigned char>
    439439    {
    440         FORCEINLINE static bool convert(unsigned char* output, const std::string& input)
     440        ORX_FORCEINLINE static bool convert(unsigned char* output, const std::string& input)
    441441        {
    442442            if (!input.empty())
     
    453453    struct ConverterExplicit<bool, std::string>
    454454    {
    455         FORCEINLINE static bool convert(std::string* output, const bool& input)
     455        ORX_FORCEINLINE static bool convert(std::string* output, const bool& input)
    456456        {
    457457            if (input)
  • code/branches/kicklib/src/libraries/util/MathConvert.h

    r7401 r8071  
    5151    struct ConverterExplicit<orxonox::Vector2, std::string>
    5252    {
    53         FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
     53        ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector2& input)
    5454        {
    5555            std::ostringstream ostream;
     
    6767    struct ConverterExplicit<orxonox::Vector3, std::string>
    6868    {
    69         FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
     69        ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector3& input)
    7070        {
    7171            std::ostringstream ostream;
     
    8383    struct ConverterExplicit<orxonox::Vector4, std::string>
    8484    {
    85         FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
     85        ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Vector4& input)
    8686        {
    8787            std::ostringstream ostream;
     
    9999    struct ConverterExplicit<orxonox::Quaternion, std::string>
    100100    {
    101         FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
     101        ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::Quaternion& input)
    102102        {
    103103            std::ostringstream ostream;
     
    115115    struct ConverterExplicit<orxonox::ColourValue, std::string>
    116116    {
    117         FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
     117        ORX_FORCEINLINE static bool convert(std::string* output, const orxonox::ColourValue& input)
    118118        {
    119119            std::ostringstream ostream;
     
    157157    struct ConverterFallback<orxonox::Radian, ToType>
    158158    {
    159         FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)
     159        ORX_FORCEINLINE static bool convert(ToType* output, const orxonox::Radian& input)
    160160        {
    161161            return convertValue<Ogre::Real, ToType>(output, input.valueRadians());
     
    167167    struct ConverterFallback<orxonox::Degree, ToType>
    168168    {
    169         FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)
     169        ORX_FORCEINLINE static bool convert(ToType* output, const orxonox::Degree& input)
    170170        {
    171171            return convertValue<Ogre::Real, ToType>(output, input.valueDegrees());
     
    177177    struct ConverterFallback<FromType, orxonox::Radian>
    178178    {
    179         FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)
     179        ORX_FORCEINLINE static bool convert(orxonox::Radian* output, const FromType& input)
    180180        {
    181181            float temp;
     
    194194    struct ConverterFallback<FromType, orxonox::Degree>
    195195    {
    196         FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)
     196        ORX_FORCEINLINE static bool convert(orxonox::Degree* output, const FromType& input)
    197197        {
    198198            float temp;
  • code/branches/kicklib/src/libraries/util/SharedPtr.h

    r7401 r8071  
    163163            public:
    164164                SharedCounter() : count_(1) {}
     165                virtual ~SharedCounter() {}
    165166                virtual void destroy() = 0;
    166167
     
    186187        _UtilExport SmallObjectAllocator& createSharedCounterPool();
    187188
    188         FORCEINLINE SmallObjectAllocator& getSharedCounterPool()
     189        ORX_FORCEINLINE SmallObjectAllocator& getSharedCounterPool()
    189190        {
    190191            static SmallObjectAllocator& instance = createSharedCounterPool();
  • code/branches/kicklib/src/libraries/util/SignalHandler.h

    r7457 r8071  
    7070
    7171    /// The SignalHandler is used to catch signals like SIGSEGV and write a backtrace to the logfile.
    72     class SignalHandler : public Singleton<SignalHandler>
     72    class _UtilExport SignalHandler : public Singleton<SignalHandler>
    7373    {
    7474        friend class Singleton<SignalHandler>;
  • code/branches/kicklib/src/libraries/util/UtilPrereqs.h

    r6417 r8071  
    5252#    endif
    5353#  endif
    54 #elif defined ( ORXONOX_GCC_VISIBILITY )
     54#  define _UtilPrivate
     55#elif defined (ORXONOX_GCC_VISIBILITY)
    5556#  define _UtilExport  __attribute__ ((visibility("default")))
     57#  define _UtilPrivate __attribute__ ((visibility("hidden")))
    5658#else
    5759#  define _UtilExport
     60#  define _UtilPrivate
    5861#endif
    5962
  • code/branches/kicklib/src/modules/designtools/DesignToolsPrereqs.h

    r7163 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _DesignToolsPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _DesignToolsExport  __attribute__ ((visibility("default")))
     58#  define _DesignToolsPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _DesignToolsExport
     61#  define _DesignToolsPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/notifications/NotificationsPrereqs.h

    r7403 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _NotificationsPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _NotificationsExport  __attribute__ ((visibility("default")))
     58#  define _NotificationsPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _NotificationsExport
     61#  define _NotificationsPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/objects/ObjectsPrereqs.h

    r7601 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _ObjectsPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _ObjectsExport  __attribute__ ((visibility("default")))
     58#  define _ObjectsPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _ObjectsExport
     61#  define _ObjectsPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/overlays/OverlaysPrereqs.h

    r7935 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _OverlaysPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _OverlaysExport  __attribute__ ((visibility("default")))
     58#  define _OverlaysPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _OverlaysExport
     61#  define _OverlaysPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/pickup/PickupPrereqs.h

    r7163 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _PickupPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _PickupExport  __attribute__ ((visibility("default")))
     58#  define _PickupPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _PickupExport
     61#  define _PickupPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/pong/PongPrereqs.h

    r7163 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _PongPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _PongExport  __attribute__ ((visibility("default")))
     58#  define _PongPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _PongExport
     61#  define _PongPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/questsystem/QuestEffect.cc

    r7456 r8071  
    6868    /*static*/ bool QuestEffect::invokeEffects(PlayerInfo* player, std::list<QuestEffect*> & effects)
    6969    {
    70         bool check = true;
     70        bool temp = true;
    7171
    7272        COUT(4) << "Invoking QuestEffects on player: " << player << " ."  << std::endl;
    7373
    7474        for (std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
    75             check = check && (*effect)->invoke(player);
     75            temp = temp && (*effect)->invoke(player);
    7676
    77         return check;
     77        return temp;
    7878    }
    7979
  • code/branches/kicklib/src/modules/questsystem/QuestEffectBeacon.cc

    r7552 r8071  
    143143        COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
    144144
    145         bool check = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
    146         if(check)
     145        bool temp = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
     146        if(temp)
    147147        {
    148148            this->decrementTimes(); // Decrement the number of times the beacon can be used.
  • code/branches/kicklib/src/modules/questsystem/QuestsystemPrereqs.h

    r7474 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _QuestsystemPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _QuestsystemExport  __attribute__ ((visibility("default")))
     58#  define _QuestsystemPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _QuestsystemExport
     61#  define _QuestsystemPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/modules/questsystem/effects/AddReward.cc

    r7456 r8071  
    105105        COUT(5) << "AddReward on player: " << player << " ." << std::endl;
    106106
    107         bool check = true;
     107        bool temp = true;
    108108        for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward )
    109             check = check && (*reward)->reward(player);
     109            temp = temp && (*reward)->reward(player);
    110110
    111111        COUT(4) << "Rewardable successfully added to player." << player << " ." << std::endl;
    112112
    113         return check;
     113        return temp;
    114114    }
    115115
  • code/branches/kicklib/src/modules/weapons/WeaponsPrereqs.h

    r7846 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _WeaponsPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _WeaponsExport  __attribute__ ((visibility("default")))
     58#  define _WeaponsPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _WeaponsExport
     61#  define _WeaponsPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/orxonox/MoodManager.cc

    r7284 r8071  
    5050
    5151        // Checking for the existence of the folder for the default mood
    52         const std::string& path = "ambient/" + MoodManager::defaultMood_ + "/.";
    53         if (!Resource::exists(path))
     52        const std::string& patha = "ambient/" + MoodManager::defaultMood_ + "/.";
     53        if (!Resource::exists(patha))
    5454        {
    5555            // TODO: Non-fatal error handling (non-critical resource missing)
    5656            COUT(2) << "Mood Warning: Folder for default mood (" << MoodManager::defaultMood_ << ") does not exist!" << std::endl;
    5757        }
     58       
     59        // @TODO
     60        // Creating a vector of the available moods to enable easy mood selection by Lua/CEGUI       
    5861    }
    5962
  • code/branches/kicklib/src/orxonox/OrxonoxPrereqs.h

    r7854 r8071  
    5353#    endif
    5454#  endif
    55 #elif defined ( ORXONOX_GCC_VISIBILITY )
     55#  define _OrxonoxPrivate
     56#elif defined (ORXONOX_GCC_VISIBILITY)
    5657#  define _OrxonoxExport  __attribute__ ((visibility("default")))
     58#  define _OrxonoxPrivate __attribute__ ((visibility("hidden")))
    5759#else
    5860#  define _OrxonoxExport
     61#  define _OrxonoxPrivate
    5962#endif
    6063
  • code/branches/kicklib/src/orxonox/sound/AmbientSound.cc

    r7929 r8071  
    4242
    4343        // Ambient sounds always fade in
    44         this->setVolume(0);
     44        this->setVolume(0.0f);
    4545    }
    4646
  • code/branches/kicklib/src/orxonox/sound/BaseSound.cc

    r7858 r8071  
    3131#include <cassert>
    3232#include <vector>
     33
     34#ifdef ORXONOX_PLATFORM_APPLE
     35#include "openal/al.h"
     36#else
    3337#include <al.h>
     38#endif
    3439
    3540#include "util/Math.h"
  • code/branches/kicklib/src/orxonox/sound/SoundBuffer.cc

    r6502 r8071  
    3030#include "SoundBuffer.h"
    3131
     32#if defined(ORXONOX_PLATFORM_APPLE)
     33#include <ALUT/alut.h>
     34#else
    3235#include <AL/alut.h>
     36#endif
    3337#include <vorbis/vorbisfile.h>
    3438
  • code/branches/kicklib/src/orxonox/sound/SoundManager.cc

    r7858 r8071  
    3131#include "SoundManager.h"
    3232
     33#if defined(__APPLE__)
     34#include <ALUT/alut.h>
     35#else
    3336#include <AL/alut.h>
     37#endif
    3438#include <utility>
    3539#include <loki/ScopeGuard.h>
     
    7377        this->bDestructorCalled_ = false;
    7478
     79        // Clear error messages (might be problematic on some systems)
     80        alGetError();
     81        alutGetError();
     82
    7583        // See whether we even want to load
    7684        bool bDisableSound_ = false;
    7785        SetConfigValue(bDisableSound_, false);
    7886        if (bDisableSound_)
    79             ThrowException(InitialisationAborted, "Sound: Not loading at all");
    80 
     87            ThrowException(InitialisationAborted, "Sound: Not loading at all");       
    8188        if (!alutInitWithoutContext(NULL, NULL))
    8289            ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
     
    126133        GameMode::setPlaysSound(true);
    127134        Loki::ScopeGuard resetPlaysSoundGuard = Loki::MakeGuard(&GameMode::setPlaysSound, false);
    128 
     135       
    129136        // Get some information about the sound
    130137        if (const char* version = alGetString(AL_VERSION))
    131             COUT(4) << "Sound: --- OpenAL Version: " << version << std::endl;
     138            COUT(4) << "Sound: --- OpenAL Version: " << version << std::endl;           
    132139        if (const char* vendor = alGetString(AL_VENDOR))
    133140            COUT(4) << "Sound: --- OpenAL Vendor : " << vendor << std::endl;
  • code/branches/kicklib/src/orxonox/sound/SoundStreamer.cc

    r7163 r8071  
    2727#include "SoundStreamer.h"
    2828
     29#ifdef ORXONOX_PLATFORM_APPLE
     30#include "openal/al.h"
     31#else
    2932#include <al.h>
     33#endif
     34
    3035#include <vorbis/vorbisfile.h>
    3136#include "SoundManager.h"
  • code/branches/kicklib/src/orxonox/sound/WorldSound.cc

    r7284 r8071  
    3030#include "WorldSound.h"
    3131
     32#if defined(__APPLE__)
     33#include <ALUT/alut.h>
     34#else
    3235#include <AL/alut.h>
     36#endif
    3337#include "util/Math.h"
    3438#include "core/CoreIncludes.h"
Note: See TracChangeset for help on using the changeset viewer.