I'm kind of a noob at this, I have an error and i -sort of- know what it means, but I have no idea how to fix it.

#include "Sprite.h"

int Sprite::LoadSprite(LPDIRECT3DDEVICE9 device, std::string Filename)
{
     dImageScale = 1.0; 

     D3DXIMAGE_INFO ImageInfo;
     D3DXGetImageInfoFromFile(Filename.c_str(), &ImageInfo);

     dImageHeight = ImageInfo.Height;
     dImageWidth = ImageInfo.Width;
}

Won't compile. It says:
error C2664: 'D3DXGetImageInfoFromFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'

Thanks

Recommended Answers

All 2 Replies

LPCWSTR is a wide string type, but std::string is a narrow string type. You need to decide which one you really want to use and either switch to std::wstring, or turn off Unicode for your application so that the Win32 functions don't use the wide versions.

it worked. thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.