当前位置: 首页>>代码示例>>C++>>正文


C++ Destination函数代码示例

本文整理汇总了C++中Destination函数的典型用法代码示例。如果您正苦于以下问题:C++ Destination函数的具体用法?C++ Destination怎么用?C++ Destination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Destination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Destination

double
AudioContext::CurrentTime() const
{
  MediaStream* stream = Destination()->Stream();
  return stream->StreamTimeToSeconds(stream->GetCurrentTime() +
                                     Destination()->ExtraCurrentTime());
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:7,代码来源:AudioContext.cpp

示例2: ofPushStyle

void MultiplesTangentes::draw()
{
    if(Dessinable())
    {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, Alpha() * 255);
        ofSetLineWidth(lineWidth());
        float distance(Tools::getDistance(*Origine(), *Destination()));
        float angle(Tools::getAngle(*Origine(), *Destination()));
        ofVec2f milieu(Origine()->getMiddle(*Destination()));
        tangente()->Origine(&milieu);
        tangente()->rayon(distance / 2.);
        tangente()->Dessinable(Dessinable());
        tangente()->Alpha(Alpha());
        tangente()->lineWidth(lineWidth());

        for(int i = 0; i < nombreDeTangentesMax(); i += _step)
        {
            tangente()->angle(angle * (1 + i / (float)nombreDeTangentesMax() * M_PI));
            tangente()->draw();
        }

        ofDisableAlphaBlending();
        ofPopStyle();
    }
}
开发者ID:PMO-Ecluse,项目名称:mallarmeGenerateur3D,代码行数:27,代码来源:MultiplesTangentes.cpp

示例3: Destination

MediaStream*
AudioContext::DestinationStream() const
{
  if (Destination()) {
    return Destination()->Stream();
  }
  return nullptr;
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:8,代码来源:AudioContext.cpp

示例4: Destination

void cMonster::InStateIdle(std::chrono::milliseconds a_Dt)
{
	if (m_IsFollowingPath)
	{
		return;  // Still getting there
	}

	m_IdleInterval += a_Dt;

	if (m_IdleInterval > std::chrono::seconds(1))
	{
		// At this interval the results are predictable
		int rem = m_World->GetTickRandomNumber(6) + 1;
		m_IdleInterval -= std::chrono::seconds(1);  // So nothing gets dropped when the server hangs for a few seconds

		Vector3d Dist;
		Dist.x = (double)m_World->GetTickRandomNumber(10) - 5;
		Dist.z = (double)m_World->GetTickRandomNumber(10) - 5;

		if ((Dist.SqrLength() > 2)  && (rem >= 3))
		{
			Vector3d Destination(GetPosX() + Dist.x, 0, GetPosZ() + Dist.z);
			Destination.y = FindFirstNonAirBlockPosition(Destination.x, Destination.z);
			MoveToPosition(Destination);
		}
	}
}
开发者ID:4264,项目名称:cuberite,代码行数:27,代码来源:Monster.cpp

示例5: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Resume(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  nsRefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed ||
      mCloseCalled) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Running) {
    promise->MaybeResolve(JS::UndefinedHandleValue);
    return promise.forget();
  }

  Destination()->Resume();

  mPromiseGripArray.AppendElement(promise);
  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
                                      AudioContextOperation::Resume, promise);

  return promise.forget();
}
开发者ID:Jinwoo-Song,项目名称:gecko-dev,代码行数:34,代码来源:AudioContext.cpp

示例6: Destination

void cMonster::InStateIdle(float a_Dt)
{
	if (m_bMovingToDestination)
	{
		return; // Still getting there
	}

	m_IdleInterval += a_Dt;

	if (m_IdleInterval > 1)
	{
		// At this interval the results are predictable
		int rem = m_World->GetTickRandomNumber(6) + 1;
		m_IdleInterval -= 1; // So nothing gets dropped when the server hangs for a few seconds

		Vector3d Dist;
		Dist.x = (double)m_World->GetTickRandomNumber(10) - 5;
		Dist.z = (double)m_World->GetTickRandomNumber(10) - 5;

		if ((Dist.SqrLength() > 2)  && (rem >= 3))
		{
			Vector3d Destination(GetPosX() + Dist.x, 0, GetPosZ() + Dist.z);

			int NextHeight = FindFirstNonAirBlockPosition(Destination.x, Destination.z);

			if (IsNextYPosReachable(NextHeight))
			{
				Destination.y = NextHeight;
				MoveToPosition(Destination);
			}
		}
	}
}
开发者ID:axisd,项目名称:MCServer,代码行数:33,代码来源:Monster.cpp

