Fixes to npc trade, begin native directx support
This commit is contained in:
parent
a84d0bbf11
commit
bb304f9f4e
|
@ -32,10 +32,10 @@ ignoreEquipped = nil
|
|||
showAllItems = nil
|
||||
sellAllButton = nil
|
||||
|
||||
playerFreeCapacity = nil
|
||||
playerMoney = nil
|
||||
playerFreeCapacity = 0
|
||||
playerMoney = 0
|
||||
tradeItems = {}
|
||||
playerItems = nil
|
||||
playerItems = {}
|
||||
selectedItem = nil
|
||||
|
||||
cancelNextRelease = nil
|
||||
|
@ -369,6 +369,7 @@ function refreshPlayerGoods()
|
|||
|
||||
local canTrade = canTradeItem(item)
|
||||
itemWidget:setOn(canTrade)
|
||||
itemWidget:setEnabled(canTrade)
|
||||
|
||||
local searchCondition = (searchFilter == '') or (searchFilter ~= '' and string.find(item.name:lower(), searchFilter) ~= nil)
|
||||
local showAllItemsCondition = (currentTradeType == BUY) or (showAllItems:isChecked()) or (currentTradeType == SELL and not showAllItems:isChecked() and canTrade)
|
||||
|
@ -450,9 +451,6 @@ function onFreeCapacityChange(localPlayer, freeCapacity, oldFreeCapacity)
|
|||
end
|
||||
|
||||
function onInventoryChange(inventory, item, oldItem)
|
||||
if selectedItem then
|
||||
refreshItem(selectedItem)
|
||||
end
|
||||
refreshPlayerGoods()
|
||||
end
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ else()
|
|||
endif()
|
||||
|
||||
# gcc compile flags
|
||||
set(WARNS_FLAGS "-Wall -Wextra -Werror -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result")
|
||||
set(WARNS_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-unused-variable -Wno-unused-result")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNS_FLAGS} ${ARCH_FLAGS} ${CPP2011_FLAGS} -pipe")
|
||||
set(CMAKE_CXX_FLAGS_COMPILESPEED "-O0")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
|
||||
|
@ -303,6 +303,16 @@ if(FRAMEWORK_GRAPHICS)
|
|||
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -mwindows")
|
||||
message(STATUS "Windows console: OFF")
|
||||
endif()
|
||||
|
||||
# native dx9 support while its under development
|
||||
option(DIRECTX "Use DX9 support" OFF)
|
||||
if(DIRECTX)
|
||||
find_package(DirectX REQUIRED)
|
||||
set(framework_DEFINITIONS ${framework_DEFINITIONS} -DDIRECTX)
|
||||
set(framework_INCLUDE_DIRS ${framework_INCLUDE_DIRS} ${DirectX_INCLUDE_DIR})
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} ${DirectX_LIBRARY} ${DirectX_LIBRARIES})
|
||||
endif()
|
||||
|
||||
else()
|
||||
set(framework_LIBRARIES ${framework_LIBRARIES} X11)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
#-------------------------------------------------------------------
|
||||
# This file is part of the CMake build system for OGRE
|
||||
# (Object-oriented Graphics Rendering Engine)
|
||||
# For the latest info, see http://www.ogre3d.org/
|
||||
#
|
||||
# The contents of this file are placed in the public domain. Feel
|
||||
# free to make use of it in any way you like.
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Find DirectX SDK
|
||||
# Define:
|
||||
# DirectX_FOUND
|
||||
# DirectX_INCLUDE_DIR
|
||||
# DirectX_LIBRARY
|
||||
# DirectX_ROOT_DIR
|
||||
|
||||
if(WIN32) # The only platform it makes sense to check for DirectX SDK
|
||||
include(FindPkgMacros)
|
||||
findpkg_begin(DirectX)
|
||||
|
||||
# Get path, convert backslashes as ${ENV_DXSDK_DIR}
|
||||
getenv_path(DXSDK_DIR)
|
||||
getenv_path(DIRECTX_HOME)
|
||||
getenv_path(DIRECTX_ROOT)
|
||||
getenv_path(DIRECTX_BASE)
|
||||
|
||||
# construct search paths
|
||||
set(DirectX_PREFIX_PATH
|
||||
"${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
|
||||
"${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
|
||||
"${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
|
||||
"${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
|
||||
"C:/apps_x86/Microsoft DirectX SDK*"
|
||||
"C:/Program Files (x86)/Microsoft DirectX SDK*"
|
||||
"C:/apps/Microsoft DirectX SDK*"
|
||||
"C:/Program Files/Microsoft DirectX SDK*"
|
||||
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
|
||||
)
|
||||
create_search_paths(DirectX)
|
||||
# redo search if prefix path changed
|
||||
clear_if_changed(DirectX_PREFIX_PATH
|
||||
DirectX_LIBRARY
|
||||
DirectX_INCLUDE_DIR
|
||||
)
|
||||
|
||||
find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH})
|
||||
# dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86
|
||||
# lib files are in DirectX_ROOT_DIR/Lib/x64|x86
|
||||
if(CMAKE_CL_64)
|
||||
set(DirectX_LIBPATH_SUFFIX "x64")
|
||||
else(CMAKE_CL_64)
|
||||
set(DirectX_LIBPATH_SUFFIX "x86")
|
||||
endif(CMAKE_CL_64)
|
||||
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_DINPUT8_LIBRARY NAMES dinput8 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_XINPUT_LIBRARY NAMES xinput HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
|
||||
# look for dxgi (needed by both 10 and 11)
|
||||
find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
|
||||
# look for d3dcompiler (needed by 11)
|
||||
find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
|
||||
findpkg_finish(DirectX)
|
||||
set(DirectX_LIBRARIES ${DirectX_LIBRARIES}
|
||||
${DirectX_D3DX9_LIBRARY}
|
||||
${DirectX_DXERR_LIBRARY}
|
||||
${DirectX_DXGUID_LIBRARY}
|
||||
${DirectX_DINPUT8_LIBRARY}
|
||||
)
|
||||
|
||||
mark_as_advanced(DirectX_D3DX9_LIBRARY DirectX_DXERR_LIBRARY DirectX_DXGUID_LIBRARY
|
||||
DirectX_DXGI_LIBRARY DirectX_D3DCOMPILER_LIBRARY
|
||||
DirectX_DINPUT8_LIBRARY DirectX_XINPUT_LIBRARY)
|
||||
|
||||
# look for D3D11 components
|
||||
if (DirectX_FOUND)
|
||||
find_path(DirectX_D3D11_INCLUDE_DIR NAMES D3D11Shader.h HINTS ${DirectX_INC_SEARCH_PATH})
|
||||
get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
|
||||
message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
|
||||
find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
|
||||
if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
|
||||
set(DirectX_D3D11_FOUND TRUE)
|
||||
set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR})
|
||||
set(DirectX_D3D11_LIBRARIES ${DirectX_D3D11_LIBRARIES}
|
||||
${DirectX_D3D11_LIBRARY}
|
||||
${DirectX_D3DX11_LIBRARY}
|
||||
${DirectX_DXGI_LIBRARY}
|
||||
${DirectX_DXERR_LIBRARY}
|
||||
${DirectX_DXGUID_LIBRARY}
|
||||
${DirectX_D3DCOMPILER_LIBRARY}
|
||||
)
|
||||
endif ()
|
||||
mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY)
|
||||
endif ()
|
||||
|
||||
endif(WIN32)
|
|
@ -0,0 +1,162 @@
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
# This file is part of the CMake build system for OGRE
|
||||
# (Object-oriented Graphics Rendering Engine)
|
||||
# For the latest info, see http://www.ogre3d.org/
|
||||
#
|
||||
# The contents of this file are placed in the public domain. Feel
|
||||
# free to make use of it in any way you like.
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
##################################################################
|
||||
# Provides some common functionality for the FindPackage modules
|
||||
##################################################################
|
||||
|
||||
# Begin processing of package
|
||||
macro(findpkg_begin PREFIX)
|
||||
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
message(STATUS "Looking for ${PREFIX}...")
|
||||
endif ()
|
||||
endmacro(findpkg_begin)
|
||||
|
||||
# Display a status message unless FIND_QUIETLY is set
|
||||
macro(pkg_message PREFIX)
|
||||
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
message(STATUS ${ARGN})
|
||||
endif ()
|
||||
endmacro(pkg_message)
|
||||
|
||||
# Get environment variable, define it as ENV_$var and make sure backslashes are converted to forward slashes
|
||||
macro(getenv_path VAR)
|
||||
set(ENV_${VAR} $ENV{${VAR}})
|
||||
# replace won't work if var is blank
|
||||
if (ENV_${VAR})
|
||||
string( REGEX REPLACE "\\\\" "/" ENV_${VAR} ${ENV_${VAR}} )
|
||||
endif ()
|
||||
endmacro(getenv_path)
|
||||
|
||||
# Construct search paths for includes and libraries from a PREFIX_PATH
|
||||
macro(create_search_paths PREFIX)
|
||||
foreach(dir ${${PREFIX}_PREFIX_PATH})
|
||||
set(${PREFIX}_INC_SEARCH_PATH ${${PREFIX}_INC_SEARCH_PATH}
|
||||
${dir}/include ${dir}/Include ${dir}/include/${PREFIX} ${dir}/Headers)
|
||||
set(${PREFIX}_LIB_SEARCH_PATH ${${PREFIX}_LIB_SEARCH_PATH}
|
||||
${dir}/lib ${dir}/Lib ${dir}/lib/${PREFIX} ${dir}/Libs)
|
||||
set(${PREFIX}_BIN_SEARCH_PATH ${${PREFIX}_BIN_SEARCH_PATH}
|
||||
${dir}/bin)
|
||||
endforeach(dir)
|
||||
set(${PREFIX}_FRAMEWORK_SEARCH_PATH ${${PREFIX}_PREFIX_PATH})
|
||||
endmacro(create_search_paths)
|
||||
|
||||
# clear cache variables if a certain variable changed
|
||||
macro(clear_if_changed TESTVAR)
|
||||
# test against internal check variable
|
||||
# HACK: Apparently, adding a variable to the cache cleans up the list
|
||||
# a bit. We need to also remove any empty strings from the list, but
|
||||
# at the same time ensure that we are actually dealing with a list.
|
||||
list(APPEND ${TESTVAR} "")
|
||||
list(REMOVE_ITEM ${TESTVAR} "")
|
||||
if (NOT "${${TESTVAR}}" STREQUAL "${${TESTVAR}_INT_CHECK}")
|
||||
message(STATUS "${TESTVAR} changed.")
|
||||
foreach(var ${ARGN})
|
||||
set(${var} "NOTFOUND" CACHE STRING "x" FORCE)
|
||||
endforeach(var)
|
||||
endif ()
|
||||
set(${TESTVAR}_INT_CHECK ${${TESTVAR}} CACHE INTERNAL "x" FORCE)
|
||||
endmacro(clear_if_changed)
|
||||
|
||||
# Try to get some hints from pkg-config, if available
|
||||
macro(use_pkgconfig PREFIX PKGNAME)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(${PREFIX} ${PKGNAME})
|
||||
endif ()
|
||||
endmacro (use_pkgconfig)
|
||||
|
||||
# Couple a set of release AND debug libraries (or frameworks)
|
||||
macro(make_library_set PREFIX)
|
||||
if (${PREFIX}_FWK)
|
||||
set(${PREFIX} ${${PREFIX}_FWK})
|
||||
elseif (${PREFIX}_REL AND ${PREFIX}_DBG)
|
||||
set(${PREFIX} optimized ${${PREFIX}_REL} debug ${${PREFIX}_DBG})
|
||||
elseif (${PREFIX}_REL)
|
||||
set(${PREFIX} ${${PREFIX}_REL})
|
||||
elseif (${PREFIX}_DBG)
|
||||
set(${PREFIX} ${${PREFIX}_DBG})
|
||||
endif ()
|
||||
endmacro(make_library_set)
|
||||
|
||||
# Generate debug names from given release names
|
||||
macro(get_debug_names PREFIX)
|
||||
foreach(i ${${PREFIX}})
|
||||
set(${PREFIX}_DBG ${${PREFIX}_DBG} ${i}d ${i}D ${i}_d ${i}_D ${i}_debug ${i})
|
||||
endforeach(i)
|
||||
endmacro(get_debug_names)
|
||||
|
||||
# Add the parent dir from DIR to VAR
|
||||
macro(add_parent_dir VAR DIR)
|
||||
get_filename_component(${DIR}_TEMP "${${DIR}}/.." ABSOLUTE)
|
||||
set(${VAR} ${${VAR}} ${${DIR}_TEMP})
|
||||
endmacro(add_parent_dir)
|
||||
|
||||
# Do the final processing for the package find.
|
||||
macro(findpkg_finish PREFIX)
|
||||
# skip if already processed during this run
|
||||
if (NOT ${PREFIX}_FOUND)
|
||||
if (${PREFIX}_INCLUDE_DIR AND ${PREFIX}_LIBRARY)
|
||||
set(${PREFIX}_FOUND TRUE)
|
||||
set(${PREFIX}_INCLUDE_DIRS ${${PREFIX}_INCLUDE_DIR})
|
||||
set(${PREFIX}_LIBRARIES ${${PREFIX}_LIBRARY})
|
||||
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
message(STATUS "Found ${PREFIX}: ${${PREFIX}_LIBRARIES}")
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT ${PREFIX}_FIND_QUIETLY)
|
||||
message(STATUS "Could not locate ${PREFIX}")
|
||||
endif ()
|
||||
if (${PREFIX}_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Required library ${PREFIX} not found! Install the library (including dev packages) and try again. If the library is already installed, set the missing variables manually in cmake.")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
mark_as_advanced(${PREFIX}_INCLUDE_DIR ${PREFIX}_LIBRARY ${PREFIX}_LIBRARY_REL ${PREFIX}_LIBRARY_DBG ${PREFIX}_LIBRARY_FWK)
|
||||
endif ()
|
||||
endmacro(findpkg_finish)
|
||||
|
||||
|
||||
# Slightly customised framework finder
|
||||
MACRO(findpkg_framework fwk)
|
||||
IF(APPLE)
|
||||
SET(${fwk}_FRAMEWORK_PATH
|
||||
${${fwk}_FRAMEWORK_SEARCH_PATH}
|
||||
${CMAKE_FRAMEWORK_PATH}
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/System/Library/Frameworks
|
||||
/Network/Library/Frameworks
|
||||
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.0.sdk/System/Library/Frameworks/
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Release
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/lib/Debug
|
||||
)
|
||||
# These could be arrays of paths, add each individually to the search paths
|
||||
foreach(i ${OGRE_PREFIX_PATH})
|
||||
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug)
|
||||
endforeach(i)
|
||||
|
||||
foreach(i ${OGRE_PREFIX_BUILD})
|
||||
set(${fwk}_FRAMEWORK_PATH ${${fwk}_FRAMEWORK_PATH} ${i}/lib/Release ${i}/lib/Debug)
|
||||
endforeach(i)
|
||||
|
||||
FOREACH(dir ${${fwk}_FRAMEWORK_PATH})
|
||||
SET(fwkpath ${dir}/${fwk}.framework)
|
||||
IF(EXISTS ${fwkpath})
|
||||
SET(${fwk}_FRAMEWORK_INCLUDES ${${fwk}_FRAMEWORK_INCLUDES}
|
||||
${fwkpath}/Headers ${fwkpath}/PrivateHeaders)
|
||||
SET(${fwk}_FRAMEWORK_PATH ${dir})
|
||||
if (NOT ${fwk}_LIBRARY_FWK)
|
||||
SET(${fwk}_LIBRARY_FWK "-framework ${fwk}")
|
||||
endif ()
|
||||
ENDIF(EXISTS ${fwkpath})
|
||||
ENDFOREACH(dir)
|
||||
ENDIF(APPLE)
|
||||
ENDMACRO(findpkg_framework)
|
|
@ -204,6 +204,26 @@ void WIN32Window::init()
|
|||
{
|
||||
m_instance = GetModuleHandle(NULL);
|
||||
|
||||
#ifdef DIRECTX
|
||||
m_d3d = Direct3DCreate9(D3D_SDK_VERSION); // create the Direct3D interface
|
||||
|
||||
D3DPRESENT_PARAMETERS d3dpp; // create a struct to hold various device information
|
||||
|
||||
ZeroMemory(&d3dpp, sizeof(d3dpp)); // clear out the struct for use
|
||||
d3dpp.Windowed = TRUE; // program windowed, not fullscreen
|
||||
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; // discard old frames
|
||||
d3dpp.hDeviceWindow = m_window; // set the window to be used by Direct3D
|
||||
|
||||
// create a device class using this information and information from the d3dpp stuct
|
||||
m_d3d->CreateDevice(D3DADAPTER_DEFAULT,
|
||||
D3DDEVTYPE_HAL,
|
||||
m_window,
|
||||
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
|
||||
&d3dpp,
|
||||
&m_d3ddev);
|
||||
|
||||
#endif
|
||||
|
||||
internalCreateWindow();
|
||||
internalCreateGLContext();
|
||||
internalRestoreGLContext();
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
#include <EGL/egl.h>
|
||||
#endif
|
||||
|
||||
#ifdef DIRECTX
|
||||
#include <d3d9.h>
|
||||
#endif
|
||||
|
||||
struct WindowProcProxy;
|
||||
|
||||
class WIN32Window : public PlatformWindow
|
||||
|
@ -95,6 +99,11 @@ private:
|
|||
HCURSOR m_defaultCursor;
|
||||
bool m_hidden;
|
||||
|
||||
#ifdef DIRECTX
|
||||
LPDIRECT3D9 m_d3d; // the pointer to our Direct3D interface
|
||||
LPDIRECT3DDEVICE9 m_d3ddev; // the pointer to the device class
|
||||
#endif
|
||||
|
||||
#ifdef OPENGL_ES
|
||||
EGLConfig m_eglConfig;
|
||||
EGLContext m_eglContext;
|
||||
|
|
Loading…
Reference in New Issue