void moEffectSound::Update( moEventList *Events ) { //get the pointer from the Moldeo Object sending it... moMoldeoObject::Update(Events); ///SE APAGA EL SONIDO SI EL EFECTO ESTA DESACTIVADO if ( Activated() && m_Config.Sound( moR(SOUND_SOUND) ).State()!=MO_STREAMSTATE_PLAYING ) { m_Config.Sound( moR(SOUND_SOUND) ).Play(); } else if ( !Activated() && m_Config.Sound( moR(SOUND_SOUND) ).State()==MO_STREAMSTATE_PLAYING ) { m_Config.Sound( moR(SOUND_SOUND) ).Pause(); } }
/*********** SET CONTENT CONTAINER VISIBLE ************/ void QmitkFunctionalityComponentContainer::SetContentContainerVisibility(bool) { if(GetMainCheckBoxContainer() != NULL) { if(GetMainCheckBoxContainer()->isChecked()) { Activated(); } else { Deactivated(); } } for(unsigned int i = 0; i < m_AddedChildList.size(); i++) { if(m_AddedChildList[i]->GetContentContainer() != NULL) { m_AddedChildList[i]->GetContentContainer()->setShown(GetMainCheckBoxContainer()->isChecked()); } if(m_AddedChildList[i]->GetMainCheckBoxContainer() != NULL) { m_AddedChildList[i]->GetMainCheckBoxContainer()->setChecked(GetMainCheckBoxContainer()->isChecked()); } m_AddedChildList[i]->SetContentContainerVisibility(GetMainCheckBoxContainer()->isChecked()); } }
bool nuiToggleButton::MouseUnclicked (nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { if ( (Button & nglMouseInfo::ButtonLeft) && mClicked) { mClicked = false; Ungrab(); if (IsInsideFromSelf(X,Y, GetActivationOffset())) { SetPressed(!mWasPressed); if (IsPressed()) Activated(); else Deactivated(); } else { SetPressed(mWasPressed); } Invalidate(); return true; } return false; }
// Received Mouse events: bool nuiButton::MouseClicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { if (IsDisabled()) return false; if (Button & nglMouseInfo::ButtonLeft) { // printf("clicked\n"); mClicked = true; SetPressed(true); Invalidate(); if (mAutoRepeat) { Activated(); mLastTime = nglTime(); mCurrentRepeatDelay = mRepeatDelay; mUntilRepeat = mCurrentRepeatDelay; if (!mpAutoRepeatTimer) { mpAutoRepeatTimer = nuiAnimation::AcquireTimer(); mEventSink.Connect(mpAutoRepeatTimer->Tick, &nuiButton::OnAutoRepeat); } } return true; } return false; }
Bullet_enemy::Bullet_enemy(int power): Bullet(power){ //different bullet image according to level switch(power){ case 50: image = new QPixmap(":/images/Bullet_Normal.bmp"); image->setMask(image->createMaskFromColor(QColor(255,0,170))); setPixmap(*image);break; case 100: image = new QPixmap(":/images/Bullet_Normal.bmp"); image->setMask(image->createMaskFromColor(QColor(255,0,170))); setPixmap(*image);break; case 150: image = new QPixmap(":/images/Bullet_Punch.bmp"); image->setMask(image->createMaskFromColor(QColor(255,0,170))); setPixmap(*image);break; case 200: image = new QPixmap(":/images/Bullet_Punch.bmp"); image->setMask(image->createMaskFromColor(QColor(255,0,170))); setPixmap(*image);break; default:image = new QPixmap(":/images/Bullet_Punch.bmp"); image->setMask(image->createMaskFromColor(QColor(255,0,170))); setPixmap(*image);break; } AttackPower=power; Activated(1); connect(move_timer,SIGNAL(timeout()),this,SLOT(move())); }
bool nuiButton::MouseUnclicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { // printf("unclicked\n"); if ( (Button & nglMouseInfo::ButtonLeft) && mClicked) { // printf("was clicked\n"); mClicked = false; SetPressed(false); Invalidate(); if (!mAutoRepeat) { if (IsInsideFromSelf(X,Y, GetActivationOffset())) { // printf("activated\n"); Activated(); } else { // printf("unclicked inactive\n"); ButtonDePressedInactive(); } } return true; } return false; }
void trigger_onlyregistered_touch( ) { gedict_t *te; if ( strneq( other->s.v.classname, "player" ) ) return; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( self->attack_finished > g_globalvars.time ) return; self->attack_finished = g_globalvars.time + 2; if ( trap_cvar( "registered" ) ) { self->s.v.message = ""; activator = other; SUB_UseTargets( ); ent_remove( self ); } else { if ( self->s.v.message && strneq( self->s.v.message, "" ) ) { G_centerprint( other, "%s", self->s.v.message ); sound( other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM ); } } }
void multi_touch( ) { gedict_t *te; if ( !other->s.v.classname ) return; if ( strneq( other->s.v.classname, "player" ) ) return; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( !VectorCompareF( self->s.v.movedir, 0, 0, 0 ) ) { trap_makevectors( other->s.v.angles ); if ( DotProduct( g_globalvars.v_forward, self->s.v.movedir ) < 0 ) return; // not facing the right way } self->s.v.enemy = EDICT_TO_PROG( other ); multi_trigger( ); }
asizei WindowsNetwork::SleepOn(std::vector<SocketInterface*> &read, std::vector<SocketInterface*> &write, asizei timeoutms) { /* This is going to be more complicated than expected because this function really does two things. 1- it transitions connecting sockets to connected 2- it does a proper sleep. I would just test the connecting sockets first and then the "ready" sockets, but this would imply a connection timeout could stop everything. I also cannot just put the object in the queue as there's no real socket object in the interface until it is connected. */ fd_set readReady; fd_set writeReady; fd_set failures; FD_ZERO(&readReady); FD_ZERO(&writeReady); FD_ZERO(&failures); SOCKET biggest = max(BiggestSocket(failures, readReady, read), BiggestSocket(failures, writeReady, write)); biggest++; // select needs a +1 to test with strict inequality < timeval timeout; timeout.tv_sec = long(timeoutms / 1000); timeout.tv_usec = (timeoutms % 1000) * 1000; int result = select(int(biggest), &readReady, &writeReady, &failures, &timeout); if(!result) { for(auto &el : read) el = nullptr; for(auto &el : write) el = nullptr; return 0; } if(result < 1) throw std::exception("Some error occured while waiting for sockets to connect."); asizei awaken = 0; for(auto &socket : read) { if(Activated(failures, socket, readReady) == false) socket = nullptr; else { awaken++; // a read handle awakens on connection close as well! Check it out by peeking at data. auto el = connections.find(socket); if(el == connections.end()) continue; abyte byte; int res = recv(el->second->socket, &byte, sizeof(byte), MSG_PEEK); if(res <= 0) { // 0- connection closed gracefully, <0 aborted, see error auto err = GetSocketError(); el->second->failed = true; } } } for(asizei loop = 0; loop < write.size(); loop++) { if(Activated(failures, write[loop], writeReady) == false) write[loop] = nullptr; else awaken++; } return awaken; }
void Component::Activate() { if (!Active) { Active = true; Activated(); } }
bool UGlobalHotkeys::winEvent(MSG * message, long * result) { Q_UNUSED(result); if (message->message == WM_HOTKEY) { size_t id = message->wParam; Q_ASSERT(Registered.find(id) != Registered.end() && "Unregistered hotkey"); emit Activated(id); } return false; }
bool Toolbar::OnActivated(const nuiEvent& rEvent) { // get button ID uint32 ID = (uint32)rEvent.mpUser; mActivatedButton = mButtons[ID].first; // report event to client Activated(); return true; }
void QmitkVirtualSurgery::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->m_TreeNodeSelector), SIGNAL(Activated(mitk::DataTreeIteratorClone)),(QObject*) this, SLOT(ImageSelected(mitk::DataTreeIteratorClone)) ); connect( (QObject*)(m_Controls->m_StartButton), SIGNAL(clicked()),(QObject*) this, SLOT(StartButtonClicked())); connect( (QObject*)(m_Controls->m_btnManualErode), SIGNAL(clicked()),(QObject*) this, SLOT(ManualErodeVesselClicked())); connect( (QObject*)(m_Controls->m_btnPortalVeinSegment), SIGNAL(clicked()),(QObject*) this, SLOT(PortalVeinSegmentButtonClicked())); } }
// Activate: void nuiButton::Activate() { SetPressed(true); Activated(); if (mpTask) { mpTask->Cancel(); mpTask->Release(); mpTask = NULL; } mpTask = nuiMakeTask(this, &nuiButton::SetPressed, false); mpTask->Acquire(); nuiAnimation::RunOnAnimationTick(mpTask, 4); }
bool UGlobalHotkeys::linuxEvent(xcb_generic_event_t *message) { if ( (message->response_type & ~0x80) == XCB_KEY_PRESS ) { xcb_key_press_event_t *ev = (xcb_key_press_event_t*)message; auto ind = Registered.key( {ev->detail, (ev->state & ~XCB_MOD_MASK_2)} ); if (ind == 0) // this is not hotkeys return false; emit Activated(ind); return true; } return false; }
// Keyboard events: bool nuiToggleButton::KeyDown(const nglKeyEvent& rEvent) { if (rEvent.mKey == NK_ENTER || rEvent.mKey == NK_PAD_ENTER || rEvent.mKey == NK_SPACE) { mWasPressed = IsPressed(); SetPressed(!mWasPressed); if (IsPressed()) Activated(); else Deactivated(); return true; } return false; }
Complexity Consequent::complexity(const TNorm* implication) const { Complexity result; result.comparison(1); for (std::size_t i = 0; i < _conclusions.size(); ++i) { Proposition* proposition = _conclusions.at(i); result.comparison(2); for (std::size_t h = 0; h < proposition->hedges.size(); ++h) { result += proposition->hedges.at(h)->complexity(); } result += static_cast<OutputVariable*> (proposition->variable) ->complexity(Activated(proposition->term, fl::nan, implication)); } return result; }
bool nuiHyperLink::MouseUnclicked(nuiSize X, nuiSize Y, nglMouseInfo::Flags Button) { if (mClicked && (Button & nglMouseInfo::ButtonLeft)) { mClicked--; Ungrab(); if (!Activated()) { // Open url in default browser nuiURL url(mURL); url.OpenBrowser(); SetUnderline(false); } return true; } return false; }
void nuiFileTree::OnNodeActivated(const nuiEvent& rEvent) { nuiFileSelectorNode* pNode = (nuiFileSelectorNode*)rEvent.mpUser; nglPath path(pNode->GetProperty(_T("Path"))); mActivatedPath = path; // send signal bool res = Activated(); if (!res && !path.IsLeaf() && !path.IsBundle()) { SetRootPath(path); SetPath(path); } rEvent.Cancel(); }
void nuiButton::OnAutoRepeat(const nuiEvent& rEvent) { if (!mAutoRepeat) return; if (IsPressed()) { nglTime now; mUntilRepeat -= (now.GetValue() - mLastTime.GetValue()); mLastTime = now; if (mUntilRepeat <= 0) { mCurrentRepeatDelay = MAX(mRepeatMinDelay, mCurrentRepeatDelay-mCurrentRepeatDelay/4.0); mUntilRepeat = mCurrentRepeatDelay; Activated(); } } }
ConfigWidget::ConfigWidget(QMap<QString, QString> &languages, QWidget *parent) : QWidget(parent), _languages(languages), _hotKeys(new UGlobalHotkeys(parent)) { _ui.setupUi(this); this->setGeometry(QDesktopWidget().availableGeometry().center().x() - (this->width() / 2), QDesktopWidget().availableGeometry().center().y() - (this->height() / 2), this->width(), this->height()); this->setFixedSize(this->size()); connect(_ui.cancelButton, SIGNAL(clicked()), this, SLOT(hide())); connect(_ui.applyButton, SIGNAL(clicked()), this, SLOT(applyChanges())); // Config window connect(_ui.fullhotkey, SIGNAL(clicked()), this, SLOT(changeHotkey())); connect(_ui.parthotkey, SIGNAL(clicked()), this, SLOT(changeHotkey())); connect(_ui.texthotkey, SIGNAL(clicked()), this, SLOT(changeHotkey())); connect(_hotKeys, SIGNAL(Activated(size_t)), this, SIGNAL(hotkeyActivated(size_t))); registerActualHotkeys(); }
void Bullet_enemy::move() { QList<QGraphicsItem *> colliding_tower=this->collidingItems(); //bullet collides, get colliding item lists for(size_t i=0, n=colliding_tower.size();i<n;i++){ Tower* tower=dynamic_cast<Tower *>(colliding_tower[i]); //only tower item can be casted if(tower){ //if colliding item is tower tower->IsHitBy(AttackPower*2); //hit the tower Activated(0); //stop to move game->scene->removeItem(this); delete image; delete this; return; } } double theta = rotation(); //set theta double dy = STEP*qSin(qDegreesToRadians(theta)); //set x_step size, y_step size double dx = STEP*qCos(qDegreesToRadians(theta)); setPos(x()+dx,y()+dy); //move }
void trigger_push_touch( ) { gedict_t *te; if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } if ( streq( other->s.v.classname, "grenade" ) ) { other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10; other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10; other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10; } else if ( other->s.v.health > 0 ) { // other->s.v.velocity = self->speed * self->s.v.movedir * 10; other->s.v.velocity[0] = self->speed * self->s.v.movedir[0] * 10; other->s.v.velocity[1] = self->speed * self->s.v.movedir[1] * 10; other->s.v.velocity[2] = self->speed * self->s.v.movedir[2] * 10; if ( streq( other->s.v.classname, "player" ) ) { if ( other->fly_sound < g_globalvars.time ) { other->fly_sound = g_globalvars.time + 1.5; sound( other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM ); } } } if ( ( int ) ( self->s.v.spawnflags ) & PUSH_ONCE ) ent_remove( self ); }
void hurt_touch( ) { gedict_t *te; if ( other->s.v.takedamage ) { if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } self->s.v.solid = SOLID_NOT; tf_data.deathmsg = DMSG_TRIGGER; TF_T_Damage( other, self, self, self->dmg, 1, 0 ); self->s.v.think = ( func_t ) hurt_on; self->s.v.nextthink = g_globalvars.time + 1; } }
// jumppad (engbatxr, etc) void trigger_jumper_touch ( ) { gedict_t *finder; if ( !Activated( self, other ) ) { if ( self->else_goal ) { finder = Findgoal( self->else_goal ); if ( finder) DoResults ( finder, other, ( self->goal_result & 2)); } return; } if ( other->s.v.classname == "grenade" || !streq( other->s.v.classname, "player" ) ) return; else { if ( other->s.v.health > 0 && !self->armorclass ) { other->s.v.velocity[2] = self->speed * 7; if ( streq( other->s.v.classname, "player" ) ) { if ( other->fly_sound < g_globalvars.time ) { other->fly_sound = g_globalvars.time + 1.5; if ( !( ( int ) self->s.v.spawnflags & 2 ) ) sound ( other, 0, "misc/boing.wav", 1, 1); } } } } if ( (int) self->s.v.spawnflags & 1 ) dremove ( self ); }
void teleport_touch( ) { gedict_t *t, *te; vec3_t org; if ( self->s.v.targetname ) { if ( self->s.v.nextthink < g_globalvars.time ) { return; // not fired yet } } if ( ( int ) ( self->s.v.spawnflags ) & PLAYER_ONLY ) { if ( strneq( other->s.v.classname, "player" ) ) return; } if ( !Activated( self, other ) ) { if ( self->else_goal ) { te = Findgoal( self->else_goal ); if ( te ) AttemptToActivate( te, other, self ); } return; } // only teleport living creatures if ( other->s.v.health <= 0 || other->s.v.solid != SOLID_SLIDEBOX ) return; // activator = other; SUB_UseTargets( ); //put a tfog where the player was spawn_tfog( other->s.v.origin ); t = trap_find( world, FOFS( s.v.targetname ), self->s.v.target ); if ( !t ) G_Error( "couldn't find target" ); // spawn a tfog flash in front of the destination trap_makevectors( t->mangle ); org[0] = t->s.v.origin[0] + 32 * g_globalvars.v_forward[0]; org[1] = t->s.v.origin[1] + 32 * g_globalvars.v_forward[1]; org[2] = t->s.v.origin[2] + 32 * g_globalvars.v_forward[2]; spawn_tfog( org ); spawn_tdeath( t->s.v.origin, other ); // move the player and lock him down for a little while if ( !other->s.v.health ) { VectorCopy( t->s.v.origin, other->s.v.origin ); other->s.v.velocity[0] = ( g_globalvars.v_forward[0] * other->s.v.velocity[0] ) + ( g_globalvars.v_forward[0] * other->s.v.velocity[1] ); other->s.v.velocity[1] = ( g_globalvars.v_forward[1] * other->s.v.velocity[0] ) + ( g_globalvars.v_forward[1] * other->s.v.velocity[1] ); other->s.v.velocity[2] = ( g_globalvars.v_forward[2] * other->s.v.velocity[0] ) + ( g_globalvars.v_forward[2] * other->s.v.velocity[1] ); //other->s.v.velocity = (v_forward * other->s.v.velocity[0]) + (v_forward * other->s.v.velocity[1]); return; } setorigin( other, PASSVEC3( t->s.v.origin ) ); VectorCopy( t->mangle, other->s.v.angles ); // other.angles = t.mangle; if ( streq( other->s.v.classname, "player" ) ) { if ( other->s.v.weapon == 1 && other->hook_out ) { sound( other, 1, "weapons/bounce2.wav", 1, 1 ); other->on_hook = 0; other->hook_out = 0; other->fire_held_down = 0; other->s.v.weaponframe = 0; other->attack_finished = g_globalvars.time + 0.75; } other->s.v.fixangle = 1; // turn this way immediately other->s.v.teleport_time = g_globalvars.time + 0.7; if ( ( int ) other->s.v.flags & FL_ONGROUND ) other->s.v.flags = other->s.v.flags - FL_ONGROUND; VectorScale( g_globalvars.v_forward, 300, other->s.v.velocity ); // other->s.v.velocity = v_forward * 300; } other->s.v.flags -= ( int ) other->s.v.flags & FL_ONGROUND; }
void View::SetActive( bool active ) { _active = active; Activated( active ); }
void Game::OnActivated(Object * const sender, EventArgs * const args) { Activated(sender, args); }