示例7: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Close(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  RefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed) {
    promise->MaybeResolve(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  if (Destination()) {
    Destination()->DestroyAudioChannelAgent();
  }

  mPromiseGripArray.AppendElement(promise);

  // This can be called when freeing a document, and the streams are dead at
  // this point, so we need extra null-checks.
  MediaStream* ds = DestinationStream();
  if (ds) {
    nsTArray<MediaStream*> streams;
    // If mSuspendCalled or mCloseCalled are true then we already suspended
    // all our streams, so don't suspend them again. But we still need to do
    // ApplyAudioContextOperation to ensure our new promise is resolved.
    if (!mSuspendCalled && !mCloseCalled) {
      streams = GetAllStreams();
    }
    Graph()->ApplyAudioContextOperation(ds->AsAudioNodeStream(), streams,
                                        AudioContextOperation::Close, promise);
  }
  mCloseCalled = true;

  return promise.forget();
}
开发者ID:subsevenx2001,项目名称:gecko-dev,代码行数:44,代码来源:AudioContext.cpp

示例8: ofPushStyle

void Perpendiculaire::draw()
{
    if(Dessinable())
    {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, Alpha() * 255);
        ofSetLineWidth(lineWidth());
        float angle(Tools::getAngle(*Origine(), *Destination()));
        ofVec2f AB(Destination()->x - Origine()->x, Destination()->y - Origine()->y);
        ofPushMatrix();
        ofTranslate(*Origine() + positionRelative * AB);
        ofRotateZ(angle);

        if(showSymbole)
        {
            float tailleSymbole(ofClamp(10 * lineWidth(), 15, 50));
            ofLine(0, tailleSymbole, tailleSymbole, tailleSymbole);
            ofLine(tailleSymbole, 0, tailleSymbole, tailleSymbole);
        }

        ofVec2f from(0, -ofGetHeight() * 2);
        ofVec2f to(0, ofGetHeight() * 2);

        if(typeTrace() == TRACE_POINTILLES)
        {
            SegmentDroite pointilles(ofxOscRouterBaseNode::getFirstOscNodeAlias() + "-segment", '@', &from, &to, TRACE_POINTILLES);
            pointilles.Alpha(Alpha());
            pointilles.Dessinable(Dessinable());
            pointilles.lineWidth(lineWidth());
            pointilles.offset(offset());
            pointilles.draw();
        }
        else
        {
            ofLine(from, to);
        }

        ofPopMatrix();
        ofDisableAlphaBlending();
        ofPopStyle();
    }
}
开发者ID:PMO-Ecluse,项目名称:mallarmeGenerateur3D,代码行数:43,代码来源:Perpendiculaire.cpp

示例9: _sopen_s

Log::LogFile::LogFile(const string& filename) {
  #ifdef _WIN32
  _sopen_s(&file_descriptor, filename.c_str(), _O_APPEND | _O_RDWR | _O_CREAT,
      _SH_DENYNO, _S_IREAD | _S_IWRITE);
  #else
    file_descriptor = open(filename.c_str(), O_APPEND | O_RDWR | O_CREAT,
      S_IRUSR | S_IWUSR);
  #endif
  file_log = Destination(new rlog::StdioNode(file_descriptor, DEFAULT_FLAGS));
}
开发者ID:dangweili,项目名称:ltr,代码行数:10,代码来源:rlog_default.cpp

