Esempio n. 1
0
void MainMenuScene::editBoxEditingDidEnd(EditBox * editBox)
{
	if (!setNumPlayers(editBox->getText()))
	{
		CCLog("input incorrect, setting number of players to default.");
		setNumPlayersToDefault();
	}
}
Esempio n. 2
0
void CTournament::tick(long now)
{
  // Do once per two tics
  flipFlop_ = !flipFlop_;
  if (!flipFlop_) return;
  
  if (state_)
    state_->tick(now);
  else
  {
    if (startTime_ > now)
    {
      state_ = new CWaitStartState(this);
      setNumPlayers(0);
    }
  }
}
Esempio n. 3
0
PlayerTracker::PlayerTracker(Sensor *sensor)
{
    this->depthThreashold = 0.1f;
    this->armSize = 0.2f;
    this->minSize = 0.2f;
    this->sensor = sensor;
    this->sensor->setNearClip(0);
    this->sensor->setFarClip(1);
    this->debugWindow = new DebugWindow(this);
    this->debugWindow->show();

    setNumPlayers(1);

    depthImage = QImage(sensor->getDepthImage().size(), sensor->getDepthImage().format());
    binaryDepth = QImage(sensor->getDepthImage().size(), sensor->getDepthImage().format());
    playerDebugView = QImage(300, 300, QImage::Format_ARGB32);

    syncUi();
}
Esempio n. 4
0
/** Constructs the race manager.
 */
RaceManager::RaceManager()
{
    // Several code depends on this, e.g. kart_properties
    assert(DIFFICULTY_FIRST == 0);
    m_num_karts          = UserConfigParams::m_num_karts;
    m_difficulty         = DIFFICULTY_HARD;
    m_major_mode         = MAJOR_MODE_SINGLE;
    m_minor_mode         = MINOR_MODE_NORMAL_RACE;
    m_ai_superpower      = SUPERPOWER_NONE;
    m_track_number       = 0;
    m_coin_target        = 0;
    m_started_from_overworld = false;
    m_have_kart_last_position_on_overworld = false;
    setMaxGoal(0);
    setTimeTarget(0.0f);
    setReverseTrack(false);
    setRecordRace(false);
    setRaceGhostKarts(false);
    setWatchingReplay(false);
    setTrack("jungle");
    m_default_ai_list.clear();
    setNumPlayers(0);
}   // RaceManager
Esempio n. 5
0
/** Receive and store the information from sendKartsInformation()
*/
void RaceManager::setupPlayerKartInfo()
{

    std::vector<RemoteKartInfo> kart_info;

    // Get the local kart info
    for(unsigned int i=0; i<getNumLocalPlayers(); i++)
        kart_info.push_back(getLocalKartInfo(i));

    // Now sort by (hostid, playerid)
    std::sort(kart_info.begin(), kart_info.end());

    // Set the player kart information
    setNumPlayers(kart_info.size());

    // Set the global player ID for each player
    for(unsigned int i=0; i<kart_info.size(); i++)
    {
        kart_info[i].setGlobalPlayerId(i);
        setPlayerKart(i, kart_info[i]);
    }

    computeRandomKartList();
}   // setupPlayerKartInfo