 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Dominique Louis Guest
|
Posted: Sat Nov 05, 2005 6:15 am Post subject: DirectX SDK 3D Empty Project examples... |
|
|
Hi all,
I've downloaded the latest version of the DirectX SDK and managed to
get the simple 3D tutorials compiling and working in BCB thanks to
Clootie's ( http://www.clootie.ru/cbuilder/index.html#DX_CBuilder_SDKs )
lib files. But I have also been trying to get
SamplesC++Direct3DEmptyProject compiled using BCB and since this uses
Microsoft's game framework, I have run into some problems.
At the moment the project stops compiling on the following line...
Unit : DXUTMisc.h
Line No : 733
Code :
nNewMaxSize = __max( nNewMaxSize, m_nMaxSize + nGrowBy );
Error : [C++ Error] DXUTmisc.h(733): E2268 Call to undefined function
'__max'
I have the usual Microsoft compatible conditional defines :
cosf=(float)cos;sinf=(float)sin;acosf=(float)acos;asinf=(float)asin;sqrtf=(float)sqrt;fabsf=(float)abs;UNICODE;PROFILE
Are there any more I am missing?
Has anyone managed to get the simplest of these latest "framework"
samples working? I definately managed to get older SDK samples working
from a couple of year ago, but these ones do not seem as easy.
Dominique
http://www.pascalgamedevelopment.com
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Sat Nov 05, 2005 6:42 am Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
Dominique Louis wrote:
| Quote: | Are there any more I am missing?
|
Yes, add
__max=max;__min=min;sqrtf=(float)sqrt;powf=(float)pow;atan2f=(float)atan2;STRICT;__noop=(void)0;
You'll probably have to edit a few other files as well. Eg. In
CommonDXUTMisc.h, you'll have to change the line:
#define DXUTTRACE __noop
to
#define DXUTTRACE
| Quote: | Has anyone managed to get the simplest of these latest "framework"
samples working? I definately managed to get older SDK samples working
from a couple of year ago, but these ones do not seem as easy.
|
Yes I have. So just post on these groups to get me to help you.
Jonathan
|
|
| Back to top |
|
 |
Dominique Louis Guest
|
Posted: Wed Nov 09, 2005 7:13 pm Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
Hi Jonathan,
Thanks for the extra defines I have added them to the project. Now
when compiling I get the error...
[C++ Error] DXUTmisc.h(733): E2268 Call to undefined function 'max'
I thought that the max macro was defined in stdio. Pardon the silly
questions, but the last time I used C++ was about 6 years ago and it's
now getting a bit fuzzy.
If you have a working version of "EmptyProject" it might be quicker for
me to have a look at that, if you don't mind sending it to me.
Dominique.
Jonathan Benedicto wrote:
| Quote: | Dominique Louis wrote:
Are there any more I am missing?
Yes, add
__max=max;__min=min;sqrtf=(float)sqrt;powf=(float)pow;atan2f=(float)atan2;STRICT;__noop=(void)0;
You'll probably have to edit a few other files as well. Eg. In
CommonDXUTMisc.h, you'll have to change the line:
#define DXUTTRACE __noop
to
#define DXUTTRACE
Has anyone managed to get the simplest of these latest "framework"
samples working? I definately managed to get older SDK samples working
from a couple of year ago, but these ones do not seem as easy.
Yes I have. So just post on these groups to get me to help you.
Jonathan
|
|
|
| Back to top |
|
 |
Dominique Louis Guest
|
Posted: Wed Nov 09, 2005 7:14 pm Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
btw, were you using DirectX with C++ Builder for a game?
Dominique.
Jonathan Benedicto wrote:
| Quote: | Dominique Louis wrote:
Are there any more I am missing?
Yes, add
__max=max;__min=min;sqrtf=(float)sqrt;powf=(float)pow;atan2f=(float)atan2;STRICT;__noop=(void)0;
You'll probably have to edit a few other files as well. Eg. In
CommonDXUTMisc.h, you'll have to change the line:
#define DXUTTRACE __noop
to
#define DXUTTRACE
Has anyone managed to get the simplest of these latest "framework"
samples working? I definately managed to get older SDK samples working
from a couple of year ago, but these ones do not seem as easy.
Yes I have. So just post on these groups to get me to help you.
Jonathan
|
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Nov 09, 2005 7:41 pm Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
Dominique Louis wrote:
| Quote: | Thanks for the extra defines I have added them to the project. Now
when compiling I get the error...
[C++ Error] DXUTmisc.h(733): E2268 Call to undefined function 'max'
I thought that the max macro was defined in stdio. Pardon the silly
questions, but the last time I used C++ was about 6 years ago and it's
now getting a bit fuzzy.
|
I don't know where max and min are defined, but just comment out the #undef
max and #undef min at the top of DXUTMisc.h
| Quote: | If you have a working version of "EmptyProject" it might be quicker
for me to have a look at that, if you don't mind sending it to me.
|
I used to, but somehow I've lost it. If I find it, I'll post it here.
Jonathan
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Nov 09, 2005 7:42 pm Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
Dominique Louis wrote:
| Quote: | btw, were you using DirectX with C++ Builder for a game?
|
Kind of, yes. I was also wanting to learn D3D.
Jonathan
|
|
| Back to top |
|
 |
