本文整理汇总了C++中ImageList::GetFromIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageList::GetFromIndex方法的具体用法?C++ ImageList::GetFromIndex怎么用?C++ ImageList::GetFromIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageList
的用法示例。
在下文中一共展示了ImageList::GetFromIndex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Validate
void Validate() override
{
if (Validated) return;
Layer0 = std::make_shared<Sprite>();
LayerMiss = std::make_shared<Sprite>();
Layer1 = std::make_shared<Sprite>();
Layer2 = std::make_shared<Sprite>();
Layer0->ChainTransformation(&Transform);
LayerMiss->ChainTransformation(&Transform);
Layer1->ChainTransformation(&Transform);
Layer2->ChainTransformation(&Transform);
Layer0->SetZ(0);
Layer1->SetZ(0);
LayerMiss->SetZ(0);
Layer2->SetZ(0);
Layer1->BlackToTransparent = Layer2->BlackToTransparent = BlackToTransparent;
LayerMiss->SetImage(List.GetFromIndex(0), false);
Layer0->SetImage(List.GetFromIndex(1), false);
sort(EventsLayer0.begin(), EventsLayer0.end());
sort(EventsLayerMiss.begin(), EventsLayerMiss.end());
sort(EventsLayer1.begin(), EventsLayer1.end());
sort(EventsLayer2.begin(), EventsLayer2.end());
// Add BMP 0 as default value for layer 0. I was opting for a
// if() at SetLayerImage time, but we're microoptimizing for branch mishits.
if (EventsLayerMiss.size() == 0 || (EventsLayerMiss.size() > 0 && EventsLayerMiss[0].Time > 0))
{
AutoplayBMP bmp;
bmp.Time = 0;
bmp.BMP = 0;
EventsLayerMiss.push_back(bmp);
}
Transform.SetWidth(256);
Transform.SetHeight(256);
Validated = true;
}
示例2: SetLayerImage
void SetLayerImage(Sprite *sprite, std::vector<AutoplayBMP> &events_layer, double time)
{
auto bmp = std::lower_bound(events_layer.begin(), events_layer.end(), time);
if (bmp != events_layer.begin())
{
bmp = bmp - 1;
sprite->SetImage(List.GetFromIndex(bmp->BMP), false);
}
else
{
//if (bmp != events_layer.end())
// sprite->SetImage(List.GetFromIndex(bmp->BMP), false);
//else
sprite->SetImage(nullptr, false);
}
}
示例3: DoBMPEventList
void DoBMPEventList (GraphObject2D &Obj, std::vector<AutoplayBMP> &Events, ImageList &Images, double SongTime)
{
for (std::vector<AutoplayBMP>::iterator b = Events.begin();
b != Events.end();
b++)
{
if (b->Time <= SongTime)
{
Image* Img = Images.GetFromIndex(b->BMP);
if (Img != NULL)
Obj.SetImage(Img, false);
b = Events.erase(b);
if (b == Events.end()) break;
}
}
}