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


C++ Break函数代码示例

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


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

示例1: Break

void CBreakableObject::CheckHitBreak(float power,ALife::EHitType hit_type)
{
	if( hit_type!=ALife::eHitTypeStrike)
	{
		float res_power=power*m_immunity_factor;
		if(power>m_health_threshhold) fHealth-=res_power;
	}
	if(fHealth<=0.f)	
	{
		Break();return;
	}

	if(hit_type==ALife::eHitTypeStrike)Break();
}
开发者ID:AntonioModer,项目名称:xray-16,代码行数:14,代码来源:BreakableObject.cpp

示例2: move

void move(int direction, int speed, int distance, int FBbreakspd){
	revolutions = 360*(distance/wheelCircumference);
	switch (direction) {

	case forward:
		zeroEncoders();
		while(getDTEncoderAverage() < revolutions){
			setDriveMotors(127,127,127, 127);
			setFBMotors(FBbreakspd);
		}
		zeroEncoders();
		Break(forward);
		break;

	case turnLeft: //int FLSpeed, int FRspeed, int BRspeed, int BLspeed
		zeroEncoders();
		while(getDTEncoderAverage() < revolutions){
			setDriveMotors(-127, 127, 127, -127);
			setFBMotors(FBbreakspd);

		}
		Break(turnLeft);
		break;

	case turnRight: //int FLSpeed, int FRspeed, int BRspeed, int BLspeed
		zeroEncoders();
		while(getDTEncoderAverage() < revolutions){
			setDriveMotors(127, -127, -127, 127);
			setFBMotors(FBbreakspd);
		}
		Break(turnRight);
		break;

	case backwards:
		zeroEncoders();
		while(getDTEncoderAverage() < revolutions){
			setDriveMotors(-127, -127, -127, -127);
			setFBMotors(FBbreakspd);

		}
		Break(backwards);
		break;

	default:
		setDriveMotors(0,0,0,0);
		zeroEncoders();

	}
	zeroEncoders();
}
开发者ID:wa-robotics,项目名称:starstruck-2016,代码行数:50,代码来源:Alpha+-+Competition.c

示例3: shutdown

void ofxOscReceiver::setup( int listen_port )
{
    if( osc::UdpSocket::GetUdpBufferSize() == 0 ){
    	osc::UdpSocket::SetUdpBufferSize(65535);
    }
    
	// if we're already running, shutdown before running again
	if ( listen_socket ){
		shutdown();
	}
	
	// create socket
	auto socket = new osc::UdpListeningReceiveSocket( osc::IpEndpointName( osc::IpEndpointName::ANY_ADDRESS, listen_port ), this, allowReuse );
	auto deleter = [](osc::UdpListeningReceiveSocket*socket){
		// tell the socket to shutdown
		socket->Break();
		delete socket;
	};
	auto new_ptr = std::unique_ptr<osc::UdpListeningReceiveSocket, decltype(deleter)>(socket, deleter);
	listen_socket = std::move(new_ptr);

	listen_thread = std::thread([this]{
		listen_socket->Run();
	});

	// detach thread so we don't have to wait on it before creating a new socket
	// or on destruction, the custom deleter for the socket unique_ptr already
	// does the right thing
	listen_thread.detach();

	this->listen_port = listen_port;
}
开发者ID:AbdelghaniDr,项目名称:openFrameworks,代码行数:32,代码来源:ofxOscReceiver.cpp

示例4: FCPause

