[Problem] Kompilacja kodu

0

Wywala mi takie errory:

1>  Main.cpp
1>  CCommandLine.cpp
1>  CDebug.cpp
1>  CExceptionHandler.cpp
1>  CLog.cpp
1>  CUtils.cpp
1>  Input.cpp
1>  StdInc.cpp
1>  CChatbox.cpp
1>CChatbox.cpp(22): error C2660: 'D3DXCreateFont' : function does not take 12 arguments
1>CChatbox.cpp(66): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(69): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(72): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(75): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(78): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(81): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(84): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(87): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(90): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(93): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(97): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(104): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(107): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(110): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(113): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(116): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CChatbox.cpp(175): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>  CGraphic.cpp
1>CGraphic.cpp(30): error C2660: 'D3DXCreateFont' : function does not take 12 arguments
1>CGraphic.cpp(55): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(61): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(83): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(87): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(94): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(97): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(101): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(104): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(108): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(111): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(122): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(126): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(130): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(133): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(137): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(140): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(149): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(152): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(155): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(158): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(161): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(164): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>CGraphic.cpp(196): error C2065: 'D3DXSPRITE_ALPHABLEND' : undeclared identifier
1>CGraphic.cpp(196): error C2065: 'D3DXSPRITE_SORT_TEXTURE' : undeclared identifier
1>CGraphic.cpp(196): error C2660: 'ID3DXSprite::Begin' : function does not take 1 arguments
1>CGraphic.cpp(199): error C3861: 'D3DXMatrixTransformation2D': identifier not found
1>CGraphic.cpp(201): error C2039: 'SetTransform' : is not a member of 'ID3DXSprite'
1>          c:\program files (x86)\microsoft sdks\windows\v7.0a\include\d3dx9core.h(213) : see declaration of 'ID3DXSprite'
1>CGraphic.cpp(202): error C2660: 'ID3DXSprite::Draw' : function does not take 5 arguments
1>  CStatsGraph.cpp
1>CStatsGraph.cpp(19): error C2660: 'D3DXCreateFont' : function does not take 12 arguments
1>CStatsGraph.cpp(41): error C2660: 'ID3DXFont::DrawTextA' : function does not take 6 arguments
1>  CGUI.cpp
1>CGUI.cpp(128): error C3861: 'D3DXMatrixTransformation2D': identifier not found
1>CGUI.cpp(130): error C2039: 'SetTransform' : is not a member of 'ID3DXSprite'
1>          c:\program files (x86)\microsoft sdks\windows\v7.0a\include\d3dx9core.h(213) : see declaration of 'ID3DXSprite'
1>CGUI.cpp(134): error C2065: 'D3DXSPRITE_ALPHABLEND' : undeclared identifier
1>CGUI.cpp(135): error C2660: 'ID3DXSprite::Draw' : function does not take 5 arguments
1>  CETSCamera.cpp
1>CETSCamera.cpp(25): error C2440: '=' : cannot convert from 'ETSCamera' to 'ETSCamera *'
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
0

No, trzeba poprawić te błędy, żeby aplikacja się skompilowała.

Generalnie (po chwili googlowania) problem jest taki, że wziąłeś przykład, którzy korzysta ze starszej wersji API DirectX 9 niż masz w systemie.

0

Ogólnie to jestem zielony, jeśli mógłby mi ktoś wytłumaczyć jak to naprawić byłbym wdzięczny.

0

Naucz się pisać w C++, to będziesz w stanie naprawić kod.
Poza tym, póki nam go nie pokażesz nie usłyszysz innych odpowiedzi, niżeli "Musisz poprawić kod".

0

CChatbox.cpp

#include "StdInc.h"

extern CClient * g_pClient;

CChatbox::CChatbox(IDirect3DDevice9 *pD3DDevice)
{
	m_pD3DDevice = pD3DDevice;
	m_pCommand   = NULL;
	if(m_pD3DDevice)
	{
		D3DXCreateFont(m_pD3DDevice, 15, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "Arial", &m_Font );
	}

	for(int x = 0; x != 10; x++)
	////{
		//memset(szLine[x], 0, 256);
		m_pLines[x] = new SChatLine;
		memset(m_pLines[x]->szMessage, 0, 256);
	}

	szInputBuffer[0] = '\0';

	// Set default varibles.
	m_bShowed = true;
	m_bTypping = false;

	// Create command instance.
	m_pCommand = new CCommand();

	// Ustawianie domyślnej pozycji.
	RECT rect;
	GetWindowRect(g_pClient->GetGameWindow(), &rect);
	SetPosition(5.0f, (float)(rect.bottom-210.0f));
}

