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


C++ PVector::push_back方法代码示例

本文整理汇总了C++中PVector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ PVector::push_back方法的具体用法?C++ PVector::push_back怎么用?C++ PVector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PVector的用法示例。


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

示例1: getRepairCrewFor

PVector<RepairCrew> getRepairCrewFor(P<PlayerSpaceship> ship)
{
    PVector<RepairCrew> ret;
    if (!ship)
        return ret;

    foreach(RepairCrew, c, repairCrewList)
        if (c->ship_id == ship->getMultiplayerId())
            ret.push_back(c);
    return ret;
}
开发者ID:Baknik,项目名称:EmptyEpsilon,代码行数:11,代码来源:repairCrew.cpp

示例2: foreach

FactionInfo::FactionInfo()
{
    foreach(FactionInfo, i, factionInfo)
        i->states.push_back(FVF_Neutral);
    factionInfo.push_back(this);

    for(unsigned int n = 0; n < factionInfo.size(); n++)
        states.push_back(FVF_Neutral);
    for(unsigned int n = 0; n < factionInfo.size(); n++)
        if (factionInfo[n] == this)
            states[n] = FVF_Friendly;
}
开发者ID:doismellburning,项目名称:EmptyEpsilon,代码行数:12,代码来源:factionInfo.cpp

示例3: main

int main(int argc, const char * argv[])
{
    // Vectors
    PVector<int, persister<int> > pvInt = PVector<int, persister<int> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp.txt");
    pvInt.push_back(12);
    pvInt.push_back(13);
    
    PVector<std::string, persister<std::string> > pv = PVector<std::string, persister<std::string> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp2.txt");
    pv.push_back("Test1.");
    pv.push_back("Test2.a Test2.b Test2.c");
    
    PVector<Fraction, persister<Fraction> > pvFr = PVector<Fraction, persister<Fraction> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp5.txt");
    Fraction fr1 = Fraction();
    fr1.set_counter(4);
    fr1.set_denominator(5);
    Fraction fr2 = Fraction();
    fr2.set_counter(5);
    fr2.set_denominator(7);
    pvFr.push_back(fr1);
    pvFr.push_back(fr2);
    
    
    // Sets: unique Values
	PSet<int, persisterTwo<int> > psInt = PSet<int, persisterTwo<int> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp3.txt");
    psInt.insert(2);
    psInt.insert(4);
    
    PSet<std::string, persisterTwo<std::string> > ps = PSet<std::string, persisterTwo<std::string> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp4.txt");
    std::string a = "Test1";
    std::string b = "Test2.a Test2.b Test2.c";
	ps.insert(a);
	ps.insert(b);
    
    PSet<Fraction, persisterTwo<Fraction> > psFr = PSet<Fraction, persisterTwo<Fraction> >("/Users/Raphael/Dropbox/uzh/uzh-13-fall/uzh-apc/uzh-apc-ex/apc-ex-04-1/apc-ex-04-1/tmp6.txt");
    psFr.insert(fr1);
    psFr.insert(fr2);
    
    
	return 0;
}
开发者ID:rmatil,项目名称:uzh-apc,代码行数:40,代码来源:main.cpp

示例4: foreach

FactionInfo::FactionInfo()
{
    if (game_server) { LOG(ERROR) << "FactionInfo objects can not be created during a scenario right now."; destroy(); return; }

    foreach(FactionInfo, i, factionInfo)
        i->states.push_back(FVF_Neutral);
    factionInfo.push_back(this);

    for(unsigned int n = 0; n < factionInfo.size(); n++)
        states.push_back(FVF_Neutral);
    for(unsigned int n = 0; n < factionInfo.size(); n++)
        if (factionInfo[n] == this)
            states[n] = FVF_Friendly;
}
开发者ID:JeffM2501,项目名称:EmptyEpsilon,代码行数:14,代码来源:factionInfo.cpp

示例5: MultiplayerObject

