Пример #1
0
bool DisplayRefreshMonitorMac::requestRefreshCallback()
{
    if (!isActive())
        return false;

    if (!m_displayLink) {
        setIsActive(false);
        CVReturn error = CVDisplayLinkCreateWithCGDisplay(displayID(), &m_displayLink);
        if (error)
            return false;

        error = CVDisplayLinkSetOutputCallback(m_displayLink, displayLinkCallback, this);
        if (error)
            return false;

        error = CVDisplayLinkStart(m_displayLink);
        if (error)
            return false;

        setIsActive(true);
    }

    LockHolder lock(mutex());
    setIsScheduled(true);
    return true;
}
Пример #2
0
	WorkGhostBody::WorkGhostBody(const std::string &id, const PhysicsTransform &physicsTransform, const std::shared_ptr<const CollisionShape3D> &shape) :
			AbstractWorkBody(id, physicsTransform, shape),
			pairContainer(new VectorPairContainer())
	{
		setIsStatic(false); //can move and be affected by the physics world: not a static body
		setIsActive(false); //default value: body is not active
	}
Пример #3
0
nsPerformanceGroup::nsPerformanceGroup(nsPerformanceStatsService* service,
                                       const nsAString& name,
                                       const nsAString& groupId,
                                       const nsAString& addonId,
                                       uint64_t windowId,
                                       uint64_t processId,
                                       bool isSystem,
                                       GroupScope scope)
  : nsPerformanceGroupDetails(name, groupId, addonId, windowId, processId, isSystem)
  , mService(service)
  , mScope(scope)
{
  mozilla::unused << mService->mGroups.PutEntry(this);

#if defined(DEBUG)
  if (scope == GroupScope::ADDON) {
    MOZ_ASSERT(IsAddon());
    MOZ_ASSERT(!IsWindow());
  } else if (scope == GroupScope::WINDOW) {
    MOZ_ASSERT(IsWindow());
    MOZ_ASSERT(!IsAddon());
  } else if (scope == GroupScope::RUNTIME) {
    MOZ_ASSERT(!IsWindow());
    MOZ_ASSERT(!IsAddon());
  }
#endif // defined(DEBUG)
  setIsActive(mScope != GroupScope::COMPARTMENT || mService->mIsMonitoringPerCompartment);
}
Пример #4
0
void StarShip::reborn()
{
    _drawableStrategy = new StarShipDrawableStrategy();
    _state = ObjectState::ALIVE;
    _acceleration = 0;
    _size = _bornSize;
    setIsActive(true);
}
Пример #5
0
void COpcProcessVar::sendItemData(){
  try{
    if (getIsActive())
      m_pOpcItem->writeSync(updateValue());
  } catch (OPCException e){
    setIsActive(false);
  }
}
Пример #6
0
void ProximitySensorNode::update() 
{
	if (!isEnabled())
		return;

	SceneGraph *sg = getSceneGraph();
	if (!sg)
		return;

	ViewpointNode *vpoint = sg->getViewpointNode();
	if (vpoint == NULL)
		vpoint = sg->getDefaultViewpointNode();

	float vpos[3];
	vpoint->getPosition(vpos);

	float center[3];
	getCenter(center);

	float size[3];
	getSize(size);

	if (inRegion() == false) {
		if (isRegion(vpos, center, size) == true) {
			setInRegion(true);
			double time = GetCurrentSystemTime();
			setEnterTime(time);
			sendEvent(getEventOut(enterTimeFieldString));
			setIsActive(true);
			sendEvent(getEventOut(isActiveFieldString));
		}
	}
	else {
		if (isRegion(vpos, center, size) == false) {
			setInRegion(false);
			double time = GetCurrentSystemTime();
			setExitTime(time);
			sendEvent(getEventOut(exitTimeFieldString));
			setIsActive(false);
			sendEvent(getEventOut(isActiveFieldString));
		}
	}
}
Пример #7
0
void Player::reset()
{
    stopAnimating();
    m_PathFinder->reset();
    m_DestinationTile = NULL;
    m_Health = 10;
    setIsActive(true);


}
Пример #8
0
bool Bullet::init()
{
    if (!CCSprite::initWithFile(kBullteFile)) {
        return false;
    }
    
    setIsActive(false);
    
    return true;
}
Пример #9
0
    void AutoCompleteModel::acceptSelected() {
        LOG_DEBUG << "Selected index:" << m_SelectedIndex;

        if (0 <= m_SelectedIndex && m_SelectedIndex < m_CompletionList.length()) {
            emit completionAccepted(m_CompletionList.at(m_SelectedIndex));
        }

        emit dismissPopupRequested();

        setIsActive(false);
    }
