本文整理汇总了C++中SpriteCache::set方法的典型用法代码示例。如果您正苦于以下问题:C++ SpriteCache::set方法的具体用法?C++ SpriteCache::set怎么用?C++ SpriteCache::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpriteCache
的用法示例。
在下文中一共展示了SpriteCache::set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_dynamic_sprite
void add_dynamic_sprite(int gotSlot, Bitmap *redin, bool hasAlpha) {
spriteset.set(gotSlot, redin);
game.spriteflags[gotSlot] = SPF_DYNAMICALLOC;
if (redin->GetColorDepth() > 8)
game.spriteflags[gotSlot] |= SPF_HICOLOR;
if (redin->GetColorDepth() > 16)
game.spriteflags[gotSlot] |= SPF_TRUECOLOR;
if (hasAlpha)
game.spriteflags[gotSlot] |= SPF_ALPHACHANNEL;
spritewidth[gotSlot] = redin->GetWidth();
spriteheight[gotSlot] = redin->GetHeight();
}
示例2: free_dynamic_sprite
void free_dynamic_sprite (int gotSlot) {
int tt;
if ((gotSlot < 0) || (gotSlot >= spriteset.elements))
quit("!FreeDynamicSprite: invalid slot number");
if ((game.spriteflags[gotSlot] & SPF_DYNAMICALLOC) == 0)
quitprintf("!DeleteSprite: Attempted to free static sprite %d that was not loaded by the script", gotSlot);
delete spriteset[gotSlot];
spriteset.set(gotSlot, NULL);
game.spriteflags[gotSlot] = 0;
spritewidth[gotSlot] = 0;
spriteheight[gotSlot] = 0;
// ensure it isn't still on any GUI buttons
for (tt = 0; tt < numguibuts; tt++) {
if (guibuts[tt].IsDeleted())
continue;
if (guibuts[tt].Image == gotSlot)
guibuts[tt].Image = 0;
if (guibuts[tt].CurrentImage == gotSlot)
guibuts[tt].CurrentImage = 0;
if (guibuts[tt].MouseOverImage == gotSlot)
guibuts[tt].MouseOverImage = 0;
if (guibuts[tt].PushedImage == gotSlot)
guibuts[tt].PushedImage = 0;
}
// force refresh of any object caches using the sprite
if (croom != NULL)
{
for (tt = 0; tt < croom->numobj; tt++)
{
if (objs[tt].num == gotSlot)
{
objs[tt].num = 0;
objcache[tt].sppic = -1;
}
else if (objcache[tt].sppic == gotSlot)
objcache[tt].sppic = -1;
}
}
}