本文整理匯總了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();
}
示例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();
}
示例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;
}
示例4: FCPause
void FCPause( void ) {
//=======================
// Process PAUSE statement.
Break( RT_PAUSE );
}
示例5: FCStop
void FCStop( void ) {
//======================
// Process STOP statement.
Break( RT_STOP );
}
示例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
}
示例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();
}
}
}
示例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);
}
}
示例9: Break
bool TopWindow::AcceptBreak(int ID)
{
if(Accept()) {
Break(ID);
return true;
}
return false;
}
示例10: Break
/*
================
idBrittleFracture::Event_Activate
================
*/
void idBrittleFracture::Event_Activate( idEntity* activator )
{
disableFracture = false;
if( health <= 0 )
{
Break();
}
}
示例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 );
}
}
示例12: ActivateTargets
/*
================
idBrittleFracture::Killed
================
*/
void idBrittleFracture::Killed( idEntity* inflictor, idEntity* attacker, int damage, const idVec3& dir, int location )
{
if( !disableFracture )
{
ActivateTargets( this );
Break();
}
}
示例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;
}
示例14: Add
void CLogger::Error(char* szText)
{
Add("ERROR", szText);
if (msConfig.bBreakOnError)
{
Break();
}
}
示例15: Break
void cyclic::Click()
{
for(int i=0;i<16;i++)
{
dc[i]=cols[i].GetData();
}
par.change(colnum, dc);
Break(IDOK);
}