Visual Studio Resources

Hello!

I recently wanted to move my project to Visual Studio (since it’s my fav IDE) but I get errors running the exact same game in VS2013. I previously used XCode and everything works there perfectly now I changed to Visual Studio and the game crashes right at the beginning when loading the .ccbi files. I get an assert error, my guess is that the resources are not visible for the compiler since I tried to create a simple Sprite* test = Sprite::create(“test.png”); and I get NULL.

My question now is: Where or how should I put the “Resource” folder so that VS2013 sees my resources? At the moment i copied the Resource folder to the place where the .exe is (proj.win32 -> Debug.win32) but this did not help, I also added the files in the solution manager to the resource folder… but also no effect… HELP! :frowning:

EDIT: I know there is a path in the Properties -> Configuration Properties -> Debugging:

$(ProjectDir)..\Resources

But still I get NULLs :confused:

Try creating new project to check VS settings there.
To launch exe without VS you need to have it inside \Resources folder

I had a similar thing, not sure if it is the same problem you have.
I changed CCFileUtils-win32.cpp to this…

static void _checkPath()
{
    if (0 == s_resourcePath.length())
    {
#if 0
        WCHAR *pUtf16ExePath = nullptr;
        _get_wpgmptr(&pUtf16ExePath);

        // We need only directory part without exe
        WCHAR *pUtf16DirEnd = wcsrchr(pUtf16ExePath, L'\\');

        char utf8ExeDir[CC_MAX_PATH] = { 0 };
        int nNum = WideCharToMultiByte(CP_UTF8, 0, pUtf16ExePath, pUtf16DirEnd-pUtf16ExePath+1, utf8ExeDir, sizeof(utf8ExeDir), nullptr, nullptr);

        s_resourcePath = convertPathFormatToUnixStyle(utf8ExeDir);
#else
		// Use current directory as default path
		WCHAR utf16Path[CC_MAX_PATH] = { 0 };
		GetCurrentDirectoryW(sizeof(utf16Path) - 1, utf16Path);

		char utf8Path[CC_MAX_PATH] = { 0 };
		int nNum = WideCharToMultiByte(CP_UTF8, 0, utf16Path, -1, utf8Path, sizeof(utf8Path), nullptr, nullptr);
		s_resourcePath = convertPathFormatToUnixStyle(utf8Path);
		s_resourcePath.append("/");
#endif
    }
}