//From starting point, search for entrance void MazeNav::searchInitEntrance() { scanWalls(); if (isWall(FRONT)) { #ifdef DEBUG Serial.println("Front wall found."); #endif #ifndef SIMULATION mover->rotateDirection(RIGHT, DEFAULT_SPEED); #endif facing = NORTH; scanWalls(); while (isWall(LEFT)) { #ifdef DEBUG Serial.println("Searching for entrance."); #endif #ifndef SIMULATION motors->both(DEFAULT_SPEED, mover->tickError()); #endif scanWalls(); } #ifdef DEBUG Serial.println("Found entrance."); #endif #ifndef SIMULATION mover->moveLength(WALL_MIN_HALF, DEFAULT_SPEED); motors->stop(); updateTicks(); mazeMap.updateMap(LEFT, eastTicks, northTicks); mover->rotateDirection(LEFT, DEFAULT_SPEED); facing = WEST; #endif } else { updateTicks(); mazeMap.updateMap(LEFT, eastTicks, northTicks); #ifdef DEBUG Serial.println("Found entrance."); #endif } #ifndef SIMULATION mover->moveLength(WALL_MIN_HALF, DEFAULT_SPEED); motors->stop(); #endif #ifdef DEBUG Serial.println("Entered maze"); #endif }
bool onEvent( Event& ev ) { switch (ev.code) { case Event::SELECT: switch(ev.x) { case 0: m_game->m_strokeFixed = !m_game->m_strokeFixed; m_game->m_strokeSleep = false; m_game->m_strokeDecor = false; break; case 1: m_game->m_strokeFixed = false; m_game->m_strokeSleep = !m_game->m_strokeSleep; m_game->m_strokeDecor = false; break; case 2: m_game->m_strokeFixed = false; m_game->m_strokeSleep = false; m_game->m_strokeDecor = !m_game->m_strokeDecor; break; case 3: m_game->clickMode((m_game->m_clickMode==1)?0:1); break; case 4: m_game->clickMode((m_game->m_clickMode==2)?0:2); break; default: return MenuDialog::onEvent(ev); } updateTicks(); return true; default: return MenuDialog::onEvent(ev); } }
/*! * 実行関数 * @retval デルタタイムの関係で処理を打ち切った場合はfalse */ bool Snd::exec(){ // Ticksの更新 if (updateTicks()); else return false; // waveが不正ならこれ以上処理しない if(srcVoice_); else return true; // 再生中フラグの更新 if(callback_->isStreamEnd()){ isPlaying_ = false; stop(0.f); callback_->resetStreamEnd(); } // waveが再生中でなければこれ以上処理しない if(isPlaying_); else return true; // ボリューム情報の変更 updateVolume(); // 停止の処理 if (isStopping_ && volInfo_.vol <= 0.f){ isPlaying_ = false; isStopping_ = false; srcVoice_->Stop(); } return true; }
//Navigate and map maze from starting point void MazeNav::firstNavigate() { RelDir turn; facing = WEST; eastTicks = MAX_EAST_TICKS; northTicks = 0; searchInitEntrance(); while (1) //TODO: Need exit condition { while (!nextPosition()); #ifdef SIMULATION if (irInMm.frnt <= 0) break; #endif turn = alwaysLeft(); #ifdef DEBUG Serial.print("Turn: "); Serial.println((char)turn); #endif facing = findNewFacing(facing, turn); updateTicks(); mazeMap.updateMap(turn, eastTicks, northTicks); #ifndef SIMULATION mover->rotateDirection(turn, DEFAULT_SPEED); #endif } #ifdef DEBUG Serial.println("MazeMap: "); mazeMap.printMapTurns(); Serial.println(); #endif }
void genPrint(const char * mesg) { if(!log_mutex /* || !SDL_WasInit(0)*/) return; updateTicks(); SDL_LockMutex(log_mutex); printf("%s: %s", log_ticks, mesg); SDL_UnlockMutex(log_mutex); }
ToolDialog(GameControl* game) : MenuDialog(this, "tools",NULL), m_game(game) { addItems( toolOpts ); updateTicks(); }
void Timer::updateSeconds(double _secs) { updateTicks(Clock::secondsToTicks(_secs)); }
void ElevationProfilePlotAxis::update() { updateTicks(); updateScale(); }