bool GdiBitmapBufferedContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(false);
	return true;
}
bool GdiPrintContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == printDC_) return false;

	setActivation(false);
	return true;
}
bool WglBitmapBufferedContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(false);

	return wglMakeCurrent(NULL, NULL) == TRUE;
}
Exemplo n.º 4
0
 void RuleBlock::activate() {
     FL_DBG("===================");
     FL_DBG("ACTIVATING RULEBLOCK " << getName());
     if (not getActivation()) {
         setActivation(new General);
     }
     FL_DBG("Activation: " << getActivation()->className() << " " << getActivation()->parameters());
     getActivation()->activate(this);
 }
Exemplo n.º 5
0
bool GdiContext::deactivate()
{
	if (!isActivated()) return true;
	if (NULL == hDC_) return false;

	setActivation(false);

	return true;
}
bool GdiBitmapBufferedContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	setActivation(true);
	return true;

	// draw something into memDC_
}
Exemplo n.º 7
0
bool ViFann::setActivation(const Activation &activation)
{
	if(mNetwork == NULL) return false;
	int layers = fann_get_num_layers(mNetwork);
	for(mI = 1; mI < layers; ++mI)
	{
		if(!setActivation(activation, mI)) return false;
	}
	return true;
}
bool GdiPrintContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == printDC_) return false;

	setActivation(true);
	return true;

	// draw something into memDC_
}
Exemplo n.º 9
0
bool GdiContext::activate()
{
	if (isActivated()) return true;
	if (NULL == hDC_) return false;

	setActivation(true);

	return true;

	// draw something into hDC_
}
Exemplo n.º 10
0
bool ViFann::setActivation(const QList<Activation> &activations)
{
	if(mNetwork == NULL) return false;
	if(fann_get_num_layers(mNetwork) - 1 != activations.size()) return false; // -1 because of the input layer
	int layers = fann_get_num_layers(mNetwork);
	for(mI = 1; mI < layers; ++mI)
	{
		if(!setActivation(activations[mI - 1], mI)) return false;
	}
	return true;
}
bool WglBitmapBufferedContext::activate()
{
	if (isActivated()) return true;
	if (NULL == memBmp_ || NULL == memDC_ || NULL == hDC_) return false;

	const bool ret = (wglGetCurrentContext() == wglRC_) ? true : (wglMakeCurrent(memDC_, wglRC_) == TRUE);
	if (ret)
	{
		setActivation(true);
		return true;
	}
	else return false;

	// draw something into rendering context
}
Exemplo n.º 12
0
//----Inhibits neighbouring cells----//
float doInhibition(float stepSize)
{
	float inhibition = globalInhibition * stepSize;
  float activationSum = 0;
  numActive = 0; //clear number of active cells counter

  //initialise loop variable
  char i;
  char j;
  char k;

  for(i = 0; i < sizeX; i++)
  {
    for(j = 0; j < sizeY; j++)
    {
      for(k = 0; k < sizeTheta; k++)
      {
        if(poseWorld.poseActivity[i].array2D[j][k] > 0) //if cell active
        {
        	float activation = poseWorld.poseActivity[i].array2D[j][k] - inhibition;
          if(activation <=0)
          {
            activation = 0; //cant have negative activity
          }
          setActivation(i, j, k, activation); //set activation and see if is maximum
          activationSum += activation;
          if(activation>0)
          {
            numActive++; //increase number of active cells
          }
        }
      }
    }
  }
  return activationSum;
}
void ShipModulesControllerSystem::processEntities(const vector<Entity*>& p_entities)
{
	// Process all modules
	for (unsigned int i = 0; i < p_entities.size(); i++)
	{
		NetworkSynced* netSync = static_cast<NetworkSynced*>(p_entities[i]->getComponent(ComponentType::NetworkSynced));
		
		for (unsigned int j = 0; j < m_toActivate.size(); j++)
		{
			if (m_toActivate[j] == netSync->getNetworkOwner())
			{
				//Do Activate
				setActivation(p_entities[i], true);
				m_toActivate[j] = m_toActivate.back();
				m_toActivate.pop_back();
				j--;
			}
		}
		for (unsigned int j = 0; j < m_toDeactivate.size(); j++)
		{
			if (m_toDeactivate[j] == netSync->getNetworkOwner())
			{
				//Do Deactivate
				setActivation(p_entities[i], false);
				m_toDeactivate[j] = m_toDeactivate.back();
				m_toDeactivate.pop_back();
				j--;
			}
		}
		for (unsigned int j = 0; j < m_toHighlight.size(); j++)
		{
			if (m_toHighlight[j].id == netSync->getNetworkOwner())
			{
				//Do highlight
				changeHighlight(p_entities[i], m_toHighlight[j].slot,
					m_toHighlight[j].status);
				m_toHighlight[j] = m_toHighlight.back();
				m_toHighlight.pop_back();
				j--;
			}
		}	

		//Check to see if modules should be dropped
		pair<float,int> massBoosters(0.0f,0);
		checkDrop_ApplyScoreAndDamage(p_entities[i],massBoosters);

		// send mass and booster count to client
		if(static_cast<TimerSystem*>(m_world->getSystem(SystemType::TimerSystem))->
			checkTimeInterval(TimerIntervals::EverySecond))
		{
			// add ship mass too!
			float shipmass=0.0f;
			PhysicsBody* body = static_cast<PhysicsBody*>(
				p_entities[i]->getComponent(ComponentType::PhysicsBody));
			shipmass = m_physicsSystem->getController()->getBody(body->m_id)->GetMass();
			//
			sendMassBoostersTotal(netSync->getNetworkOwner(),
				50.0f*(1.5f*shipmass+0.4f*massBoosters.first),massBoosters.second);
		}

		//Check if the player has recieved enough damage score for it to be applied
		PlayerSystem* playerSys = static_cast<PlayerSystem*>
			(m_world->getSystem(SystemType::PlayerSystem));

		NetworkSynced* sync = static_cast<NetworkSynced*>(p_entities[i]->getComponent(ComponentType::NetworkSynced));

		PlayerComponent* scoreComponent = playerSys->getPlayerCompFromNetworkComp(sync);
		if (scoreComponent)
		{
			Transform* trans = static_cast<Transform*>(p_entities[i]->getComponent(ComponentType::Transform));
			if (scoreComponent->getDealtDamageScore() > 5)
			{
				setScoreEffect(sync->getNetworkOwner(), trans, (int)(scoreComponent->getDealtDamageScore()+0.5f));
				scoreComponent->applyDealtDamageScore();
			}
		}
	}
}
Exemplo n.º 14
0
//----Injects additional activity into cells----//
void injectEnergy (float stepSize, char xCell, char yCell, char thetaCell)
{
  float previousActivation = poseWorld.poseActivity[xCell].array2D[yCell][thetaCell];
  setActivation(xCell,yCell,thetaCell, previousActivation + (injectionStrength * stepSize));
}
Exemplo n.º 15
0
//----Injects additional activity into cells----//
void injectEnergy (float stepSize, char xCell, char yCell, char thetaCell)
{
  float previousActivation = poseWorld.poseActivity[poseAssoc.xCell].array2D[poseAssoc.yCell][poseAssoc.thetaCell];
  setActivation(poseAssoc.xCell,poseAssoc.yCell,poseAssoc.thetaCell, previousActivation + injectionStrength * stepSize);
}