本文整理汇总了C++中setDelay函数的典型用法代码示例。如果您正苦于以下问题:C++ setDelay函数的具体用法?C++ setDelay怎么用?C++ setDelay使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setDelay函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void Scene1000::Action1::signal() {
Scene1000 *scene = (Scene1000 *)_globals->_sceneManager._scene;
switch (_actionIndex++) {
case 0:
_globals->_player.disableControl();
setDelay(10);
break;
case 1:
scene->_object4.postInit();
scene->_object4.setVisage(1001);
scene->_object4._frame = 1;
scene->_object4.setStrip2(5);
scene->_object4.changeZoom(100);
scene->_object4.animate(ANIM_MODE_2, NULL);
scene->_object4.setPosition(Common::Point(403, 163));
setDelay(90);
break;
case 2: {
SceneItem::display(0, 0);
scene->_object4.remove();
scene->_object1.changeZoom(-1);
NpcMover *mover = new NpcMover();
Common::Point pt(180, 100);
scene->_object1.addMover(mover, &pt, this);
break;
}
case 3:
_globals->_sceneManager.changeScene(1400);
break;
}
}
示例2: handle2id
int AkmSensor::setEnable(int32_t handle, int enabled)
{
int id = handle2id(handle);
int err = 0;
char buffer[2];
switch (id) {
case Accelerometer:
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable_acc");
break;
case MagneticField:
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable_mag");
break;
case Orientation:
strcpy(&input_sysfs_path[input_sysfs_path_len], "enable_ori");
break;
default:
ALOGE("AkmSensor: unknown handle (%d)", handle);
return -EINVAL;
}
buffer[0] = '\0';
buffer[1] = '\0';
if (mEnabled[id] <= 0) {
if(enabled) buffer[0] = '1';
} else if (mEnabled[id] == 1) {
if(!enabled) buffer[0] = '0';
}
if (buffer[0] != '\0') {
err = write_sys_attribute(input_sysfs_path, buffer, 1);
if (err != 0) {
return err;
}
ALOGD("AkmSensor: set %s to %s",
&input_sysfs_path[input_sysfs_path_len], buffer);
/* for AKMD specification */
if (buffer[0] == '1') {
setDelay(handle, AKMD_DEFAULT_INTERVAL);
} else {
setDelay(handle, -1);
}
}
if (enabled) {
(mEnabled[id])++;
if (mEnabled[id] > 32767) mEnabled[id] = 32767;
} else {
(mEnabled[id])--;
if (mEnabled[id] < 0) mEnabled[id] = 0;
}
ALOGD("AkmSensor: mEnabled[%d] = %d", id, mEnabled[id]);
return err;
}
示例3: undrawArrow
void Board::getHint() {
int x1, y1, x2, y2;
History h[4];
if(getHint_I(x1, y1, x2, y2, h)) {
undrawArrow();
for(int i = 0; i < 4; i++)
history[i] = h[i];
int old_delay = getDelay();
setDelay(1000);
drawArrow(x1, y1, x2, y2);
setDelay(old_delay);
}
}
示例4: open
int Kxtf9Sensor::enable(int32_t handle, int en)
{
int err = 0;
int newState = en ? 1 : 0;
// don't set enable state if it's already valid
if(mEnabled == newState) {
return err;
}
// ok we need to set our enabled state
int fd = open(KXTF9_ENABLE_FILE, O_WRONLY);
if(fd >= 0) {
char buffer[20];
int bytes = sprintf(buffer, "%d\n", newState);
err = write(fd, buffer, bytes);
err = err < 0 ? -errno : 0;
} else {
err = -errno;
}
LOGE_IF(err < 0, "Error setting enable of kxtf9 accelerometer (%s)", strerror(-err));
if (!err) {
mEnabled = newState;
setDelay(0, 100000000); // 100ms by default for faster re-orienting
}
return err;
}
示例5: open_device
int SensorKXTF9::enable(int32_t handle, int en)
{
int err = 0;
int newState = en ? 1 : 0;
if(mEnabled == (unsigned)newState)
return err;
if (!mEnabled)
open_device();
err = ioctl(dev_fd, KXTF9_IOCTL_SET_ENABLE, &newState);
err = err < 0 ? -errno : 0;
LOGE_IF(err, "SensorKXTF9: KXTF9_IOCTL_SET_ENABLE failed (%s)", strerror(-err));
if (!err)
{
mEnabled = newState;
err = setDelay(handle, KXTF9_DEFAULT_DELAY);
}
if (!mEnabled)
close_device();
return err;
}
示例6: switch
void SpeakerPOR::SpeakerAction1::signal(){
switch (_actionIndex++) {
case 0:
setDelay(_globals->_randomSource.getRandomNumber(60) + 60);
break;
case 1:
static_cast<SceneObject *>(_owner)->animate(ANIM_MODE_5, this, NULL);
break;
case 2:
setDelay(_globals->_randomSource.getRandomNumber(10));
_actionIndex = 0;
break;
default:
break;
}
}
示例7: setSaveDir
// set default values
void Config::setDefaultSettings()
{
setSaveDir(getDirNameDefault());
setSaveFileName(DEF_SAVE_NAME);
setSaveFormat(DEF_SAVE_FORMAT);
setDefDelay(DEF_DELAY);
setImageQuality(DEF_IMG_QUALITY);
setDateTimeInFilename(DEF_DATETIME_FILENAME);
setDateTimeTpl(DEF_DATETIME_TPL);
setAutoCopyFilenameOnSaving(DEF_FILENAME_TO_CLB);
setAutoSave(DEF_AUTO_SAVE);
setAutoSaveFirst(DEF_AUTO_SAVE_FIRST);
setTrayMessages(DEF_TRAY_MESS_TYPE);
setIncludeCursor(DEF_INCLUDE_CURSOR);
setZoomAroundMouse(DEF_ZOOM_AROUND_MOUSE);
setCloseInTray(DEF_CLOSE_IN_TRAY);
setTimeTrayMess(DEF_TIME_TRAY_MESS);
setAllowMultipleInstance(DEF_ALLOW_COPIES);
// TODO - make set windows size without hardcode values
// setRestoredWndSize(DEF_WND_WIDTH, DEF_WND_HEIGHT);
setShowTrayIcon(DEF_SHOW_TRAY);
setEnableExtView(DEF_ENABLE_EXT_VIEWER);
_shortcuts->setDefaultSettings();
setNoDecoration(DEF_X11_NODECOR);
setDelay(DEF_DELAY);
quint8 countModules = Core::instance()->modules()->count();
for (int i = 0; i < countModules; ++i)
Core::instance()->modules()->getModule(i)->defaultSettings();
}
示例8: QWidget
Board::Board(QWidget *parent) : QWidget(parent) {
trying = FALSE;
_solvable_flag = TRUE;
// randomze
setShuffle(DEFAULTSHUFFLE);
clock_t t;
struct tms dummy;
t = times(&dummy);
srandom((int)t);
starttime = time((time_t *)0);
for(int i = 0; i < 45; i++)
pm_tile[i] = 0;
setDelay(DEFAULTDELAY);
_redo.setAutoDelete(TRUE);
_undo.setAutoDelete(TRUE);
loadTiles(1);
field = 0;
QPixmap bg((PICDIR + "/kshisen_bgnd.xpm").data());
setBackgroundPixmap(bg);
connect(this, SIGNAL(fieldClicked(int, int)),
this, SLOT(marked(int, int)));
connect(this, SIGNAL(madeMove(int, int, int, int)),
this, SLOT(slotMadeMove(int, int, int, int)));
setShuffle(0);
setSize(18, 8);
highlighted_tile = -1;
}
示例9: setDelay
bool CircuitElement::updateState(GameScripting* m_script, Map* map, INodeDefManager* ndef) {
MapNode node = map->getNodeNoEx(m_pos);
// Map not yet loaded
if(!node) {
dstream << "Circuit simulator: Waiting for map blocks loading..." << std::endl;
return false;
}
const ContentFeatures& node_features = ndef->get(node);
// Update delay (may be not synchronized)
u32 delay = node_features.circuit_element_delay;
if(delay != m_states_queue.size()) {
setDelay(delay);
}
m_states_queue.push_back(m_next_input_state);
m_next_input_state = m_states_queue.front();
m_states_queue.pop_front();
m_current_output_state = node_features.circuit_element_func[m_next_input_state];
if(m_next_input_state && !m_current_input_state && node_features.has_on_activate) {
m_script->node_on_activate(m_pos, node);
}
if(!m_next_input_state && m_current_input_state && node_features.has_on_deactivate) {
m_script->node_on_deactivate(m_pos, node);
}
m_prev_input_state = m_current_input_state;
m_current_input_state = m_next_input_state;
m_next_input_state = 0;
return true;
}
示例10: initQuickSwap
void initQuickSwap(void){
quickSwapMode = eeprom_read_byte((uint8_t *)EEPROM_QUICK_SWAP);
if(quickSwapMode == 0xFF) quickSwapMode = 0;
quickSwapCountMax = setDelay(QUICKSWAP_COUNT_MAX);
}
示例11: setDelay
void KTimerJob::load( KConfig *cfg, const QString& grp )
{
KConfigGroup groupcfg = cfg->group(grp);
setDelay( groupcfg.readEntry( "Delay", 100 ) );
setCommand( groupcfg.readPathEntry( "Command", QString() ) );
setLoop( groupcfg.readEntry( "Loop", false ) );
setOneInstance( groupcfg.readEntry( "OneInstance", d->oneInstance ) );
setState( (States)groupcfg.readEntry( "State", (int)Stopped ) );
}
示例12: setDelay
int SensorBase::batch(int handle, int flags, int64_t period_ns, int64_t timeout){
/*default , not support batch mode or SENSORS_BATCH_WAKE_UPON_FIFO_FULL */
if(timeout > 0 || flags & SENSORS_BATCH_WAKE_UPON_FIFO_FULL)
return -EINVAL;
if(!(flags & SENSORS_BATCH_DRY_RUN)){
setDelay(handle,period_ns);
}
return 0;
}
示例13: ALOGE
int PSHCommonSensor::batch(int handle, int flags, int64_t period_ns, int64_t timeout) {
int delay = period_ns / NS_TO_MS;
int ret = -EINVAL;
static int oldDataRate = -1;
static int oldBufferDelay = -1;
static streaming_flag oldFlag;
if (handle != device.getHandle()) {
ALOGE("%s: line: %d: %s handle not match! handle: %d required handle: %d",
__FUNCTION__, __LINE__, device.getName(), device.getHandle(), handle);
return -EINVAL;
}
if (period_ns < 0 || timeout < 0)
return -EINVAL;
if (timeout == 0) {
ret = setDelay(handle, period_ns);
bufferDelay = 0;
oldBufferDelay = 0;
return ret;
}
bufferDelay = timeout / NS_TO_MS;
ret = setDelay(handle, period_ns);
if (oldDataRate == -1) {
oldDataRate = state.getDataRate();
oldBufferDelay = bufferDelay;
oldFlag = flag;
return ret;
}
if (oldDataRate != state.getDataRate() || oldBufferDelay != bufferDelay || oldFlag != flag) {
oldDataRate = state.getDataRate();
oldBufferDelay = bufferDelay;
oldFlag = flag;
if (state.getActivated())
ret = hardwareSet(true);
}
return ret;
}
示例14: Timer
Timer::
Timer(double delay, double init)
{
int clockid = delay < 0.01 ? CLOCK_MONOTONIC : CLOCK_REALTIME;
fd_ = timerfd_create(clockid, TFD_NONBLOCK);
SLICK_CHECK_ERRNO(fd_ != -1, "timer.create");
setDelay(delay, init);
}
示例15: moveActor
void moveActor(character *actor, int vx, int vy) {
if (actor->delay) {
return;
}
actor->vx = vx;
actor->vy = vy;
setDelay(actor, getMovementCost(actor));
}