RepairCrew::RepairCrew()
: MultiplayerObject("RepairCrew")
{
    ship_id = -1;
    position.x = -1;
    action = RC_Idle;
    direction = ERepairCrewDirection(irandom(RC_Up, RC_Right + 1));

    selected = false;

    registerMemberReplication(&ship_id);
    registerMemberReplication(&position, 1.0);
    registerMemberReplication(&target_position);

    repairCrewList.push_back(this);
}
开发者ID:Baknik,项目名称:EmptyEpsilon,代码行数:16,代码来源:repairCrew.cpp

示例6: glViewport


//.........这里部分代码省略.........
    glScalef(1,1,-1);
    glRotatef(-camera_pitch, 1, 0, 0);
    glRotatef(-camera_yaw - 90, 0, 0, 1);

    glGetDoublev(GL_PROJECTION_MATRIX, projection_matrix);
    glGetDoublev(GL_MODELVIEW_MATRIX, model_matrix);
    glGetDoublev(GL_VIEWPORT, viewport);

    sf::Texture::bind(textureManager.getTexture("Stars"), sf::Texture::Pixels);
    glDepthMask(false);
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f( 100, 100, 100);
    glTexCoord2f(   0,    0); glVertex3f( 100, 100,-100);
    glTexCoord2f(1024, 1024); glVertex3f(-100, 100, 100);
    glTexCoord2f(   0, 1024); glVertex3f(-100, 100,-100);
    glEnd();
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f(-100, 100, 100);
    glTexCoord2f(   0,    0); glVertex3f(-100, 100,-100);
    glTexCoord2f(1024, 1024); glVertex3f(-100,-100, 100);
    glTexCoord2f(   0, 1024); glVertex3f(-100,-100,-100);
    glEnd();
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f(-100,-100, 100);
    glTexCoord2f(   0,    0); glVertex3f(-100,-100,-100);
    glTexCoord2f(1024, 1024); glVertex3f( 100,-100, 100);
    glTexCoord2f(   0, 1024); glVertex3f( 100,-100,-100);
    glEnd();
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f( 100,-100, 100);
    glTexCoord2f(   0,    0); glVertex3f( 100,-100,-100);
    glTexCoord2f(1024, 1024); glVertex3f( 100, 100, 100);
    glTexCoord2f(   0, 1024); glVertex3f( 100, 100,-100);
    glEnd();
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f( 100,-100, 100);
    glTexCoord2f(   0,    0); glVertex3f(-100,-100, 100);
    glTexCoord2f(1024, 1024); glVertex3f( 100, 100, 100);
    glTexCoord2f(   0, 1024); glVertex3f(-100, 100, 100);
    glEnd();
    glBegin(GL_TRIANGLE_STRIP);
    glTexCoord2f(1024,    0); glVertex3f( 100,-100,-100);
    glTexCoord2f(   0,    0); glVertex3f(-100,-100,-100);
    glTexCoord2f(1024, 1024); glVertex3f( 100, 100,-100);
    glTexCoord2f(   0, 1024); glVertex3f(-100, 100,-100);
    glEnd();

    if (gameGlobalInfo)
    {
        //Render the background nebulas from the gameGlobalInfo. This ensures that all screens see the same background as it is replicated across clients.
        for(int n=0; n<GameGlobalInfo::max_nebulas; n++)
        {
            sf::Texture::bind(textureManager.getTexture(gameGlobalInfo->nebula_info[n].textureName), sf::Texture::Pixels);
            glEnable(GL_BLEND);
            glBlendFunc(GL_SRC_ALPHA, GL_ONE);
            glPushMatrix();
            glRotatef(180, gameGlobalInfo->nebula_info[n].vector.x, gameGlobalInfo->nebula_info[n].vector.y, gameGlobalInfo->nebula_info[n].vector.z);
            glColor4f(1,1,1,0.1);
            glBegin(GL_TRIANGLE_STRIP);
            glTexCoord2f(1024,    0); glVertex3f( 100, 100, 100);
            glTexCoord2f(   0,    0); glVertex3f( 100, 100,-100);
            glTexCoord2f(1024, 1024); glVertex3f(-100, 100, 100);
            glTexCoord2f(   0, 1024); glVertex3f(-100, 100,-100);
            glEnd();
            glPopMatrix();
        }
    }
    glColor4f(1,1,1,1);
    glDisable(GL_BLEND);
    sf::Texture::bind(NULL);
    glDepthMask(true);
    glEnable(GL_DEPTH_TEST);

    {
        float lightpos1[4] = {0, 0, 0, 1.0};
        glLightfv(GL_LIGHT1, GL_POSITION, lightpos1);

        float lightpos0[4] = {20000, 20000, 20000, 1.0};
        glLightfv(GL_LIGHT0, GL_POSITION, lightpos0);
    }

    PVector<SpaceObject> renderList;
    sf::Vector2f viewVector = sf::vector2FromAngle(camera_yaw);
    float depth_cutoff_back = camera_position.z * -tanf((90+camera_pitch + camera_fov/2.0) / 180.0f * M_PI);
    float depth_cutoff_front = camera_position.z * -tanf((90+camera_pitch - camera_fov/2.0) / 180.0f * M_PI);
    if (camera_pitch - camera_fov/2.0 <= 0.0)
        depth_cutoff_front = std::numeric_limits<float>::infinity();
    if (camera_pitch + camera_fov/2.0 >= 180.0)
        depth_cutoff_back = -std::numeric_limits<float>::infinity();
    foreach(SpaceObject, obj, space_object_list)
    {
        float depth = sf::dot(viewVector, obj->getPosition() - sf::Vector2f(camera_position.x, camera_position.y));
        if (depth + obj->getRadius() < depth_cutoff_back)
            continue;
        if (depth - obj->getRadius() > depth_cutoff_front)
            continue;
        if (depth > 0 && obj->getRadius() / depth < 1.0 / 500)
            continue;
        renderList.push_back(obj);
    }
