mirror of https://github.com/axmolengine/axmol.git
issue #6: fixed compile error
This commit is contained in:
parent
b0f648bda7
commit
db2a75e2df
|
@ -24,8 +24,10 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "UIImage.h"
|
#include "UIImage.h"
|
||||||
|
|
||||||
|
#include <ImageToolKit/IT_ImageLoader.h>
|
||||||
#include <TG3.h>
|
#include <TG3.h>
|
||||||
|
|
||||||
|
using namespace ImageToolKit;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
UIImage::UIImage(void)
|
UIImage::UIImage(void)
|
||||||
|
@ -57,13 +59,17 @@ bool UIImage::initWithContentsOfFile(const string &strPath)
|
||||||
|
|
||||||
ImageLoader obImgLoader;
|
ImageLoader obImgLoader;
|
||||||
Image obImg;
|
Image obImg;
|
||||||
TUChar pszPath[strPath.size() + 1];
|
TUChar *pszPath = new TUChar[strPath.size() + 1];
|
||||||
TUString::StrGBToUnicode(pszPath, (const Char *) strPath.c_str());
|
TUString::StrGBToUnicode(pszPath, (const Char *) strPath.c_str());
|
||||||
|
bool bRet = false;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
// check if the loading action is successful
|
// check if the loading action is successful
|
||||||
if (! obImgLoader.loadImage(obImg, pszPath, IT_LOAD_FMT_UNKNOWN))
|
if (! obImgLoader.loadImage(obImg, pszPath, IT_LOAD_FMT_UNKNOWN))
|
||||||
{
|
{
|
||||||
return false;
|
bRet = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init bitmap
|
// init bitmap
|
||||||
|
@ -76,17 +82,22 @@ bool UIImage::initWithContentsOfFile(const string &strPath)
|
||||||
m_pBitmap->Destroy();
|
m_pBitmap->Destroy();
|
||||||
m_pBitmap = NULL;
|
m_pBitmap = NULL;
|
||||||
|
|
||||||
return false;
|
bRet = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pBitmap)
|
if (m_pBitmap)
|
||||||
{
|
{
|
||||||
return true;
|
bRet = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
bRet = false;
|
||||||
}
|
}
|
||||||
|
} while(0);
|
||||||
|
|
||||||
|
delete[] pszPath;
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int UIImage::width(void)
|
unsigned int UIImage::width(void)
|
||||||
|
|
Loading…
Reference in New Issue