A
Andreas Schmitt
Ok. I got the following problem. I created the following array and executed
a function :
CField* Spielfeld[20][20];
CreatePlayField( Spielfeld );
*************************************************
******** CreatePlayField looks like this ************
*************************************************
// Set PlayField Coordinates and Size
void CreatePlayField( CField* PlayField[20][20] )
{
for ( int tmpx = 1; tmpx<=20; tmpx++ )
{
for ( int tmpy = 1; tmpy<=20; tmpy++ )
{
PlayField[tmpx][tmpy] = new CField;
PlayField[tmpx][tmpy]->SetXCoord( (tmpx-1)*FLD_WIDTH +
(tmpx*2) );
PlayField[tmpx][tmpy]->SetYCoord( (tmpy-1)*FLD_HEIGHT +
(tmpy*2) );
PlayField[tmpx][tmpy]->SetWidth( FLD_WIDTH );
PlayField[tmpx][tmpy]->SetHeight( FLD_HEIGHT );
}
}
}
**************************************
** Till here all this works
**************************************
**********************************************************************************************
**** Later in the code a function of the CDirect3D-Object 'Direct3D' is
called like this
**********************************************************************************************
Direct3D.Init(hWnd, Spielfeld);
***********************************
**** ...and the problematic part looks like this
***********************************
BOOL CDirect3D::Init(HWND hWnd, CField* PlayField[20][20], BOOL bWindowed)
{
....
for ( int x = 1; x<=20; x++ )
{
for ( int y = 1; y<=20; y++)
{
m_RFieldRect[x][y] = (PlayField[x][y]->GetXCoord,
PlayField[x][y]->GetYCoord,
PlayField[x][y]->GetWidth,
PlayField[x][y]->GetHeight );
m_lpD3DDevice->ColorFill(m_lpD3DSurface,
&m_RFieldRect[x][y],
PlayField[x][y]->GetColor());
}
}
....
}
******************************************************************************************
** Here I get several error messages which say:
**
** g:\Eigene Dateien\Visual Studio Projects\2DSpielfeld\Direct3D.cpp(80):
error C2475: 'CField::GetXCoord':
** forming a pointer-to-member requires explicit use of the address-of
operator ('&') and a qualified name
**
** The MSDN Help on that error message didn't really help me and I don't
really know what's the problem
** Searching the internet also didn't really help.
** My experience with C++ is probably simply not high enough yet to get
what's the problem here
** Any help would be appreciated
*******************************************************************************************
a function :
CField* Spielfeld[20][20];
CreatePlayField( Spielfeld );
*************************************************
******** CreatePlayField looks like this ************
*************************************************
// Set PlayField Coordinates and Size
void CreatePlayField( CField* PlayField[20][20] )
{
for ( int tmpx = 1; tmpx<=20; tmpx++ )
{
for ( int tmpy = 1; tmpy<=20; tmpy++ )
{
PlayField[tmpx][tmpy] = new CField;
PlayField[tmpx][tmpy]->SetXCoord( (tmpx-1)*FLD_WIDTH +
(tmpx*2) );
PlayField[tmpx][tmpy]->SetYCoord( (tmpy-1)*FLD_HEIGHT +
(tmpy*2) );
PlayField[tmpx][tmpy]->SetWidth( FLD_WIDTH );
PlayField[tmpx][tmpy]->SetHeight( FLD_HEIGHT );
}
}
}
**************************************
** Till here all this works
**************************************
**********************************************************************************************
**** Later in the code a function of the CDirect3D-Object 'Direct3D' is
called like this
**********************************************************************************************
Direct3D.Init(hWnd, Spielfeld);
***********************************
**** ...and the problematic part looks like this
***********************************
BOOL CDirect3D::Init(HWND hWnd, CField* PlayField[20][20], BOOL bWindowed)
{
....
for ( int x = 1; x<=20; x++ )
{
for ( int y = 1; y<=20; y++)
{
m_RFieldRect[x][y] = (PlayField[x][y]->GetXCoord,
PlayField[x][y]->GetYCoord,
PlayField[x][y]->GetWidth,
PlayField[x][y]->GetHeight );
m_lpD3DDevice->ColorFill(m_lpD3DSurface,
&m_RFieldRect[x][y],
PlayField[x][y]->GetColor());
}
}
....
}
******************************************************************************************
** Here I get several error messages which say:
**
** g:\Eigene Dateien\Visual Studio Projects\2DSpielfeld\Direct3D.cpp(80):
error C2475: 'CField::GetXCoord':
** forming a pointer-to-member requires explicit use of the address-of
operator ('&') and a qualified name
**
** The MSDN Help on that error message didn't really help me and I don't
really know what's the problem
** Searching the internet also didn't really help.
** My experience with C++ is probably simply not high enough yet to get
what's the problem here
** Any help would be appreciated
*******************************************************************************************