本文整理汇总了C++中Any::toInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Any::toInt方法的具体用法?C++ Any::toInt怎么用?C++ Any::toInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Any
的用法示例。
在下文中一共展示了Any::toInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: commandPlaySound
void SoundInterface::commandPlaySound(void) {
int32_t freg = cb->popValue().toInt();
float balance = cb->popValue().toFloat();
float volume = cb->popValue().toFloat();
Any any = cb->popValue();
// If passed parameter is integer, the sound is preloaded. Otherwise load it.
if (any.type() == Any::Int) {
CBChannel* channel = new CBChannel;
channel->setMixer(al_get_default_mixer());
int32_t id = any.toInt();
channel->playSound((*sounds[id]), volume, balance, freg);
int32_t nextChannel = nextChannelId();
channels[nextChannel] = channel;
}
else {
CBChannel* channel = new CBChannel;
channel->setMixer(al_get_default_mixer());
ALLEGRO_PATH *path = any.toString().getPath();
const char *cpath = al_path_cstr(path, ALLEGRO_NATIVE_PATH_SEP);
channel->playSound(cpath, volume, balance, freg);
int32_t nextChannel = nextChannelId();
channels[nextChannel] = channel;
}
}
示例2: sar
int32_t Any::sar (const Any &l, const Any &r) {
return l.toInt() >> r.toInt();
}