I recently started reading Beginning DirectX 10 Game Programming written by Wendy Jones, and I'm about 60 pages in on the chapter about sprites, and I feel like I haven't learned anything, half the code they throw at me I can hardly decipher, and even if I do that, how am I supposed to remember it all? I feel like all I'm doing is copy-pasting without learning anything.

P.S. I only have some basic C++ knowledge.

[QUOTE=emilo35;1358277]Well, if I'm not mistaken, it looks like you define i.e your constructor as
[ICODE]
TileClass::TileClass()
[/ICODE]
in your .h file, but in your .cpp file it looks like you're trying to implements
[ICODE]
Main::TileClass::TileClass()
[/ICODE]
Which you haven't defined anywhere. Take a look at your main() function and its brackets. The main() function should be on its own, like
[CODE=C++]
// Implementations first
TileClass::TileClass()
{
// Initialize internal vars
m_iNumLayers = 0;
m_iValue = NULL;
m_fRotX = NULL;
m_fSize = NULL;
}

int main()
{
// Some fancy stuff here
return 0;
}
[/CODE]

Or, if you have a class called Main (?) also check its brackets.

I hope this helps!
Emil Olofsson[/QUOTE]

I love you, in a totally gay way, but in all seriousness, thank you.

So I have this problem, I have just started learning DirectX 9 with the Strategy Game Programming with DirectX 9.0 book, I have a header including this code: [CODE]class TileClass
{
private:
intm_iValue;
int m_iNumLayers;
float
m_fRotX;
float *m_fSize;

public:
TileClass();
~TileClass();
int iGetValue(int layer);
void vSetValue(int value, int layer);
float fGetRot(int layer);
void vSetRotation(float fRot, int layer);
float fGetSize(int layer);
void vSetSize(float fSize, int layer);
void vSetNumLayers(int layers);
};[/CODE]

And I'm including the header in my .CPP file, I have also included this code as the book told me to: [CODE]// Constructor
TileClass::TileClass()
{
// Initialize internal vars
m_iNumLayers = 0;
m_iValue = NULL;
m_fRotX = NULL;
m_fSize = NULL;
}
// Destructor
TileClass::~TileClass()
{
// Free layer buffer if already allocated
if(m_iValue)
delete [] m_iValue;
if(mfRotX)
delete [] m
fRotX;
if(mfSize)
delete [] m
fSize;
}
// Set number of layers
void TileClass::vSetNumLayers(int layers)
{
// Free layer buffer if already allocated
if(m_iValue)
delete [] m_iValue;
if(m_fRotX)
delete [] m_fRotX;
if(m_fSize)
delete [] m_fSize;
// Allocate memory for layer buffer
m_iValue = new int[layers];
memset(m_iValue,0,layers*sizeof(int));

m_fRotX = new float[layers];
memset(m_fRotX,0,layers*sizeof(int));

m_fSize = new float[layers];
memset(m_fSize,0,layers*sizeof(int));

// Set the number of layers
m_iNumLayers = layers;
}
// Get value of the tile
int TileClass::iGetValue(int layer)
{
// Make sure not trying to retrieve illegal layer
if(layer >= m_iNumLayers) {
return(-1);
}
// Return the value
return(m_iValue[layer]);
}
// Set the tile's value
void TileClass::vSetValue(int value, int layer)
{
// Make sure not trying to use an illegal layer
if(layer ...

I've been learning C++ for about 4-5 months so I know the basics of C++ just fine.
I've already made 2 hacks but I don't understand the missing function error.

When I remove the semicolon I get these errors:

[CODE]1>BrokezOP7+Chams.cpp
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(30) : error C2143: syntax error : missing ';' before 'const'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(30) : error C2143: syntax error : missing ';' before 'const'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(31) : error C2143: syntax error : missing ';' before '{'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(39) : error C2143: syntax error : missing ';' before '}'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2065: 'LPDIRECT3DTEXTURE8' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2146: syntax error : missing ';' before identifier 'texRed'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(41) : error C2065: 'texRed' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2065: 'LPDIRECT3DTEXTURE8' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2146: syntax error : missing ';' before identifier 'texYellow'
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(42) : error C2065: 'texYellow' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(46) : error C2653: 'hkIDirect3DDevice8' : is not a class or namespace name
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(47) : error C2601: 'BeginScene' : local function definitions are illegal
1> c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(16): this line contains a '{' which has not yet been matched
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C2065: 'D3DPRIMITIV' : undeclared identifier
1>c:\documents and settings\collin inman\my documents\visual studio 2008\projects\brokezop7+chams\brokezop7+chams\brokezop7+chams.cpp(59) : error C2146: syntax ...

Hello, I've been having this error come up whenever I try to compile this code:

[CODE]#include "stdafx.h"

include "Strides.h"

int m_Stride;

bool chams = true;
bool onetime = true;

int main();
{

if (chams)
{

        const BYTE bRed[60] = //red
        {
        0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
        0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
        0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0xFF, 0x00, 0x00, 0x50
        }

        const BYTE bGold[60] = //yellow
        {
        0x42, 0x4D, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x36, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
        0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
        0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0x00, 0x12, 0x0B, 0x00, 0x00, 0x12, 0x0B, 0x00,
        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        0x00, 0xFF, 0xFF, 0x00, 0x00, 0x01
        }

        LPDIRECT3DTEXTURE8 texRed; //texture
        LPDIRECT3DTEXTURE8 texYellow; //texture

        HRESULT APIENTRY hkIDirect3DDevice8::BeginScene(void)
        {
            if(onetime)
            {
                    //create our textures
                    onetime = false;
                    D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bRed,60,&texRed) ;
                    D3DXCreateTextureFromFileInMemory(m_pD3Ddev,(LPCVO ID)&bGold,60,&texYellow);

            }
        return m_pD3Ddev->BeginScene();
        }

hkIDirect3DDevice8:DrawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
if(m_Stride == 36)
{
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
m_pD3Ddev->SetTexture(0, texRed);
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
m_pD3Ddev->SetTexture(0, texYellow);
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);

HRESULT APIENTRY hkIDirect3DDevice8:rawIndexedPrimitive(D3DPRIMITIV ETYPE PrimitiveType,UINT minIndex,UINT NumVertices,UINT startIndex,UINT primCount)
{
if(m_Stride == 32)
{
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, false);
m_pD3Ddev->SetTexture(0, texRed);
m_pD3Ddev->SetRenderState(D3DRS_LIGHTING,false);
m_pD3Ddev->DrawIndexedPrimitive(PrimitiveType, minIndex, NumVertices, startIndex, primCount);
m_pD3Ddev->SetRenderState(D3DRS_ZENABLE, true);
m_pD3Ddev->SetTexture(0, texYellow); ...