CChatbox::~CChatbox ()
{
	SAFE_DELETE(m_pCommand);

	for(int i = 0; i < 10; i ++)
	{
		SAFE_DELETE(m_pLines[i]);
	}
}

void CChatbox::DrawLine(int i, float fX, float fY)
{
	if(!m_pLines[i]) return;

	RECT rct = { 0 };
	if(m_pLines[i]->iType == TYPE_MESSAGE)
	{
		//Rysowanie wiadomości
		SetRect(&rct, (LONG)fX+1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 
	
		SetRect(&rct, (LONG)fX-1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY+1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY-1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, m_pLines[i]->dwColor); 
	} else if (m_pLines[i]->iType == TYPE_CHAT_MESSAGE) {
		SetRect(&rct, (LONG)fX+1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szNick, -1, &rct, DT_NOCLIP, 0xFF000000); 
	
		SetRect(&rct, (LONG)fX-1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szNick, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY+1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szNick, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY-1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szNick, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL,  m_pLines[i]->szNick, -1, &rct, DT_NOCLIP, ((m_pLines[i]->dwPlayerColor >> 8) | 0xFF000000)); 

		//Obliczanie długości nicku.
        RECT rPosition;
        m_Font->DrawText(NULL, m_pLines[i]->szNick, -1, &rPosition, DT_CALCRECT, 0xFF000000);
        float fDlugosc = (float)(rPosition.right - rPosition.left);

		fX += fDlugosc+3.0f;

		//Rysowanie wiadomości
		SetRect(&rct, (LONG)fX+1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 
	
		SetRect(&rct, (LONG)fX-1, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY+1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY-1, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, 0xFF000000); 

		SetRect(&rct, (LONG)fX, (LONG)fY, 0, 0);
		m_Font->DrawText(NULL, m_pLines[i]->szMessage, -1, &rct, DT_NOCLIP, m_pLines[i]->dwColor);
	}
}

void CChatbox::Render()
{
	if(m_bShowed && m_Font)
	{
		RECT rct = { 0 };
		
		float fX = m_fX;
		float fY = m_fY;

		//Rysowanie lini czatu.
		for( int i = 0; i < 10; i++ )
		{	
			DrawLine(i, fX, fY);
			fY += 18.0f;
		}

		if(m_bTypping)
		{
			// Add some pixels for input box.
			fY += 2.0f; 
			
			// Define input text.

			CString szType;
			szType.Format("%s%s_", SAY_PERFIX, szInputBuffer);

			// Add some for input label.
			//fY += 2.0f;

			// Draw input background.
			float fWidth = 700.0f, fHeight = 20.0f;
			float fPad = 2.0f;
			g_pClient->GetGraphic()->DrawRectangle(fX, fY, fWidth, fHeight, 0xF8000000);
			g_pClient->GetGraphic()->DrawRectangle(fX + (fPad), fY + (fPad), (fWidth - (fPad*2)), (fHeight - (fPad*2)), 0x3CC0C0C0);

			fX += 4.0f;
			fY += 1.0f;
			/* Draw input shadow.
			SetRect(&rct, (LONG)fX+1, (LONG)fY, (LONG)fX, 0);
			m_Font->DrawText(NULL, szType.Get(), -1, &rct, DT_NOCLIP, D3DCOLOR_ARGB(255, 0, 0, 0)); 

			// Draw input shadow.
			SetRect(&rct, (LONG)fX-1, (LONG)fY, (LONG)fX, 0);
			m_Font->DrawText(NULL, szType.Get(), -1, &rct, DT_NOCLIP, D3DCOLOR_ARGB(255, 0, 0, 0)); 

			// Draw input shadow.
			SetRect(&rct, (LONG)fX, (LONG)fY+1, (LONG)fX, 0);
			m_Font->DrawText(NULL, szType.Get(), -1, &rct, DT_NOCLIP, D3DCOLOR_ARGB(255, 0, 0, 0)); 

			// Draw input shadow.
			SetRect(&rct, (LONG)fX, (LONG)fY-1, (LONG)fX, 0);
			m_Font->DrawText(NULL, szType.Get(), -1, &rct, DT_NOCLIP, D3DCOLOR_ARGB(255, 0, 0, 0)); */

			// Draw input
			SetRect(&rct, (LONG)fX, (LONG)fY, (LONG)fX, 0);
			m_Font->DrawText(NULL, szType.Get(), -1, &rct, DT_NOCLIP, D3DCOLOR_ARGB(255, 255, 255, 255)); 
		}
	}
}

void CChatbox::OnLostDevice()
{
	if(m_Font)
		m_Font->OnLostDevice();		
}

void CChatbox::OnResetDevice()
{
	if(m_Font)
		m_Font->OnResetDevice();
}

void CChatbox::AddDebugMessage(const char* szString, ...)
{
	char szBuffer[2048];
	va_list v_Args;
	va_start(v_Args, szString);
	vsnprintf ( szBuffer, sizeof(szBuffer), szString, v_Args );
	va_end(v_Args);
	AddChatMessage(szBuffer, 0xC0C0C0FF);
}

void CChatbox::AddChatMessage(const char* szString, DWORD dwColor)
{
	dwColor = (dwColor >> 8) | 0xFF000000;

	for ( int i = 0; i < 9; i ++ )
	{
		m_pLines[i]->dwColor = m_pLines[i+1]->dwColor;
		m_pLines[i]->dwPlayerColor = m_pLines[i+1]->dwPlayerColor;
		m_pLines[i]->iType = m_pLines[i+1]->iType;
		strcpy(m_pLines[i]->szMessage, m_pLines[i+1]->szMessage);
		strcpy(m_pLines[i]->szNick, m_pLines[i+1]->szNick);
	}

	strcpy(m_pLines[9]->szMessage, szString);
	m_pLines[9]->dwColor = dwColor;
	m_pLines[9]->iType = TYPE_MESSAGE;

	CLog::Printf("(Chat) %s", szString);
}

void CChatbox::AddPlayerMessage(int iPlayerId, const char *szString)
{
	//dwColor = (dwColor >> 8) | 0xFF000000;

	for ( int i = 0; i < 9; i ++ )
	{
		m_pLines[i]->dwColor = m_pLines[i+1]->dwColor;
		m_pLines[i]->dwPlayerColor = m_pLines[i+1]->dwPlayerColor;
		m_pLines[i]->iType = m_pLines[i+1]->iType;
		strcpy(m_pLines[i]->szMessage, m_pLines[i+1]->szMessage);
		strcpy(m_pLines[i]->szNick, m_pLines[i+1]->szNick);
	}

	CPlayer *pPlayer = g_pClient->GetNetworkManager()->GetPlayerManager()->GetAt(iPlayerId);

	if(pPlayer)
	{
		strcpy(m_pLines[9]->szNick, CString("%s: ", pPlayer->GetName().Get()));
		m_pLines[9]->dwPlayerColor = pPlayer->GetColor();
	} else {
		strcpy(m_pLines[9]->szNick, CString("%s: ", g_pClient->GetNetworkManager()->GetPlayerManager()->GetLocalPlayer()->GetName().Get()));
		m_pLines[9]->dwPlayerColor = g_pClient->GetNetworkManager()->GetPlayerManager()->GetLocalPlayer()->GetColor();
	}

	strcpy(m_pLines[9]->szMessage, szString);
	m_pLines[9]->dwColor = 0xFFFFFFFF;
	m_pLines[9]->iType = TYPE_CHAT_MESSAGE;

	CLog::Printf("(Chat %d) %s: %s", iPlayerId, m_pLines[9]->szNick, szString);
}

void CChatbox::AddChar(unsigned char ucChar)
{
	if(!m_bTypping) return;
	if(ucChar < ' ') return;
	int iCurBufferLen = strlen(szInputBuffer);
	if(iCurBufferLen < MAX_INPUT) 
	{ 
		szInputBuffer[iCurBufferLen] = ucChar;
		szInputBuffer[iCurBufferLen+1] = '\0';
	}
}

void CChatbox::ProcessInput()
{
	if(IsTypping())
	{
		if(strlen(szInputBuffer) > 0)
		{
			if(szInputBuffer[0] == '/')
			{
				// Proces komendy do CCommand
				if ( !m_pCommand->ProcessCommand ( szInputBuffer ) )
				{
					if(g_pClient->GetNetworkManager()->IsConnected())
					{
						RakNet::BitStream bitStream;
						bitStream.Write(szInputBuffer, 256);
						g_pClient->GetNetworkManager()->Call("Player_Command", &bitStream, HIGH_PRIORITY,RELIABLE, 0, TRUE);
					}
				}
			} else {
				if(g_pClient->GetNetworkManager()->IsConnected())
				{
					RakNet::BitStream bitStream;
					bitStream.Write(szInputBuffer, 256);
					g_pClient->GetNetworkManager()->Call("Player_Chat", &bitStream, HIGH_PRIORITY,RELIABLE, 0, TRUE);				
				} else {
					AddDebugMessage("Nie jesteś podłaczony/podłączona do żadnego serwera!");
				}
			}
		}

		szInputBuffer[0] = '\0';
		Disable();
	}
}

void CChatbox::BackSpace()
{
	if(!IsTypping()) 
		return;

	int iCurBufferLen = strlen(szInputBuffer);
	if(iCurBufferLen > 0) {
		szInputBuffer[iCurBufferLen - 1] = '\0';
	}
}

void CChatbox::Disable()
{
	g_pClient->SetInputState(true);
	m_bTypping = false;
}

void CChatbox::Enable()
{
	m_iInputLines = 1;
	g_pClient->SetInputState(false);
	m_bTypping = true;
}
0

Zostały mi już tylko te errory:
1> CGraphic.cpp
1>CGraphic.cpp(200): error C3861: 'D3DXMatrixTransformation2D': identifier not found
1> CGUI.cpp
1>CGUI.cpp(128): error C3861: 'D3DXMatrixTransformation2D': identifier not found
1> CETSCamera.cpp
1>CETSCamera.cpp(25): error C2440: '=' : cannot convert from 'ETSCamera' to 'ETSCamera *'
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

CGraphic.cpp

void CGraphic::DrawRectangle ( float fX, float fY, float fWidth, float fHeight, unsigned long ulColor )
{
    m_pDXSprite->Begin(D3DXSPRITE_ALPHABLEND | D3DXSPRITE_SORT_TEXTURE);

    D3DXMATRIX matrix;
    D3DXMatrixTransformation2D(&matrix, NULL, 0.0f, &D3DXVECTOR2(fWidth, fHeight), NULL, 0.0f, &D3DXVECTOR2(fX, fY));

    m_pDXSprite->SetTransform(&matrix);
    m_pDXSprite->Draw(m_pDXPixelTexture, NULL, NULL, NULL, ulColor);
    m_pDXSprite->End();
}

CGUI.cpp

void CTexture::Draw ( )
{
	if ( m_bShowed )
	{
		D3DXVECTOR2 vTransformation = D3DXVECTOR2( m_fX, m_fY );

		D3DXVECTOR2 vScaling( ( 1.0f ), ( 1.0f ) );
		/*if(m_fWidth >= 0 && m_TexDesc.Width > 0) vScaling.x = vScaling.x*m_fWidth/m_TexDesc.Width;
		if(m_fHeight >= 0 && m_TexDesc.Height > 0) vScaling.y = vScaling.y*m_fHeight/m_TexDesc.Height;*/

		if(m_fWidth >= 0.0f && m_TexDesc.Width > 0) vScaling.x = vScaling.x*m_fWidth/m_TexDesc.Width;
		if(m_fHeight >= 0.0f && m_TexDesc.Height > 0) vScaling.y = vScaling.y*m_fHeight/m_TexDesc.Height;


		D3DXMATRIX mainMatrix;
	
		D3DXMatrixTransformation2D( &mainMatrix, 0, 0, &vScaling, 0, 0, &vTransformation );

		m_pSprite->SetTransform( &mainMatrix );

		DWORD dwColor = D3DCOLOR_ARGB ( m_iAlpha, 255, 255, 255 );

		m_pSprite->Begin( D3DXSPRITE_ALPHABLEND );
		m_pSprite->Draw( m_pTexture, 0, 0, 0, dwColor );
		m_pSprite->End();
	}
}

CETSCamera.cpp

m_camera = *(ETSCamera *)(0x614CA8);
0
  1. Znajdź plik w którym masz D3DXMatrixTransformation2D.
  2. Zamiast m_camera = *(ETSCamera *)(0x614CA8); to m_camera = (ETSCamera *)(0x614CA8);

1 użytkowników online, w tym zalogowanych: 0, gości: 1