示例10: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Close(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  nsRefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed) {
    promise->MaybeResolve(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  mCloseCalled = true;

  if (Destination()) {
    Destination()->DestroyAudioChannelAgent();
  }

  mPromiseGripArray.AppendElement(promise);

  // This can be called when freeing a document, and the streams are dead at
  // this point, so we need extra null-checks.
  MediaStream* ds = DestinationStream();
  if (ds) {
    Graph()->ApplyAudioContextOperation(ds->AsAudioNodeStream(),
                                        AudioContextOperation::Close, promise);

    if (ds) {
      ds->BlockStreamIfNeeded();
    }
  }
  return promise.forget();
}
开发者ID:rhelmer,项目名称:gecko-dev,代码行数:41,代码来源:AudioContext.cpp

示例11: GetNet7TickCount

void StaticMap::SendObjectEffects(Player *player)
{
    /*
    EffectList::iterator itrEList;
    ObjectEffect *effect;

    //this shouldn't do anything yet
    if (m_Effects)
    { 
        for (itrEList = m_Effects->begin(); itrEList < m_Effects->end(); ++itrEList) 
        {
            effect = (*itrEList);
            effect->TimeStamp = GetNet7TickCount();
            effect->GameID = GameID();
            effect->EffectID = m_ObjectMgr->GetAvailableSectorID();
            // Ignore the effect if the DescID is zero
            if (effect->EffectDescID > 0)
            {
                LogMessage("Sending effect for %s [%d]\n",Name(), effect->EffectDescID);
                connection->SendObjectEffect(effect);
            }
        }
    }*/

    if (ObjectType() == OT_STARGATE) //initial state of stargates - closed
    {
        if (player->FromSector() == Destination())
        {
            //if we came from this stargate it should be open to start off with            
            player->SendActivateNextRenderState(GameID(), 1);
        }
        else
        {
            player->SendActivateRenderState(GameID(), 1); //gate graphics activate
            player->SendActivateNextRenderState(GameID(), 3);
        }
    }
    else
    {
        // Send ActivateRenderState packet(s)
        long rs = RenderState();
        while (rs)
        {
            if (rs & 1)
            {
                player->SendActivateRenderState(GameID(), 1);
            }
            rs >>= 1;
        }
    }
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:51,代码来源:NavTypeClass.cpp

示例12: Destination

void cMonster::InStateIdle(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
{
	if (m_PathfinderActivated)
	{
		return;  // Still getting there
	}

	m_IdleInterval += a_Dt;

	if (m_IdleInterval > std::chrono::seconds(1))
	{
		// At this interval the results are predictable
		int rem = m_World->GetTickRandomNumber(6) + 1;
		m_IdleInterval -= std::chrono::seconds(1);  // So nothing gets dropped when the server hangs for a few seconds

		Vector3d Dist;
		Dist.x = static_cast<double>(m_World->GetTickRandomNumber(10)) - 5.0;
		Dist.z = static_cast<double>(m_World->GetTickRandomNumber(10)) - 5.0;

		if ((Dist.SqrLength() > 2)  && (rem >= 3))
		{

			Vector3d Destination(GetPosX() + Dist.x, GetPosition().y, GetPosZ() + Dist.z);

			cChunk * Chunk = a_Chunk.GetNeighborChunk(static_cast<int>(Destination.x), static_cast<int>(Destination.z));
			if ((Chunk == nullptr) || !Chunk->IsValid())
			{
				return;
			}

			BLOCKTYPE BlockType;
			NIBBLETYPE BlockMeta;
			int RelX = static_cast<int>(Destination.x) - Chunk->GetPosX() * cChunkDef::Width;
			int RelZ = static_cast<int>(Destination.z) - Chunk->GetPosZ() * cChunkDef::Width;
			int YBelowUs = static_cast<int>(Destination.y) - 1;
			if (YBelowUs >= 0)
			{
				Chunk->GetBlockTypeMeta(RelX, YBelowUs, RelZ, BlockType, BlockMeta);
				if (BlockType != E_BLOCK_STATIONARY_WATER)  // Idle mobs shouldn't enter water on purpose
				{
					MoveToPosition(Destination);
				}
			}
		}
	}
}
开发者ID:gjzskyland,项目名称:cuberite,代码行数:46,代码来源:Monster.cpp

示例13: do_QueryInterface

already_AddRefed<Promise>
AudioContext::Resume(ErrorResult& aRv)
{
  nsCOMPtr<nsIGlobalObject> parentObject = do_QueryInterface(GetParentObject());
  RefPtr<Promise> promise;
  promise = Promise::Create(parentObject, aRv);
  if (aRv.Failed()) {
    return nullptr;
  }

  if (mIsOffline) {
    promise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Closed ||
      mCloseCalled) {
    promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
    return promise.forget();
  }

  if (mAudioContextState == AudioContextState::Running) {
    promise->MaybeResolve(JS::UndefinedHandleValue);
    return promise.forget();
  }

  Destination()->Resume();

  nsTArray<MediaStream*> streams;
  // If mSuspendCalled is false then we already resumed all our streams,
  // so don't resume them again (since suspend(); resume(); resume(); should
  // be OK). But we still need to do ApplyAudioContextOperation
  // to ensure our new promise is resolved.
  if (mSuspendCalled) {
    streams = GetAllStreams();
  }
  mPromiseGripArray.AppendElement(promise);
  Graph()->ApplyAudioContextOperation(DestinationStream()->AsAudioNodeStream(),
                                      streams,
                                      AudioContextOperation::Resume, promise);

  mSuspendCalled = false;

  return promise.forget();
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:45,代码来源:AudioContext.cpp

示例14: findDirection

void Path::findPath(int x, int y)
{
	Destination *dest = Path::findNeighbors(x, y);
	Destination * current = &Destination(x, y, 0, 0);
	if (dest == NULL) {
		for (int i = 0; i < signed(destinations->size()); i++)
			destinations->at(i)->Print();
		std::cout << "Could not find location" << std::endl;
		return;
	}
	Direction direction;
	int distance = 0;
	for (int i = 0; i < 120; i++)
	{
		direction = findDirection(current->x, current->y, dest->x, dest->y);
		distance = findDistance(current->x, current->y, dest->x, dest->y);
		//const char *arr[] = {"Left", "Right", "Up", "Down"};
		//std::cout << "Going " << arr[direction] << "distance " << distance << std::endl;
		roadMap.push_back(new Destination(dest->x, dest->y, direction, distance * GRANULARITY));
		current = dest;
		int random = rand() % current->neighbors.size();
		dest = current->neighbors.at(random);
	}
}
开发者ID:deepc-6,项目名称:Cpp-SDL2-2D,代码行数:24,代码来源:Path.cpp

示例15: switch

//Called every time this StaticMap is targeted.
void StaticMap::OnTargeted(Player *player)
{
    player->BlankVerbs();

    float docking_range = DOCKING_RANGE;

    if (player->ShipIndex()->GetIsIncapacitated())
    {
        docking_range = -1.0f;
    }

    switch (ObjectType())
    {
    case OT_STATION:
		player->AddVerb(VERBID_DOCK, docking_range);
        player->AddVerb(VERBID_REGISTER, DOCKING_RANGE);
        break;

    case OT_STARGATE:
        if (Destination() > 0)
        {
			//check for faction.
			long faction_id = GetFactionID();
			bool class_specific = GetClassSpecific();

			if (player->GetOverrideFaction()) //allow devs and testers to override faction/class restrictions
			{
				player->AddVerb(VERBID_GATE, docking_range);
			}
			else if (class_specific)
			{
				if (faction_id == player->GetFactionID() || faction_id < 1)
				{
					player->AddVerb(VERBID_GATE, docking_range);
				}
			}
			else if (faction_id > 0)
			{
				if (player->GetFactionStanding(this) >= 0.0f) //allow gate travel if faction is greater than zero
				{
					player->AddVerb(VERBID_GATE, docking_range);
				}
			}
			else
			{
				player->AddVerb(VERBID_GATE, docking_range);
			}
        }
		break;

    case OT_PLANET:
        if (Destination() > 0)
        {
            player->AddVerb(VERBID_LAND, docking_range);
        }
        break;
        
    default:
        break;
    };
}
开发者ID:RavenB,项目名称:Earth-and-Beyond-server,代码行数:62,代码来源:NavTypeClass.cpp


注:本文中的Destination函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。