开发者ID:HenriVesala,项目名称:EmptyEpsilon,代码行数:101,代码来源:viewport3d.cpp

示例7: threes

void threes(const Vec2 &point)
{
	point.toString();
	int l,f,u,d;
	l = f = point.x;
	u = d = point.y;
	PVector tmpX;
	PVector tmpY;
	WTF node;
	node.centre = point;
	int countX = 0;
	while(--l > 0)
	{
		if (Map[l][point.y] == Map[point.x][point.y])
		{
			cout<<l<<" l "<<point.y<<endl;
			tmpX.push_back(Vec2(l,point.y));
			++countX;
		}
		else
			break;
	};
	while(++f < xCount)
	{
		if (Map[f][point.y] == Map[point.x][point.y])
		{
			cout<<f<<" f "<<point.y<<endl;
			tmpX.push_back(Vec2(f,point.y));
			++countX;
		}
		else
			break;
	};
	if (countX>=2)
	{
		cout<<"X is THREE"<<endl;
		node.vecX = tmpX;
	}

	int countY = 0;
	while(--u > 0)
	{
		if (Map[point.x][u] == Map[point.x][point.y])
		{
			cout<<point.x<<" u "<<u<<endl;
			tmpY.push_back(Vec2(point.x,u));
			++countY;
		}
		else
			break;
	};
	while(++d < yCount)
	{
		if (Map[point.x][d] == Map[point.x][point.y])
		{
			cout<<point.x<<" d "<<d<<endl;
			tmpY.push_back(Vec2(point.x,d));
			++countY;
		}
		else
			break;
	};
	if (countY>=2)
	{
		cout<<"Y is THREE"<<endl;
		node.vecY = tmpY;
	}
	bool cross = countX>=2&&countY>=2;
	bool five = countX>=4||countY>=4;
	bool four = countX>=3||countY>=3;
	bool three = countX>=2||countY>=2;
	node.p = 0;
	if (countX>=2&&countY>=2)
	{
		node.p |= CROSS;
	}
	if (countX>=4||countY>=4)
	{
		node.p |= FIVE;	
	}
	else if (countX>=3||countY>=3)
	{
		node.p |= FOUR;	
	}
	else if (countX>=2||countY>=2)
	{
		node.p |= THREE;		
	}
	if (node.p!=0)
	{
		cout<<"Yes"<<endl;
		nodes.push_back(node);
	}
}
开发者ID:cnCT,项目名称:MyCodes,代码行数:94,代码来源:Monster.cpp


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