Example #1
0
bool loadAnyTexture(CMzString &filename, Texture* tex )
{
	TImage img;
	char strTexPath[_MAX_PATH];
	wcstombs(strTexPath, filename.C_Str(), _MAX_PATH);
	bool ret = false;

	if(img.LoadFromFile(strTexPath))
	{
		img.Bind2DTexture(tex->tex);
		ret = true;
	}
	tex->w = img.GetWidth() ;
	tex->h = img.GetHeight();
	return ret;
}
Example #2
0
bool CglWnd::setImageFromDC( HDC dc, int width /*= 480*/, int height /*= 720*/ )
{
	TImage img;
	CMzString strAppPath(_MAX_PATH);
	char strFilePath[_MAX_PATH];
	GetWorkPath(strAppPath.C_Str(), strAppPath.GetBufferSize());
	strAppPath += L"\\Data\\Last.jpg";
	wcstombs(strFilePath, strAppPath.C_Str(), _MAX_PATH);
	if (img.LoadFromDC(dc, 0, 0, width, height))
	{
		img.Bind2DTexture(texture[TEXID_BG]);
		img.SaveJPEG(strFilePath);
		m_imageFileName = strAppPath;
		return true;
	}
	return false;
}