本文整理汇总了C++中CGUI::CreateGUIStaticImage方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUI::CreateGUIStaticImage方法的具体用法?C++ CGUI::CreateGUIStaticImage怎么用?C++ CGUI::CreateGUIStaticImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUI
的用法示例。
在下文中一共展示了CGUI::CreateGUIStaticImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ftell
// GUIImage
_MEMBER_FUNCTION_IMPL(GUIImage, constructor)
{
const char * filename;
sq_getstring(pVM, -1, &filename);
// check file size
/*FILE* pFile = fopen(filename, "rb");
fseek(pFile, 0L, SEEK_END);
int len = ftell(pFile);
if(len == 0) {
sq_pushbool(pVM, false);
fclose(pFile);
return 1;
}
fclose(pFile);*/
// Get our GUI
CGUI * pGUI = g_pClient->GetGUI();
String szName = pGUI->GetUniqueName();
// Try to load the image
try
{
CEGUI::ImagesetManager::getSingleton().createFromImageFile(szName.C_String(), filename, "resources");
CGUIStaticImage * pImage = pGUI->CreateGUIStaticImage(CEGUI::String(szName.C_String()));
pImage->setProperty("FrameEnabled", "false");
pImage->setProperty("BackgroundEnabled", "false");
pImage->setProperty("Image", String("set:%s image:full_image", szName.C_String()).C_String());
if(!pImage || SQ_FAILED(sq_setinstance(pVM, pImage)))
{
CLogFile::Printf("Can't create GUIImage.");
sq_pushbool(pVM, false);
return 1;
}
//_SET_RELEASE_HOOK(GUIElement);
CClientScriptManager * pClientScriptManager = g_pClient->GetClientScriptManager();
pClientScriptManager->GetGUIManager()->Add(pImage, pClientScriptManager->GetScriptingManager()->Get(pVM));
SubscribeGuiEvents(pImage);
pImage->setVisible(true);
sq_pushbool(pVM, true);
return 1;
}
catch(CEGUI::Exception e)
{
// Failed to load, might not exist
CLogFile::Printf("Can't create GUIImage (%s does not exist)", filename);
sq_pushbool(pVM, false);
return 1;
}
}