bool CEventHandler::HookEvent(IUnknown* pSource) { #if defined(__USE_ADDBACK_DUAL) const HRESULT hr = AtlAdvise(pSource, GetUnknown(), __uuidof(IAddBackEvents), &cookie_); if (FAILED(hr)) return false; #elif defined(__USE_ADDBACK_DISPATCH) DispEventAdvise(pSource, &__uuidof(_IAddBackEvents)); #elif defined(__USE_ADDBACK_BYATTRIB_DISPATCH) __hook(&_IAddBackEvents::ChangedAddEnd, pSource, &CEventHandler::onChangedAddEnd); __hook(&_IAddBackEvents::ChangedSum, pSource, &CEventHandler::onChangedSum); #endif return true; }
CNdasDeviceHeartbeatHandler(INdasDeviceHeartbeat* pHeartbeater) : m_pHeartbeater(pHeartbeater) { __hook( &INdasDeviceHeartbeat::OnHeartbeat, m_pHeartbeater, &INdasDeviceHeartbeatHandler::OnHeartbeat, this); }
void FBullet::init() { _damage = 1; _sprite = SpriteManager::getInstance()->getSprite(eID::BULLET); _sprite->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::BULLET, "f_bullet")); this->setPosition(_startPosition); this->setScale(SCALE_FACTOR); GVector2 begin_veloc = Bullet::initveloc(F_BULLET_SPEED); auto movement = new Movement(GVector2(0, 0), begin_veloc, _sprite); _componentList.insert(pair<string, IComponent*>("Movement", movement)); float radian = this->initRadian(); auto roundmovement = new RoundMovement(ROUND_RADIUS, ROUND_FREQUENCE, radian, _sprite); _componentList["RoundMovement"] = roundmovement; //auto circlemovement = new CircleMovement(150.0f, 1.0f, _sprite); //_componentList["RoundMovement"] = circlemovement; auto collisionBody = new CollisionBody(this); _componentList.insert(pair<string, IComponent*>("CollisionBody", collisionBody)); __hook(&CollisionBody::onCollisionBegin, collisionBody, &Bullet::onCollisionBegin); }
void CNCaptureView::_EventHook() { BOOL bRet = FALSE; CNCaptureDoc* pDoc = CNCaptureApplication::Instance()->GetDocument(); FTLASSERT( NULL != pDoc ); __hook(&CNCaptureDoc::OnCaptureImageChanged, pDoc, &CNCaptureView::OnCaptureImageChanged, this ); }
HRESULT C_ICoBrokerEvents::EventAdvise(IUnknown *unkn) { TRY_CATCH m_unkn=unkn; return __hook(_ICoBrokerEvents,m_unkn); CATCH_THROW() }
void ShadowBeast::ShadowArm::init() { srand(599999); _hitpoint = 16; _score = 2000; Sprite* hand1 = SpriteManager::getInstance()->getSprite(eID::SHADOW_ARM); hand1->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::SHADOW_ARM, "arm")); hand1->setScale(SCALE_FACTOR); hand1->setPosition(_rootOfArm); Sprite* hand2 = SpriteManager::getInstance()->getSprite(eID::SHADOW_ARM); hand2->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::SHADOW_ARM, "arm")); hand2->setScale(SCALE_FACTOR); hand2->setPosition(_rootOfArm + GVector2(28, 14)); Sprite* hand3 = SpriteManager::getInstance()->getSprite(eID::SHADOW_ARM); hand3->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::SHADOW_ARM, "arm")); hand3->setScale(SCALE_FACTOR); hand3->setPosition(_rootOfArm + GVector2(42, 42)); Sprite* hand4 = SpriteManager::getInstance()->getSprite(eID::SHADOW_ARM); hand4->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::SHADOW_ARM, "arm")); hand4->setScale(SCALE_FACTOR); hand4->setPosition(_rootOfArm + GVector2(28, 70)); _sprite = SpriteManager::getInstance()->getSprite(eID::SHADOW_ARM); _sprite->setFrameRect(SpriteManager::getInstance()->getSourceRect(eID::SHADOW_ARM, "hand")); _sprite->setScale(SCALE_FACTOR); _sprite->setPosition(_rootOfArm + GVector2(0, 80)); roundCircletime = 0.0f; CollisionBody* collisionBody = new CollisionBody(this); this->_componentList["CollisionBody"] = collisionBody; __hook(&CollisionBody::onCollisionBegin, collisionBody, &Bullet::onCollisionBegin); //dư? _stopWatch = new StopWatch(); _aimtime = new StopWatch(); _trackBillTime = new StopWatch(); _explosion = nullptr; _isClockWise = false; _isAiming = false; flagforTrackBill = false; counterforFire = 0; _handelem1 = HandElement( hand1, 0.0f, 0 ); _handelem2 = HandElement( hand2, 0.0f, 32 ); _handelem3 = HandElement( hand3, 0.0f, 0 ); _handelem4 = HandElement( hand4, 0.0f, 0 ); _arm = HandElement( _sprite, 0.0f, 0 ); _flagAimFinish[0] = false; _flagAimFinish[1] = false; _flagAimFinish[2] = false; _flagAimFinish[3] = false; _waveCount = 0; _memStatus = normal; }
CSink(IBase* pS) { method(__hook(&IEvent::event2, pS, &CSink::f4)); __hook(&IEvent2::event1, pS, &CSink::f5); __hook(&IEvent2::event2, pS, &CSink::f6); __hook(&IEvent2::event3, pS, &CSink::f1); __hook(&IEvent::event1, pS, &CSink::f3); __hook(&N::IJW::event1, pS, &CSink::f2); }
Camera::Camera() : position(Vector3f(1.0f, 0.0f, 1.0f)), target(Vector3f::Zero), up(Vector3f::Up), backgroudColor(Color::Black), isViewValid(false) { const GraphicsManager::Configuration& config = GraphicsManager::Get()->GetConfiguration(); viewport.Width = (F32) config.screenWidth; viewport.Height = (F32) config.screenHeight; viewport.MinDepth = 0; viewport.MaxDepth = 1.0; viewport.TopLeftX = 0; viewport.TopLeftY = 0; __hook(&GraphicsManager::ScreenResizeEvent, GraphicsManager::Get(), &Camera::OnScreenResize, this); }
BOOL CTestAPIDlg::OnInitDialog() { CDialog::OnInitDialog(); tl->gtw->SubclassDlgItem(IDC_SESSION,this); __hook(&ServerGenesis::GotDebug,tl,&CTestAPIDlg::status); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon PostMessage(ATTEMPTLOGIN,0,0); ShowWindow(SW_MINIMIZE); return TRUE; // return TRUE unless you set the focus to a control }
STDMETHODIMP CXMLBuilder::Advise(IUnknown* pStrategy) { try { IMWStrategyPtr spStrategy = pStrategy; __hook(_IMWStrategyEvents, spStrategy); } catch(Workshare::Exception const& e) { return Error(e.Message, __uuidof(this), e.ErrorCode); } catch(...) { return ProcessUnhandledException(); } return S_OK; }
void Engine::StartUp() { _ASSERT(engineController); TimeManager::StartUp(); Logger::StartUp(engineController); EventManager::StartUp(); InputManager::StartUp(InputManager::Configuration::CreateDefault()); SoundManager::StartUp(SoundManager::Configuration::CreateDefault()); GraphicsManager::Configuration graphicsConfiguration = GraphicsManager::Configuration::CreateDefault(); graphicsConfiguration.hWnd = (HWND) (engineController->GetWindowHandle()); GraphicsManager::StartUp(graphicsConfiguration); ResourceManager::Configuration resourceManagerConfig = ResourceManager::Configuration::CreateDefault(); resourceManagerConfig.dataRootDir = dataRootDir; ResourceManager::StartUp(resourceManagerConfig); __hook(&EngineController::CheckForLiveUpdates, engineController, &ResourceManager::CheckForLiveUpdates, ResourceManager::Get()); RenderManager::StartUp(RenderManager::Configuration::CreateDefault()); SceneManager::StartUp(SceneManager::Configuration::CreateDefault()); ScriptEngine::StartUp(this); initialized = true; }
void Module::Load() { if (IsActive()) return; // Hook up all the events __hook(&ModuleManager::OnDraw, BH::moduleManager, &Module::OnDraw, this); __hook(&ModuleManager::OnAutomapDraw, BH::moduleManager, &Module::OnAutomapDraw, this); __hook(&ModuleManager::OnOOGDraw, BH::moduleManager, &Module::OnOOGDraw, this); __hook(&ModuleManager::OnGameJoin, BH::moduleManager, &Module::OnGameJoin, this); __hook(&ModuleManager::OnGameExit, BH::moduleManager, &Module::OnGameExit, this); __hook(&ModuleManager::OnLoop, BH::moduleManager, &Module::OnLoop, this); __hook(&ModuleManager::OnLeftClick, BH::moduleManager, &Module::OnLeftClick, this); __hook(&ModuleManager::OnRightClick, BH::moduleManager, &Module::OnRightClick, this); __hook(&ModuleManager::OnKey, BH::moduleManager, &Module::OnKey, this); __hook(&ModuleManager::OnChatPacketRecv, BH::moduleManager, &Module::OnChatPacketRecv, this); __hook(&ModuleManager::OnRealmPacketRecv, BH::moduleManager, &Module::OnRealmPacketRecv, this); __hook(&ModuleManager::OnGamePacketRecv, BH::moduleManager, &Module::OnGamePacketRecv, this); __hook(&ModuleManager::OnChatMsg, BH::moduleManager, &Module::OnChatMsg, this); __hook(&Module::UserInput, this, &Module::OnUserInput, this); active = true; OnLoad(); }
void GestureReceiver::hookEvent(GestureSource* pSource) { __hook(&GestureSource::MyEvent, pSource, &GestureReceiver::MyHandler1); __hook(&GestureSource::MyEvent, pSource, &GestureReceiver::MyHandler2); __hook(&GestureSource::MyEvent2, pSource, &GestureReceiver::MyHandler3); __hook(&GestureSource::GestureRecognised, pSource, &GestureReceiver::ExecutionAfterDetection); }
void hookEvent(KeyHandler* pSource) { __hook(&KeyHandler::Rotate, pSource, &Uebung1::Rotate); }