Esempio n. 1
0
void ID3DApplication::Release(void)
{
    if (m_pDevice)
    {
        // call pure virtual OnRelease
        OnRelease();

        if (m_pFont)
        {
            m_pFont->Release();
            m_pFont = NULL;
        }
        if (m_pSprite)
        {
            m_pSprite->Release();
            m_pSprite = NULL;
        }

        m_pDevice->Release();
        m_pDevice =  NULL;

        if (m_pD3D)
        {
            m_pD3D->Release();
            m_pD3D = NULL;
        }
    }
}
Esempio n. 2
0
void cbPlugin::Release(bool appShutDown)
{
    if (!m_IsAttached)
        return;
    m_IsAttached = false;
    SetEvtHandlerEnabled(false);
    OnRelease(appShutDown);

    CodeBlocksEvent event(cbEVT_PLUGIN_RELEASED);
    event.SetPlugin(this);
    // ask the host to process this event immediately
    // it must be done this way, because if the host references
    // us (through event.GetEventObject()), we might not be valid at that time
    // (while, now, we are...)
    Manager::Get()->ProcessEvent(event);

    if (appShutDown)
        return; // nothing more to do, if the app is shutting down

    wxWindow* window = Manager::Get()->GetAppWindow();
    if (window)
    {
        // remove ourself from the application's event handling chain...
        window->RemoveEventHandler(this);
    }
}
Esempio n. 3
0
void Session::ReleaseRef()
{
	long ret = InterlockedDecrement(&mRefCount);
	CRASH_ASSERT(ret >= 0);

	if (ret == 0)
	{
		OnRelease();
	}
}
Esempio n. 4
0
 void Dialog::mousePressEvent(QMouseEvent* e)
 {
     if(e->button()==Qt::LeftButton)
     {
        this->isDrag=true;
     }
     QString *color;
     QString *title;
     switch (this->objectType) {
     case 1:
         color=new QString("border:2px groove gray;border-radius:10px;padding:2px 4px;background-color: rgb(255, 74, 19)");
         title=new QString("开始");
         break;
     case 2:
          color=new QString("border:2px groove gray;border-radius:10px;padding:2px 4px;background-color: rgb(255, 74, 19)");
          title=new QString("结束");
          break;
     case 3:
          color=new QString("background-color: rgb(33, 224, 255)");
          title=new QString("自动");
          break;
     case 4:
          color=new QString("background-color: rgb(84, 255, 160) ");
          title=new QString("人工");
          break;
     case 5:
          color=new QString("background-color:rgb(255, 241, 42)");
          title=new QString("条件");
          break;
     default:
         QMessageBox::information(this, tr("Information"), "请选择节点类型");
         return ;
     }

        QPushButton *btn=new QPushButton(this);
        title->append(QString(":%1").arg(this->lst->count(),this->objectType));
        btn->setText(*title);
        btn->setGeometry(QRect(e->x()-50, e->y()-10, 100, 20));

         btn->setStyleSheet(*color);
        btn->show();
        btn->setObjectName(QString("btn%1").arg(this->lst->count()));
        connect(btn, SIGNAL(clicked()), this, SLOT(OnClicked()));
        connect(btn,SIGNAL(pressed()),this,SLOT(OnPress()));
        connect(btn,SIGNAL(released()),this,SLOT(OnRelease()));
        TaskNode *node=new TaskNode(btn,this->objectType);
        node->params=NULL;
        node->postTask=NULL;
        node->prevTask=NULL;
        node->majorTask=NULL;
        this->lst->append(node);
        //this->ui->txtLog->setText(QString(":%1").arg(this->lst->count()));
 }
Esempio n. 5
0
//**関数***************************************************************************
//	概要	:	あたり判定
//*********************************************************************************
void CObjButton::CheckCollision()
{
	// 未使用時は処理なし
	if(m_nStatus == eButtonState::INACTIVE) 
		return;

	CDXInput* pInput = MANAGER.GetInput();

	switch(m_nStatus)
	{
	case eButtonState::DEFAULT:
		if(CCalc::IntersectBox2D(this->GetHitRect() , pInput->GetMouseHitRect()))
			SetState(eButtonState::HOVER);
		break;

	case eButtonState::HOVER:
		if(! (CCalc::IntersectBox2D(this->GetHitRect() , pInput->GetMouseHitRect() )) )
			SetState(eButtonState::DEFAULT);

		if(pInput->GetMouseTrigger(0))
			OnTrigger();
		else if(pInput->GetMouseRelease(0))
			OnRelease();
		break;

	case eButtonState::ACTIVE:

		if(pInput->GetMouseTrigger(0))
			OnTrigger();
		else if(pInput->GetMouseRelease(0))
			OnRelease();
		break;

	default:
		// エラー
		break;
	}

	return;
}
Esempio n. 6
0
void Button::released(){
	if(millis() - m_StartTime > BUTTON_LONG_PRESS_TIMEOUT){
		if(OnLongRelease != 0){
			OnLongRelease();
		}
		reset();
	}
	else{
		if(OnRelease != 0){
			OnRelease();
		}
		m_HitCount++;
		m_IsPressed = false;
	}
}
Esempio n. 7
0
// this is the main message handler for the program
LRESULT CALLBACK WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch(message)
    {
        case WM_DESTROY:
        {
			::exit(0);
            PostQuitMessage(0);
            return 0;
        } 
        case WM_SIZE:
        {
			// If the device is not NULL and the WM_SIZE message is not a
			// SIZE_MINIMIZED event, resize the device's swap buffers to match
			// the new window size.
			if( d3ddev != NULL && wParam != SIZE_MINIMIZED )
			{
				OnRelease();

				ScreenX					= LOWORD(lParam);	
				ScreenY					= HIWORD(lParam);
				d3dpp.BackBufferWidth  = LOWORD(lParam);
				d3dpp.BackBufferHeight = HIWORD(lParam);

				//if(
				d3ddev->Reset( &d3dpp )
                // == D3DERR_INVALIDCALL )
                //{
                   //error
                //}
				;
				OnInitialize(false);
			}
        }
		break;
    }

    return DefWindowProc (hWnd, message, wParam, lParam);
}
Esempio n. 8
0
void wxDynamicSashWindowImpl::OnRelease(wxMouseEvent &event)
{
    if ((m_dragging == DSR_CORNER) &&
        (m_window->GetWindowStyle() & wxDS_DRAG_CORNER) != 0)
    {
        DrawSash(m_drag_x, m_drag_y);
        m_container->ReleaseMouse();

        Resize(event.m_x, event.m_y);

        m_dragging = DSR_NONE;
    }
    else if (m_dragging)
    {
        DrawSash(m_drag_x, m_drag_y);
        m_container->ReleaseMouse();

        wxSize size = m_container->GetSize();
        int px = (int)((event.m_x * 100) / size.GetWidth() + 0.5);
        int py = (int)((event.m_y * 100) / size.GetHeight() + 0.5);

        if ((m_dragging == DSR_HORIZONTAL_TAB && py >= 10 && py <= 90)
                    || (m_dragging == DSR_VERTICAL_TAB && px >= 10 && px <= 90))
        {
            if (m_child[0] == NULL)
            {
                Split(px, py);
            }
            else
            {
                /*  It would be nice if moving *this* sash didn't implicitly move
                    the sashes of our children (if any).  But this will do.  */
                wxLayoutConstraints *layout = m_child[0]->m_container->GetConstraints();
                if (m_split == DSR_HORIZONTAL_TAB)
                {
                    layout->height.PercentOf(m_container, wxHeight, py);
                }
                else
                {
                    layout->width.PercentOf(m_container, wxWidth, px);
                }
                m_container->Layout();
            }
        }
        else
        {
            if (m_child[0] != NULL)
            {
                if ((m_dragging == DSR_HORIZONTAL_TAB && py <= 10)
                        || (m_dragging == DSR_VERTICAL_TAB && px <= 10))
                {
                    Unify(1);
                }
                else
                {
                    Unify(0);
                }
            }
        }

        wxCursor cursor;
        if (m_split == DSR_HORIZONTAL_TAB)
            cursor = wxCursor(wxCURSOR_SIZENS);
        else if (m_split == DSR_VERTICAL_TAB)
            cursor = wxCursor(wxCURSOR_SIZEWE);
        else
            cursor = wxCursor(wxCURSOR_ARROW);

        m_container->SetCursor(cursor);

        m_dragging = DSR_NONE;
    }
    else if (m_leaf)
    {
        m_leaf->OnRelease(event);
    }
}
Esempio n. 9
0
CNWNXBase::~CNWNXBase()
{
    // The OnRelease function is always called before
    // an instance is deleted
    OnRelease ();
}
Esempio n. 10
0
void IService::OnStop ()
{
    OnRelease();

    m_io_service.stop();
}
Esempio n. 11
0
void UIScrollView::EventRelease()
{
	OnRelease();
}
Esempio n. 12
0
UIWidget* UIScrollView::ProcessTouch(UILayer::TouchType eType, cocos2d::CCTouch* pkTouch)
{
	static CCPoint s_kBeganPos;
	static bool s_bScroll;
	static VeFloat32 s_f32InnerNodeStart;

	if(m_bCanScroll)
	{
		if(m_bEnabled && m_bVisible)
		{
			switch(eType)
			{
			case UILayer::TOUCH_BEGAN:
				m_pkScrollBarV->setVisible(false);
				m_bShowScrollBar = false;
				m_bOnTouch = true;
				s_bScroll = false;
				m_bRollBack = false;
				s_kBeganPos = pkTouch->getLocation();
				m_f32Velocity = 0.0f;
				{
					UIWidget* pkWidget = UIWidget::ProcessTouch(eType, pkTouch);
					if(pkWidget) return pkWidget;
				}
				break;
			case UILayer::TOUCH_MOVED:
				m_bOnTouch = true;
				if(s_bScroll)
				{
					VeFloat32 f32DeltaY = pkTouch->getLocation().y - pkTouch->getPreviousLocation().y;
					if(((-s_f32InnerNodeStart) < m_f32MoveBottom) || ((-s_f32InnerNodeStart) > m_f32MoveTop))
					{
						f32DeltaY *= 0.3f;
						m_f32Velocity = 0;
					}
					else
					{
						m_f32Velocity = f32DeltaY * EVENT_RATE;
						m_f32Velocity = VE_MIN(m_f32Velocity, VELOCITYMAX);
						m_f32Velocity = VE_MAX(m_f32Velocity, -VELOCITYMAX);
					}
					s_f32InnerNodeStart += f32DeltaY;
					m_pkInnerNode->setPositionY(VeFloorf(s_f32InnerNodeStart));
					UpdateScrollBar();
				}
				else
				{
					if(VeFabsf(pkTouch->getLocation().y - s_kBeganPos.y) > (10.0f * ui_main_scale))
					{
						m_bShowScrollBar = true;
						m_fHideScrollBarPass = 0;
						m_pkScrollBarV->setVisible(true);
						m_apkScrollBarV[0]->setOpacity(m_ubyOpacity);
						m_apkScrollBarV[1]->setOpacity(m_ubyOpacity);
						m_apkScrollBarV[2]->setOpacity(m_ubyOpacity);
						s_bScroll = true;
						s_f32InnerNodeStart = m_pkInnerNode->getPositionY();
					}
					else
					{
						UIWidget* pkWidget = UIWidget::ProcessTouch(eType, pkTouch);
						if(pkWidget) return pkWidget;
					}
				}
				break;
			case UILayer::TOUCH_ENDED:
			case UILayer::TOUCH_CANCELLED:
				{
					UIWidget* pkWidget = UIWidget::ProcessTouch(eType, pkTouch);
					if(pkWidget)
					{
						return pkWidget;
					}
					else
					{
						OnRelease();
					}
				}
				break;
			default:
				break;
			}
			return this;
		}
		else
		{
			m_bOnTouch = false;
			return NULL;
		}
	}
	else
	{
		return UIWidget::ProcessTouch(eType, pkTouch);
	}
}
Esempio n. 13
0
CNWNXODBC::~CNWNXODBC()
{
	OnRelease ();
}
Esempio n. 14
0
CNWNXReset::~CNWNXReset()
{
	OnRelease();
}
Esempio n. 15
0
CNWNXMessages::~CNWNXMessages(){OnRelease();}
Esempio n. 16
0
void CGameClient::OnActivateEditor()
{
	OnRelease();
}
Esempio n. 17
0
CNWNXConnect::~CNWNXConnect(){OnRelease();}
Esempio n. 18
0
void WinApp::Release()
{

	OnRelease();
}
Esempio n. 19
0
void XSpriteBatchNode::ResHandle( long lParam )
{
	XFUNC_START();
	do 
	{
		const char* szPath = NULL;
		XResType* pResType = XResLoader::Instance().GetResByID(lParam);
		if (!pResType)
		{
			break;
		}
		CCTexture2D* pTex;
		if (XResType::ePng == pResType->GetType())
		{
			XResPNG* pRes = dynamic_cast<XResPNG*>(pResType);
			if (!pRes)
			{
				break;
			}
			XTexture2D* &pCTex = pRes->m_pTexture;
			if (!pCTex)
			{
				break;
			}
			if (pRes->m_pImage)
			{
				bool bRes = XTextureCache::Instance().InitTexture(pRes->m_szPath, pRes->m_pImage, pCTex);
				if (!bRes)
				{
					break;
				}
				// Òѽ«Í¼Æ¬×ª»¯ÎªÌùͼ£¬É¾³ýͼƬ£¬ÊÍ·ÅÄÚ´æ¡£
				delete pRes->m_pImage;
				pRes->m_pImage = NULL;
			}
			pTex = pCTex;
			szPath = pRes->m_szPath;
		}
		else
		{
			break;
			//// ѹËõÎÆÀí
			//XResCompressed* pRes = dynamic_cast<XResCompressed*>(pResType);
			//if (!pRes)
			//{
			//	break;
			//}
			//XTexture2D* &pXTex = pRes->m_pTexture;
			//if (!pXTex)
			//{
			//	break;
			//}
			//if (!pRes->m_byTexInited)
			//{
			//	bool bRes = XTextureCache::Instance().InitTexture(pRes->m_szPath, pXTex, pRes->m_pTexAlpha);
			//	if (!bRes)
			//	{
			//		break;
			//	}
			//	pRes->m_byTexInited = 0xFF;
			//}
			//if (pRes->m_pTexAlpha)
			//{
			//	m_pTexKtxAlpha = pRes->m_pTexAlpha;
			//	m_pTexKtxAlpha->retain();
			//	m_pShaderKTX = XShader::GetShader(this, XShader::eETC);
			//}			
			//pTex = pXTex;
			//szPath = pRes->m_szPath;
		}
		if(_byAntiAlias)
			pTex->setAntiAliasTexParameters();
		else
			pTex->setAliasTexParameters();
		// ´´½¨¾«Áé
		XSBNChildInfo* pHead = _stChildren._pHead;
		XSBNChildInfo* pUsed;
		int nPos = 0;
		while(pHead)
		{
			pUsed = pHead;
			pHead = pHead->_pNext;
			XSprite* pSprite = XSprite::createWithTexture(pTex, pUsed->stRect, _byAntiAlias);
			if (!pSprite)
			{
				CCLOG("XSprite::createWithTexture failed!");
				continue;
			}
			if (pUsed->byFlipX)
			{
				pSprite->setFlipX(true);
			}
			pSprite->setAnchorPoint(ccp(0.f, 0.f));
			pSprite->setPosition(ccp(pUsed->fPosX, pUsed->fPosY));
			pSprite->setScaleY(_fChildrenScaleY);
			CCSpriteBatchNode::addChild(pSprite, pSprite->getZOrder(), nPos++);
			XMP_RELEASE(XSBNChildInfo, pUsed);
		}
		_stChildren.Clear();
		_bResLoaded = true;
		if(_bCleanUpThread)
			cleanup();

		//static unsigned long dwRes = 0;
		//CCLOG("XSpriteBatchNode::ResHandle [%d] %s", dwRes++, szPath);

		return;
	} while (0);
	_bResLoaded = false;
	OnRelease();
	CCLOG("[ERROR]XSpriteBatchNode::ResHandle load res failed.");
	XFUNC_END();
}
Esempio n. 20
0
 void removeCursor(tuio::DirectFinger *f){fingers.erase(f); if (!IsPressed())OnRelease();}
Esempio n. 21
0
CNWNXFuncs::~CNWNXFuncs() {
	delete FunctionHooks;
	OnRelease();
}