D3DXCreateTextureFromFile() failing

Started by
2 comments, last by kubera 11 years, 10 months ago
Hey gamedev

I have a sprite locate at "C:\Users\Jyhe\Documents\Visual Studio 2010\Projects\2D test\2D test\Resources\Sprites\crosshair.png"

and I'm trying to load it with the following code:


D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory().c_str(), L"\\Resources\\Sprites\\crosshair.png"), &crosshair)


But it's failing to load the texture.

My GetDirectory function returns "C:\Users\Jyhe\Documents\Visual Studio 2010\Projects\2D test\2D test" and is as follows:



std::wstring GetDirectory()
{
return currentDir;
}


currentDir is defined as follow:


TCHAR currentDirectory[MAX_PATH + 1];
std::wstring currentDir;

... later on in code


GetCurrentDirectory(MAX_PATH + 1, currentDirectory);
currentDir = currentDirectory;


Any idea why this is failing?
The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky
Advertisement
Maybe you would write the code this way:


D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory() + L"\\Resources\\Sprites\\crosshair.png").c_str(), &crosshair)

Maybe you would write the code this way:


D3DXCreateTextureFromFile(rd3dDevice, (GetDirectory() + L"\\Resources\\Sprites\\crosshair.png").c_str(), &crosshair)



I feel stupid -__-

Thank you! :)
The majority of Internet Explorer users don't understand the concept of a browsing application, or that there are options.
They just see the big blue 'e' and think "Internet". The thought process usually does not get much deeper than that.

Worms are the weirdest and nicest creatures, and will one day prove themselves to the world.

I love the word Clicky
smile.png

This topic is closed to new replies.

Advertisement