最近在学习C++的Easyx,想要用它写一点游戏
在loadimage这里遇到了一些问题
这个是Visual Studio提供的loadimage伪代码:
// Image related functions
void loadimage(IMAGE *pDstImg, LPCTSTR pImgFile, int nWidth = 0, int nHeight = 0, bool bResize = false); // Load image from a file (bmp/gif/jpg/png/tif/emf/wmf/ico)
void loadimage(IMAGE *pDstImg, LPCTSTR pResType, LPCTSTR pResName, int nWidth = 0, int nHeight = 0, bool bResize = false); // Load image from resources (bmp/gif/jpg/png/tif/emf/wmf/ico)
这样子写不会报错:
IMAGE img;
loadimage(&img, _T("./resources/myplane1.png"), player->pic_w, player->pic_h);
这样子用字符串与字符串拼接的方法会报错
IMAGE img;
loadimage(&img, _T("."+"/resources/myplane1.png"), player->pic_w, player->pic_h);
报错:
包含字符串变量时也会出错
IMAGE img;
string p = "ac";
loadimage(&img, _T(p+"./resources/myplane1.png"), player->pic_w, player->pic_h);
报错: