Composite of fixed code for mingw64(on windows) and general fixes for msvc.

1) (win32window) don't convert char to wide, use char direct to window.
2) (CMakeLists) Don't link one library as static CPPLIB and no others (mismatched allocations)
3) (macros) Fix Gwen macros for mingw64 on windows build.  (changes are by compiler(msc_ver) not platform)
4) (FileUtils) sprintf_s reference by platform, not compiler (mingw64 support)
5) (b3OpenCLUtils) fix bad define name _MSVC_VER->_MSC_VER
6) (compoundCollision) remove unused variables, simplify operation.
7) (impulseconstraint) remove duplicated code block
This commit is contained in:
d3x0r
2017-10-28 14:42:38 -07:00
parent b0cd74de10
commit 88b49947b5
7 changed files with 17 additions and 26 deletions

View File

@@ -439,15 +439,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void Win32Window::setWindowTitle(const char* titleChar) void Win32Window::setWindowTitle(const char* titleChar)
{ {
wchar_t windowTitle[1024];
swprintf(windowTitle, 1024, L"%hs", titleChar);
#ifdef _WIN64 #ifdef _WIN64
SetWindowTextW(m_data->m_hWnd, windowTitle); SetWindowText(m_data->m_hWnd, titleChar);
#else #else
DWORD dwResult; SendMessageTimeout(m_data->m_hWnd, WM_SETTEXT, 0,
SendMessageTimeoutW(m_data->m_hWnd, WM_SETTEXT, 0, reinterpret_cast<LPARAM>(titleChar),
reinterpret_cast<LPARAM>(windowTitle),
SMTO_ABORTIFHUNG, 2000, &dwResult); SMTO_ABORTIFHUNG, 2000, &dwResult);
#endif #endif
} }

View File

@@ -15,7 +15,7 @@ IF(NOT WIN32 AND NOT APPLE)
ADD_DEFINITIONS("-DDYNAMIC_LOAD_X11_FUNCTIONS=1") ADD_DEFINITIONS("-DDYNAMIC_LOAD_X11_FUNCTIONS=1")
ENDIF() ENDIF()
ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 -D_STATIC_CPPLIB ) ADD_DEFINITIONS( -DGLEW_STATIC -DGWEN_COMPILE_STATIC -D_HAS_EXCEPTIONS=0 )
FILE(GLOB gwen_SRCS "*.cpp" "Controls/*.cpp" "Controls/Dialog/*.cpp" "Controls/Dialogs/*.cpp" "Controls/Layout/*.cpp" "Controls/Property/*.cpp" "Input/*.cpp" "Platforms/*.cpp" "Renderers/*.cpp" "Skins/*.cpp") FILE(GLOB gwen_SRCS "*.cpp" "Controls/*.cpp" "Controls/Dialog/*.cpp" "Controls/Dialogs/*.cpp" "Controls/Layout/*.cpp" "Controls/Property/*.cpp" "Input/*.cpp" "Platforms/*.cpp" "Renderers/*.cpp" "Skins/*.cpp")
FILE(GLOB gwen_HDRS "*.h" "Controls/*.h" "Controls/Dialog/*.h" "Controls/Dialogs/*.h" "Controls/Layout/*.h" "Controls/Property/*.h" "Input/*.h" "Platforms/*.h" "Renderers/*.h" "Skins/*.h") FILE(GLOB gwen_HDRS "*.h" "Controls/*.h" "Controls/Dialog/*.h" "Controls/Dialogs/*.h" "Controls/Layout/*.h" "Controls/Property/*.h" "Input/*.h" "Platforms/*.h" "Renderers/*.h" "Skins/*.h")

View File

@@ -4,6 +4,7 @@
#define GWEN_MACROS_H #define GWEN_MACROS_H
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> // vsnprintf
#if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) #if !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
#include <malloc.h> #include <malloc.h>
#else #else
@@ -17,7 +18,7 @@
#define GwenUtil_Max( a, b ) ( ( (a) > (b) ) ? (a) : (b) ) #define GwenUtil_Max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
#define GwenUtil_VSWPrintFSafeSized( _DstBuf_ARRAY_, _Format, _ArgList ) GwenUtil_VSWPrintFSafe( _DstBuf_ARRAY_, sizeof( _DstBuf_ARRAY_ ) / sizeof( wchar_t ), _Format, _ArgList ) #define GwenUtil_VSWPrintFSafeSized( _DstBuf_ARRAY_, _Format, _ArgList ) GwenUtil_VSWPrintFSafe( _DstBuf_ARRAY_, sizeof( _DstBuf_ARRAY_ ) / sizeof( wchar_t ), _Format, _ArgList )
#ifdef _WIN32 #ifdef _MSC_VER
#ifndef NOMINMAX #ifndef NOMINMAX
#define NOMINMAX #define NOMINMAX
@@ -40,10 +41,15 @@
#define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString ) #define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString )
#define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL) #define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL)
#elif defined(__linux__) || defined(__OpenBSD__)
#elif defined(__linux__) || defined( __GNUC__ )
#define GwenUtil_VSNPrintFSafe( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList ) vsnprintf( _DstBuf, _DstSize, _Format, _ArgList ) #define GwenUtil_VSNPrintFSafe( _DstBuf, _DstSize, _MaxCount, _Format, _ArgList ) vsnprintf( _DstBuf, _DstSize, _Format, _ArgList )
#ifdef _WIN32
#define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vsnwprintf( _DstBuf, _SizeInWords, _Format, _ArgList )
#else
#define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf( _DstBuf, _SizeInWords, _Format, _ArgList ) #define GwenUtil_VSWPrintFSafe( _DstBuf, _SizeInWords, _Format, _ArgList ) vswprintf( _DstBuf, _SizeInWords, _Format, _ArgList )
#endif
#define GwenUtil_OutputDebugCharString( lpOutputString ) //printf( lpOutputString ) #define GwenUtil_OutputDebugCharString( lpOutputString ) //printf( lpOutputString )
#define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString ) #define GwenUtil_OutputDebugWideString( lpOutputString ) //wprintf( lpOutputString )
#define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL) #define GwenUtil_WideStringToFloat( _Str ) wcstof(_Str, NULL)