Пример #10
0
void Creep::update(double delta)
{
	//Update the player
	Player::update(delta);

	//Tell the creeps to attack the tower
	setDestinationTile(m_Level->getTileForPlayer(m_Level->getCastle()));

	//Update the animated texture
    m_BabyCreep->update(delta);
    
	//Get the pointer to tiles
    Tile* castleTile = m_Level->getTileForIndex(95);

	//Get the tile for the creep
    Tile* creepTile = m_Level->getTileForPlayer(this);
	
	//If a creep is on the castle tile
    if(castleTile == creepTile)
    {
		//Add a dead Creep
		m_CreepsDead += 1;

		//Subtract one from the castle health
		m_CastleHealth -= m_Damage *= m_CreepsDead;

		//Kill the creep
		setIsActive(false);
        
		//If the castle health reaches zero,
		if(m_CastleHealth == 0)
		{
			//take away one life
			m_RemainingLives -= 1;

			//If player has 3, 2, or 1 lives
			if(m_RemainingLives == 3 || 2 || 1)
			{
				//Reset the level
				m_Level->reset();
			}
			else
			{
				//You lose
				ScreenManager::getInstance()->switchScreen(YOU_LOSE_SCREEN_NAME);
			}
		}
	}
}
MediaStream::MediaStream(ScriptExecutionContext& context, RefPtr<MediaStreamPrivate>&& streamPrivate)
    : ContextDestructionObserver(&context)
    , m_private(streamPrivate)
    , m_activityEventTimer(*this, &MediaStream::activityEventTimerFired)
{
    ASSERT(m_private);
    setIsActive(m_private->active());
    m_private->addObserver(*this);
    MediaStreamRegistry::shared().registerStream(*this);

    for (auto& trackPrivate : m_private->tracks()) {
        RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(context, *trackPrivate);
        track->addObserver(this);
        m_trackSet.add(track->id(), WTF::move(track));
    }
}
Пример #12
0
void Brick::reset()
{
  //Get the screen width and height
  float screenWidth = ScreenManager::getInstance()->getScreenWidth();
  float screenHeight = ScreenManager::getInstance()->getScreenHeight();

  //Reset the paddle's width and height
  setWidth(screenWidth * GAME_PADDLE_WIDTH_PERCENTAGE);
  setHeight(screenHeight * GAME_PADDLE_HEIGHT_PERCENTAGE);
  
  //Reset the x and y position
  setX((screenWidth - getWidth()) / 2.0f);
  setY(screenHeight * GAME_PADDLE_Y_PERCENTAGE);

  //Reset the paddle to active
  setIsActive(true);
}
Пример #13
0
GameObject::GameObject():CCNode()
,_state(0)
,_classId(0)
,_simpleProperties(0)
,_properties(NULL)
,_displayNode(NULL)
,_physicsBody(NULL)
,_isFlipX(false)
,_isFlipY(false)
,_animationManager(NULL)
,_currentAnimInfo(NULL)
,_owner(NULL)
,_hp(0)
,_record(0)
{
	setIsActive(true);
	setIsTouchable(true);
}
Пример #14
0
void Ball::reset()
{
	//Get the screen width and height
	float screenWidth = ScreenManager::getInstance()->getScreenWidth();
	float screenHeight = ScreenManager::getInstance()->getScreenHeight();

	//Reset the radius
	setRadius(screenWidth * GAME_BALL_RADIUS_PERCENTAGE);
  
	//Reset the x and y position
	setX(screenWidth / 2.0f);
	setY(screenHeight / 2.0f);
  
	//Reset the speed
	setSpeed(GAME_BALL_DEFAULT_SPEED);
  
	//Set the ball back to being active
	setIsActive(true);
}
MediaStream::MediaStream(ScriptExecutionContext& context, const MediaStreamTrackVector& tracks)
    : ContextDestructionObserver(&context)
    , m_activityEventTimer(*this, &MediaStream::activityEventTimerFired)
{
    // This constructor preserves MediaStreamTrack instances and must be used by calls originating
    // from the JavaScript MediaStream constructor.
    MediaStreamTrackPrivateVector trackPrivates;
    trackPrivates.reserveCapacity(tracks.size());

    for (auto& track : tracks) {
        track->addObserver(this);
        m_trackSet.add(track->id(), track);
        trackPrivates.append(&track->privateTrack());
    }

    m_private = MediaStreamPrivate::create(trackPrivates);
    setIsActive(m_private->active());
    m_private->addObserver(*this);
    MediaStreamRegistry::shared().registerStream(*this);
}
Пример #16
0
void Player::applyDamage(int damage)
{
    m_Health -= damage;
    if(m_Health <= 0)
    {
        m_Health = 0;
        setIsActive(false);
        m_Level->setPickupTypeAtIndex(PickupTypeAmmo, m_Level->getTileIndexForPlayer(this));
        //ScreenManager::getInstance()->switchScreen(GAME_OVER_SCREEN);
        m_Level->EnemyDead();
        Log::debug("player is dead");
    }

    else
    {

        Log::debug("Player is hit %i health remaining", m_Health);
    }

}
void MediaStream::scheduleActiveStateChange()
{
    bool active = false;
    for (auto& track : m_trackSet.values()) {
        if (!track->ended()) {
            active = true;
            break;
        }
    }

    if (m_isActive == active)
        return;

    setIsActive(active);

    const AtomicString& eventName = m_isActive ? eventNames().inactiveEvent : eventNames().activeEvent;
    m_scheduledActivityEvents.append(Event::create(eventName, false, false));

    if (!m_activityEventTimer.isActive())
        m_activityEventTimer.startOneShot(0);
}
Пример #18
0
void cModel::initialise(glm::vec3 mdlPosition, glm::vec3 mdlRotation, glm::vec3 mdlScale, glm::vec3 mdlDirection, float mdlSpeed, bool mdlIsActive)
{
	setPosition(mdlPosition);
	setRotation(mdlRotation);
	setScale(mdlScale);
	setDirection(mdlDirection);
	setSpeed(mdlSpeed);
	setIsActive(mdlIsActive);
	m_Dimensions.s_mdldepth = 0.0f;
	m_Dimensions.s_mdlheight = 0.0f;
	m_Dimensions.s_mdlWidth = 0.0f;
	m_mdlRadius = m_Dimensions.s_mdldepth / 2;
	glm::vec3 mdlPos = getPosition();
	GLfloat mdlRot = getRotation().x;
	glRotatef(mdlRot, 1.0f, 0.0f, 0.0f);
	mdlRot = getRotation().y;
	glRotatef(mdlRot, 0.0f, 1.0f, 0.0f);
	mdlRot = getRotation().z;
	glRotatef(mdlRot, 0.0f, 0.0f, 1.0f);
	glTranslatef(mdlPosition.x, mdlPosition.y, mdlPosition.z);
	OutputDebugString("Initialising model \n");
}
Пример #19
0
void TimeSensor::frame(Time tTime, UInt32 uiFrame)
{
    Real64 dFraction;

    bool bDoTimeRange = bool(_sfStartTime.getValue() < 
                             _sfStopTime .getValue());

    bool bDoCycle      = false;

    if(bDoTimeRange)
    {
        dFraction = 
            Real64( tTime                 - _sfStartTime.getValue()) / 
            Real64(_sfStopTime.getValue() - _sfStartTime.getValue());
    }
    else
    {
        if(_sfCycleTime.getValue() > 0.0)
        {
            dFraction = 
                Real64(tTime - _sfCycleTime.getValue()) / 
                Real64(_sfCycleInterval.getValue());

            bDoCycle = true;
        }
        else
        {
            dFraction = 
                Real64(tTime - _sfStartTime.getValue()) / 
                Real64(_sfCycleInterval.getValue());
        }
    }

    if(_sfEnabled.getValue() == false)
    {
        if(_sfIsActive.getValue() == true) 
        {
            setTime    (tTime);
            setIsActive(false);
            setFraction(Real32(dFraction));
        }
    }
    else
    {
        if(dFraction < 0.0) // before start
        {
            if(bDoCycle == true)
            {
                if(_sfIsActive.getValue() == true) 
                {
                    if(_sfLoop.getValue() == false)
                    {
                        setIsActive (false);
                        setTime     (tTime);
                        setFraction (1.0  );
                        setCycleTime(tTime);
                    }
                    else
                    {
                        setCycleTime(_sfCycleTime    .getValue() - 
                                     _sfCycleInterval.getValue());
                            
                        setTime     (tTime);
                        setFraction (dFraction + 1.0);
                    }
                }
                else
                {
                }
            }
        }
        else if(dFraction > 1.0) // after end time
        {
            if(_sfIsActive.getValue() == true) 
            {
                if(_sfLoop.getValue() == false)
                {
                    setIsActive (false);
                    setTime     (0.f  );
                    setFraction (1.0  );
                    setCycleTime(0.f  );
                    setEnabled  (false);
                }
                else
                {
                    setCycleTime(_sfCycleTime    .getValue() +
                                 _sfCycleInterval.getValue());
                    
                    setTime     (tTime);
                    setFraction (dFraction - 1.0);
                }
            }
            else
            {
                if(bDoTimeRange == false)
                {
                    setFraction (0.f);
                    setCycleTime(tTime - 
                                 (_sfFraction     .getValue() *
                                  _sfCycleInterval.getValue() ));

                    setIsActive (true);
                    setTime     (tTime);
                }
            }
        }
        else  // within cycle
        {
            if (_sfIsActive.getValue() == false) 
            {
                if(bDoTimeRange      == true)
                {
                    setCycleTime(_sfStartTime.getValue());
                    setIsActive (true);
                    setTime     (tTime);
                    setFraction (dFraction);
                }
                else
                {
                    setCycleTime(tTime - 
                                 (_sfFraction     .getValue() *
                                  _sfCycleInterval.getValue() ));
                    
                    if(_sfCycleTime.getValue() >
                       TypeTraits<Time>::getDefaultEps())
                    {
                        setIsActive(true);
                    }
                    
                    setTime(tTime);
                }
            }
            else
            {
                if(tTime        >= _sfStopTime.getValue() && 
                   bDoTimeRange == true                     ) 
                {
                    setIsActive(false);
                }
                else
                {
                    if(tTime >= _sfStartTime.getValue())
                    {
                        setTime    (tTime    );
                        setFraction(dFraction);
                    }
                }
            }
        }
    }
}
Пример #20
0
void Brick::reset()
{
    //Set the brick back to being active
    setIsActive(true);
}
Пример #21
0
void Bullet::flyFinished()
{
    CCLog("setIsActive false");
    setIsActive(false);
    
}
Пример #22
0
void PlaneSensorNode::initialize() 
{
	setIsActive(false);
}
void AnimTimeSensor::frame(Time oTime, UInt32 uiFrame)
{
    Time startT = _sfStartTime  .getValue();
    Time stopT  = _sfStopTime   .getValue();
    Time currT  = _sfTime       .getValue();

    Time length = _sfCycleLength.getValue();
    Time deltaT = 0.0;

    setTime(oTime);

    if(getEnabled() == false)
    {
        if(getIsActive() == true)
        {
            setIsActive(false);
        }

        return;
    }

    if(startT < stopT)
    {
        if(oTime < startT)
        {
            if(getIsActive() == true)
            {
                SLOG << "ATS: start < stop, BEFORE startT, deactivating" << std::endl;

                setFraction(0.f  );
                setAnimTime(0.f  );
                setIsActive(false);
            }

            return;
        }
        else if(oTime > stopT)
        {
            if(getIsActive() == true)
            {
                SLOG << "ATS: start < stop, AFTER stopT";

                setFraction(1.f   );
                setAnimTime(length);

                // only deactivate the second time oTime > stopT
                // to propagate the final state
                if(currT > stopT)
                {
                    PLOG << ", deactivating";

                    setIsActive(false);
                }

                PLOG << std::endl;
            }

            return;
        }
        else
        {
            if(currT <= 0.0)
            {
                deltaT = oTime - startT;
            }
            else
            {
                deltaT = oTime - currT;
            }
        }
    }
    else
    {
        if(oTime < startT)
        {
            if(getIsActive() == true)
            {
                SLOG << "ATS: start >= stop, BEFORE startT, deactivating" << std::endl;

                setFraction(0.f  );
                setAnimTime(0.f  );
                setIsActive(false);
            }

            return;
        }
        else
        {
            if(currT <= 0.0)
            {
                deltaT = oTime - startT;
            }
            else
            {
                deltaT = oTime - currT;
            }
        }
    }

    // use deltaT to update

    Real32 oldAnimT = getAnimTime();
    Real32 newAnimT = getAnimTime();

    if(getForward() == true)
    {
        newAnimT += getTimeScale() * deltaT;
    }
    else
    {
        newAnimT -= getTimeScale() * deltaT;
    }

    if(getLoop() == true)
    {
        newAnimT = osgMod<Real64>(newAnimT, length);
        
        while(newAnimT < 0.f)
            newAnimT += length;

        setAnimTime(newAnimT         );
        setFraction(newAnimT / length);

        if(getIsActive() == false)
            setIsActive(true);
    }
    else
    {
        if(newAnimT < 0.f)
        {
            if(getIsActive() == true)
            {
                SLOG << "ATS: start >= stop, newAnimT < 0";

                setAnimTime(0.f);
                setFraction(0.f);

                // only deactivate the second time newAnimT < 0.f
                // to propagate the final state
                if(oldAnimT <= 0.f)
                {
                    PLOG << ", deactivating";

                    setIsActive(false);
                }

                PLOG << std::endl;
            }
        }
        else if(newAnimT > length)
        {
            if(getIsActive() == true)
            {
                SLOG << "ATS: start >= stop, newAnimT > length";

                setAnimTime(length);
                setFraction(1.f   );

                // only deactivate the second time newAnimT > length
                // to propagate the final state
                if(oldAnimT >= length)
                {
                    PLOG << ", deactivating";

                    setIsActive(false);
                }

                PLOG << std::endl;
            }
        }
        else
        {
            setAnimTime(newAnimT         );
            setFraction(newAnimT / length);

            if(getIsActive() == false)
                setIsActive(true);
        }
    }
}