本文整理汇总了C++中ImageResource::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageResource::setName方法的具体用法?C++ ImageResource::setName怎么用?C++ ImageResource::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageResource
的用法示例。
在下文中一共展示了ImageResource::setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensureSkin
void Environment::ensureSkin()
{
if (mResources && mElements) {
return;
}
// we're missing resources or elements. That is equivalent to a missing skin.
// use our internal generated skin in that case.
if (mResources) {
delete mResources;
}
if (mElements) {
delete mElements;
}
// generate our own resources.
mResources = new Resources();
mElements = new Elements();
SDL_Surface *t = SDL_CreateRGBSurface(SDL_HWSURFACE, SCREEN_WIDTH, SCREEN_HEIGHT,32,mScreen->format->Rmask, mScreen->format->Gmask, mScreen->format->Bmask, 0);
SDL_FillRect(t, 0, 0);
ImageResource *f = new ImageResource();
f->setName("Background");
f->setImage(t);
mResources->addResource(f);
Element *e = new Element();
e->setContent(CONTENT_MENU);
SDL_Rect r;
r.x = 70;
r.y = 60;
r.h = 420;
r.w = 500;
e->setDimensions(r);
SDL_Color c;
c.r = 250;
c.g = 250;
c.b = 250;
e->setColor(c);
e->setLayer(1);
e->setSkinID("");
// set the loaded font to e.
mElements->addElement(e);
e = new Element();
e->setContent(CONTENT_BACKGROUND_IMAGE);
e->setLayer(1);
e->setResourceName("Background");
e->setSkinID("");
r.x = 0;
r.y = 0;
r.h = 480;
r.w = 640;
e->setDimensions(r);
mElements->addElement(e);
e = new Element();
e->setContent(CONTENT_MENUENTRY_BG);
e->setLayer(1);
e->setResourceName("Background");
e->setSkinID("");
mElements->addElement(e);
e = new Element();
e->setContent(CONTENT_MENUENTRY_SELECTED_BG);
e->setLayer(1);
e->setResourceName("Background");
e->setSkinID("");
mElements->addElement(e);
}