コード例 #1
0
/**
 * @brief CollisionSystem::Update checks for collisions between entities that have moved and all other entities
 * @param dt frame time
 */
void CollisionSystem::Update(sf::Time dt)
{
    PositionComponent* p1 = nullptr;
    sf::Vector2f norm;
    std::list<unsigned int> movedEntities = _MovedEntities;
    _MovedEntities.clear();
    std::list<unsigned int>::iterator mit;

    FillBins();

    for(mit = movedEntities.begin(); mit != movedEntities.end(); mit++)
    {
        p1 = this->GetEntity(*mit)->GetComponent<PositionComponent>("Position");

        if(CheckCollisions(*mit, norm))
        {
            MoveEntityMessage msg;
            msg.ID = *mit;
            msg.newPosition.x = p1->GetPosition().x - norm.x;
            msg.newPosition.y = p1->GetPosition().y - norm.y;
            Emit<MoveEntityMessage>(msg);
        }
    }

    ClearBins();
}
コード例 #2
0
ファイル: GCAllocator.cpp プロジェクト: KonajuGames/CrossNet
void GCAllocator::Setup(const ::CrossNetRuntime::InitOptions & options)
{
    CROSSNET_ASSERT(IsAligned(sizeof(AllocStructure)), "");
    CROSSNET_ASSERT(IsAligned((int)options.mMainBuffer), "");

    // Set the allocated buffer to a specific pattern (to detect bugs earlier)
    __memset__(options.mMainBuffer, 0xA5, options.mMainBufferSize);

    sCurrentAllocPointer = static_cast<unsigned char *>(options.mMainBuffer);
    sEndMainBuffer = sCurrentAllocPointer + options.mMainBufferSize;

    ClearBins();
}
コード例 #3
0
ファイル: LuaMaterial.cpp プロジェクト: Liuyangbiao/spring
void LuaMatHandler::ClearBins(LuaObjType objType)
{
	for (int m = 0; m < LUAMAT_TYPE_COUNT; m++) {
		ClearBins(objType, LuaMatType(m));
	}
}