void    FCPause( void ) {
//=======================

// Process PAUSE statement.

    Break( RT_PAUSE );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:7,代码来源:fcmisc.c

示例5: FCStop

void    FCStop( void ) {
//======================

// Process STOP statement.

    Break( RT_STOP );
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:7,代码来源:fcmisc.c

示例6: GetOwner

// get user options, process and save.
void
Options::onbtnSave()
{
	int dontsplash = optSplash.Get();    // get the value from option control
	int savewinpos = optSaveWinPos.Get();// get the value from option control

	Ctrl* owner = GetOwner(); // get a handle to the Options dislog owner which is MyUppApp main window.
	Rect rc;                  // create a struct to store window position and size

	if ( savewinpos != 1 ) {  // if Save Window option is not checked.
		rc.left = 0;          // set window position x to 0
		rc.top = 0;           // set window position y to 0
	} else {
		rc = owner->GetRect(); // get the position and size of MyUppApp main window
	}

	String cfg;  // create a string to store config data
	cfg << "Splash="     << dontsplash << "\n"    // save user's choice
	       "SaveWinPos=" << savewinpos << "\n"    // save user's choice
	       "PosX="       << rc.left    << "\n"    // save window x position
	       "PosY="       << rc.top     << "\n";   // save window y position

	if( !SaveFile(cfgfile, cfg) )  // save the config file
		Exclamation("Error saving configuration!"); // if failed show error dialog
	else
	    PromptOK("Options saved!");  // show success dialog

	Break(IDOK); // close this dialog
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:30,代码来源:Options.cpp

示例7: getPlayerPed

void CObject::Explode()
{
    CVector pos = Placeable.GetPos();
    pos.z += 0.5;
    CExplosion::AddExplosion(this, getPlayerPed(-1), 9, pos, 100, 1, -1.0, 0);
    if(m_colDamageEffect == 0xCA || m_colDamageEffect == 0xc8)
    {
        pos.z -= 1.0;
        Break(10000.0, pos, 0, getPlayerPed(-1), 51);
    }
    else if(!bDisableFriction)
    {
        m_vecLinearVelocity.z += 0.5;
        m_vecLinearVelocity.x += (rand() - 128) * 0.000199999994947575;
        m_vecLinearVelocity.y += (rand() - 128) * 0.000199999994947575;
        if(bIsStatic || bIsStaticWaitingForCollision)
        {
            SetIsStatic(false);
            AddToMovingList();
        }
    }
    if(m_pObjectInfo->fxType == 2)
    {
        CMatrix pos = CMatrix::FromXYZ(m_xyz);
        // to object space
        CVector fx_obj_pos = pos * m_pObjectInfo->fxOffset;
        fx_obj_pos += GetPos(); // to world space
        FxSystem_c *sys = FxManager.InitialiseFxSystem(m_pObjectInfo->pFxSystemBP, fx_obj_pos, 0, 0);
        if(sys)
        {
            sys->Start();
        }
    }
}
开发者ID:ArnCarveris,项目名称:GTASA,代码行数:34,代码来源:CObject.cpp

示例8: sizeof

/*
================
idBrittleFracture::Shatter
================
*/
void idBrittleFracture::Shatter( const idVec3 &point, const idVec3 &impulse, const int time ) {
	int i;
	idVec3 dir;
	shard_t *shard;
	float m;

	if ( gameLocal.isServer ) {
		idBitMsg	msg;
		byte		msgBuf[MAX_EVENT_PARAM_SIZE];

		msg.Init( msgBuf, sizeof( msgBuf ) );
		msg.BeginWriting();
		msg.WriteFloat( point[0] );
		msg.WriteFloat( point[1] );
		msg.WriteFloat( point[2] );
		msg.WriteFloat( impulse[0] );
		msg.WriteFloat( impulse[1] );
		msg.WriteFloat( impulse[2] );
		ServerSendEvent( EVENT_SHATTER, &msg, true, -1 );
	}

	if ( time > ( gameLocal.time - SHARD_ALIVE_TIME ) ) {
		StartSound( "snd_shatter", SND_CHANNEL_ANY, 0, false, NULL );
	}

	if ( !IsBroken() ) {
		Break();
	}

	if ( fxFracture.Length() ) {
		idEntityFx::StartFx( fxFracture, &point, &GetPhysics()->GetAxis(), this, true );
	}

	dir = impulse;
	m = dir.Normalize();

	for ( i = 0; i < shards.Num(); i++ ) {
		shard = shards[i];

		if ( shard->droppedTime != -1 ) {
			continue;
		}

		if ( ( shard->clipModel->GetOrigin() - point ).LengthSqr() > Square( maxShatterRadius ) ) {
			continue;
		}

		DropShard( shard, point, dir, m, time );
	}

	DropFloatingIslands( point, impulse, time );

	//trigger it.
	if (!firedTargets)
	{
		firedTargets = true;
		ActivateTargets(this);
	}
}
开发者ID:tankorsmash,项目名称:quadcow,代码行数:64,代码来源:BrittleFracture.cpp

示例9: Break

bool TopWindow::AcceptBreak(int ID)
{
	if(Accept()) {
		Break(ID);
		return true;
	}
	return false;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:8,代码来源:TopWindow.cpp

示例10: Break

/*
================
idBrittleFracture::Event_Activate
================
*/
void idBrittleFracture::Event_Activate( idEntity* activator )
{
	disableFracture = false;
	if( health <= 0 )
	{
		Break();
	}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:13,代码来源:BrittleFracture.cpp

示例11: Break

void DbgGdb::SetBreakpoints()
{
    for ( size_t i=0; i< m_bpList.size(); i++ ) {
        // Without the 'unnecessary' cast in the next line, bpinfo.bp_type is seen as (e.g.) 4 instead of BP_type_tempbreak, ruining switch statments :/
        BreakpointInfo bpinfo = ( BreakpointInfo )m_bpList.at( i );
        Break( bpinfo );
    }
}
开发者ID:LoviPanda,项目名称:codelite,代码行数:8,代码来源:debuggergdb.cpp

示例12: ActivateTargets

/*
================
idBrittleFracture::Killed
================
*/
void idBrittleFracture::Killed( idEntity* inflictor, idEntity* attacker, int damage, const idVec3& dir, int location )
{
	if( !disableFracture )
	{
		ActivateTargets( this );
		Break();
	}
}
开发者ID:dcahrakos,项目名称:RBDOOM-3-BFG,代码行数:13,代码来源:BrittleFracture.cpp

示例13: Break

//-----------------------------------------------------------------------------
// Purpose: Take damage will break the rope
//-----------------------------------------------------------------------------
int CRopeKeyframe::OnTakeDamage( const CTakeDamageInfo &info )
{
	// Only allow this if it's been marked
	if( !(m_RopeFlags & ROPE_BREAKABLE) )
		return false;

	Break();
	return 0;
}
开发者ID:BenLubar,项目名称:SwarmDirector2,代码行数:12,代码来源:rope.cpp

示例14: Add

void CLogger::Error(char* szText)
{
	Add("ERROR", szText);

	if (msConfig.bBreakOnError)
	{
		Break();
	}
}
开发者ID:chrisjaquet,项目名称:Codaphela.Library,代码行数:9,代码来源:Logger.cpp

示例15: Break

void cyclic::Click()
{
  for(int i=0;i<16;i++)
  {
      dc[i]=cols[i].GetData();
  }
  par.change(colnum, dc);
  Break(IDOK);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:9,代码来源:main.cpp


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