View File

@@ -36,7 +36,7 @@ struct b3FileUtils
for (int i=0;!f && i<numPrefixes;i++) for (int i=0;!f && i<numPrefixes;i++)
{ {
#ifdef _WIN32 #ifdef _MSC_VER
sprintf_s(relativeFileName,maxRelativeFileNameMaxLen,"%s%s",prefix[i],orgFileName); sprintf_s(relativeFileName,maxRelativeFileNameMaxLen,"%s%s",prefix[i],orgFileName);
#else #else
sprintf(relativeFileName,"%s%s",prefix[i],orgFileName); sprintf(relativeFileName,"%s%s",prefix[i],orgFileName);

View File

@@ -619,7 +619,7 @@ cl_program b3OpenCLUtils_compileCLProgramFromString(cl_context clContext, cl_dev
strippedName = strip2(clFileNameForCaching,"\\"); strippedName = strip2(clFileNameForCaching,"\\");
strippedName = strip2(strippedName,"/"); strippedName = strip2(strippedName,"/");
#ifdef _MSVC_VER #ifdef _MSC_VER
sprintf_s(binaryFileName,B3_MAX_STRING_LENGTH,"%s/%s.%s.%s.bin",sCachedBinaryPath,strippedName, deviceName,driverVersion ); sprintf_s(binaryFileName,B3_MAX_STRING_LENGTH,"%s/%s.%s.%s.bin",sCachedBinaryPath,strippedName, deviceName,driverVersion );
#else #else
sprintf(binaryFileName,"%s/%s.%s.%s.bin",sCachedBinaryPath,strippedName, deviceName,driverVersion ); sprintf(binaryFileName,"%s/%s.%s.%s.bin",sCachedBinaryPath,strippedName, deviceName,driverVersion );

View File

@@ -396,32 +396,24 @@ void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionOb
btCollisionAlgorithm* algo = (btCollisionAlgorithm*)pairs[i].m_userPointer; btCollisionAlgorithm* algo = (btCollisionAlgorithm*)pairs[i].m_userPointer;
{ {
btTransform orgTrans0;
const btCollisionShape* childShape0 = 0; const btCollisionShape* childShape0 = 0;
btTransform newChildWorldTrans0; btTransform newChildWorldTrans0;
btTransform orgInterpolationTrans0;
childShape0 = compoundShape0->getChildShape(pairs[i].m_indexA); childShape0 = compoundShape0->getChildShape(pairs[i].m_indexA);
orgTrans0 = col0ObjWrap->getWorldTransform();
orgInterpolationTrans0 = col0ObjWrap->getWorldTransform();
const btTransform& childTrans0 = compoundShape0->getChildTransform(pairs[i].m_indexA); const btTransform& childTrans0 = compoundShape0->getChildTransform(pairs[i].m_indexA);
newChildWorldTrans0 = orgTrans0*childTrans0 ; newChildWorldTrans0 = col0ObjWrap->getWorldTransform()*childTrans0 ;
childShape0->getAabb(newChildWorldTrans0,aabbMin0,aabbMax0); childShape0->getAabb(newChildWorldTrans0,aabbMin0,aabbMax0);
} }
btVector3 thresholdVec(resultOut->m_closestPointDistanceThreshold, resultOut->m_closestPointDistanceThreshold, resultOut->m_closestPointDistanceThreshold); btVector3 thresholdVec(resultOut->m_closestPointDistanceThreshold, resultOut->m_closestPointDistanceThreshold, resultOut->m_closestPointDistanceThreshold);
aabbMin0 -= thresholdVec; aabbMin0 -= thresholdVec;
aabbMax0 += thresholdVec; aabbMax0 += thresholdVec;
{ {
btTransform orgInterpolationTrans1;
const btCollisionShape* childShape1 = 0; const btCollisionShape* childShape1 = 0;
btTransform orgTrans1;
btTransform newChildWorldTrans1; btTransform newChildWorldTrans1;
childShape1 = compoundShape1->getChildShape(pairs[i].m_indexB); childShape1 = compoundShape1->getChildShape(pairs[i].m_indexB);
orgTrans1 = col1ObjWrap->getWorldTransform();
orgInterpolationTrans1 = col1ObjWrap->getWorldTransform();
const btTransform& childTrans1 = compoundShape1->getChildTransform(pairs[i].m_indexB); const btTransform& childTrans1 = compoundShape1->getChildTransform(pairs[i].m_indexB);
newChildWorldTrans1 = orgTrans1*childTrans1 ; newChildWorldTrans1 = col1ObjWrap->getWorldTransform()*childTrans1 ;
childShape1->getAabb(newChildWorldTrans1,aabbMin1,aabbMax1); childShape1->getAabb(newChildWorldTrans1,aabbMin1,aabbMax1);
} }

View File

@@ -1425,9 +1425,6 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol
fb->m_appliedTorqueBodyB.setZero(); fb->m_appliedTorqueBodyB.setZero();
} }
if (constraints[i]->isEnabled())
{
}
if (constraints[i]->isEnabled()) if (constraints[i]->isEnabled())
{ {
constraints[i]->getInfo1(&info1); constraints[i]->getInfo1(&info1);