Jonathan Benedicto Guest
|
Posted: Wed Nov 09, 2005 8:26 pm Post subject: Re: DirectX SDK 3D Empty Project examples... |
|
|
Dominique Louis wrote:
| Quote: | If you have a working version of "EmptyProject" it might be quicker
for me to have a look at that, if you don't mind sending it to me.
|
Well, I don't know if MS would let me give it to you. But I can give you
the changes I had to make.
In dxstdafx.h instert this at line 115:
#ifndef XMAX
#define __max(a, b) (((a) > (b)) ? (a) : (b))
#define XMAX
#endif
#ifndef XMIN
#define __min(a, b) (((a) < (b)) ? (a) : (b))
#define XMIN
#endif
In dxut.cpp below line 42, replace the next 6 lines with this:
#define SET_ACCESSOR( x, y ) inline void Set##y( x t ) { DXUTLock l;
m_state.m_##y = t; }
#define GET_ACCESSOR( x, y ) inline x Get##y() { DXUTLock l; return
m_state.m_##y; }
#define GET_SET_ACCESSOR( x, y ) SET_ACCESSOR( x, y ) GET_ACCESSOR( x,
y )
#define SETP_ACCESSOR( x, y ) inline void Set##y( x* t ) { DXUTLock
l; m_state.m_##y = *t; }
#define GETP_ACCESSOR( x, y ) inline x* Get##y() { DXUTLock l; return
&m_state.m_##y; }
#define GETP_SETP_ACCESSOR( x, y ) SETP_ACCESSOR( x, y ) GETP_ACCESSOR( x,
y )
At line 902 delete this:
#ifdef _WIN64
LONG_PTR nResult = SetWindowLongPtr( hWndFocus, GWLP_WNDPROC,
(LONG_PTR)DXUTStaticWndProc );
#else
LONG_PTR nResult = SetWindowLongPtr( hWndFocus, GWLP_WNDPROC,
(LONG)(LONG_PTR)DXUTStaticWndProc );
#endif
and replace with:
LONG_PTR nResult = SetWindowLong( hWndFocus, GWL_WNDPROC,
(long)DXUTStaticWndProc );
Replace line 910 with:
return DXUT_ERR_MSGBOX( L"SetWindowLong",
HRESULT_FROM_WIN32(dwError) );
Replace line 931 with:
HINSTANCE hInstance = (HINSTANCE) GetWindowLong( hWndFocus,
GWL_HINSTANCE );
Delete lines 3986 to 3988.
Delete lines 4892 to 4895.
Replace line 4910 with:
HCURSOR hCursor = (HCURSOR) GetClassLong(
DXUTGetHWNDDeviceFullScreen(), GCL_HCURSOR );
In dxut.h, replace line 100 with:
HRESULT DXUTSetWindow( HWND hWndFocus, HWND hWndDeviceFullScreen, HWND
hWndDeviceWindowed, bool bHandleMessages );
In dxutenum.cpp, replace line 171 with:
if( stricmp( pAdapterInfo1->AdapterIdentifier.Description,
In dxutgui.cpp, delete line 820.
Replace lines 5459 to 5463 with:
{ 65, 65, 65 } ,
{ 65, 65, 65 } ,
{ 65, 65, 65 } ,
{ 65, 65, 65 } ,
{ 65, 65, 65 } ,
In dxutmisc.h, insert this at line 12:
#ifndef XMAX
#define __max(a, b) (((a) > (b)) ? (a) : (b))
#define XMAX
#endif
#ifndef XMIN
#define __min(a, b) (((a) < (b)) ? (a) : (b))
#define XMIN
#endif
Replace line 595 with:
#define DXUTTRACE
Replace lines 644-646 with this:
#define DXUT_BeginPerfEvent( color, pstrMessage )
#define DXUT_EndPerfEvent()
#define DXUT_SetPerfMarker( color, pstrMessage )
Now, for the project, I just had to use these defines:
sqrtf=(float)sqrt;powf=(float)pow;atanf=(float)atan;atan2f=(float)atan2;UNICODE;_stricmp=stricmp;__MFC_COMPAT__;STRICT
Just create a BCB Application, remove the Unit1.cpp, save it into the
EmptyProject dir, then either one of these two methods should work:
Go to the EmptyProject folder, and rename the .bpr to EmptyProject.bpr. Now
open it in BCB, add those user defines, the DXUT .cpp files, the DX libs,
and click Run.
Or, add the DXUT .cpps and the DX libs, open EmptyProject.cpp, select all,
copy and paste into the project's source code (click Project., View
Source), just under the USEUNIT/USELIBs.
HTH
Jonathan
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|