Пример #1
0
HRGN WINAPI duRgn::GetHRgn(int nWidth, int nHeight)
{
	duRect rectNew;
	rectNew.SetRect(0, 0, nWidth+1, nHeight+1);

	HRGN hRgnLeftBottom = NULL;
	HRGN hRgnRightBottom = NULL;

	if (lstrcmpi(m_szType, _T("roundrect")) == 0)
		return CreateRoundRectRgn(rectNew.left, rectNew.top, rectNew.right, rectNew.bottom, m_nRoundX, m_nRoundY);
	else if (lstrcmpi(m_szType, _T("halfroundrect")) == 0)
	{
		HRGN hRgn = CreateRoundRectRgn(rectNew.left, rectNew.top, rectNew.right, rectNew.bottom, m_nRoundX, m_nRoundY);
		hRgnLeftBottom = CreateRectRgn(rectNew.left, rectNew.bottom - m_nRoundY, rectNew.left + m_nRoundX, rectNew.bottom);
		
		if (hRgn && hRgnLeftBottom)
		{
			int nRegion = CombineRgn(hRgn, hRgn, hRgnLeftBottom, RGN_OR);
			if (nRegion == NULLREGION || ERROR)
			{
				SAFE_DELETE_OBJECT(hRgnLeftBottom);
				return NULL;
			}

			hRgnRightBottom = CreateRectRgn(rectNew.right - m_nRoundX, rectNew.bottom - m_nRoundY,  rectNew.right, rectNew.bottom);
			if (hRgnRightBottom)
			{
				nRegion = CombineRgn(hRgn, hRgn, hRgnRightBottom, RGN_OR);
				if (nRegion == NULLREGION || ERROR)
				{
					SAFE_DELETE_OBJECT(hRgnLeftBottom);
					SAFE_DELETE_OBJECT(hRgnRightBottom);
					return NULL;
				}
				
				m_hRgn = hRgn;
			}
		}
	}
	else if (lstrcmpi(m_szType, _T("style")) == 0)
		return GetStyleHRgn(nWidth, nHeight);

	SAFE_DELETE_OBJECT(hRgnLeftBottom);
	SAFE_DELETE_OBJECT(hRgnRightBottom);

	return m_hRgn;
}
Пример #2
0
void ImageData::LoadImageDefault (){
	SAFE_DELETE_OBJECT (hBitmap);
	hBitmap = (HBITMAP)LoadImage(NULL, L"Demo.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_CREATEDIBSECTION);
	  if (NULL != hBitmap)
	  {
		  ;
	  }
 }
Пример #3
0
HFONT WINAPI duFont::CreateFont()
{
	SAFE_DELETE_OBJECT(m_hFont);

	m_hFont = ::CreateFont(-m_nHeight, NULL, NULL, NULL, m_nWeight, m_fItalic, m_fUnderline, m_fStrikeOut,
		GB2312_CHARSET, OUT_STRING_PRECIS, CLIP_CHARACTER_PRECIS, DEFAULT_QUALITY, 0x22, m_szFace);

	return m_hFont;
}
Пример #4
0
	TinySmiley::~TinySmiley()
	{
		//释放GDI资源
		size_t size = m_images.size();
		for (size_t i = 0; i < size; i++)
		{
			SAFE_DELETE_OBJECT(m_images[i]);
		}
	}
Пример #5
0
	HRESULT STDMETHODCALLTYPE TinySmiley::Draw(HDC hdc, LPCRECT pRect, INT iFrame)
	{
		if (iFrame < 0 || iFrame >= (INT)m_count) return S_FALSE;
		HBITMAP hMenBmp = NULL;
		HDC hMenDC = NULL;
		RECT rect = *pRect;
		BLENDFUNCTION pixelblend = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
		hMenDC = CreateCompatibleDC(hdc);
		if (!hMenDC) goto error;
		hMenBmp = CreateCompatibleBitmap(hdc, TO_CX(rect), TO_CY(rect));
		if (!hMenBmp) goto error;
		HBITMAP hBmp = m_images[iFrame];
		HBITMAP hOldBmp = (HBITMAP)SelectObject(hMenDC, hBmp);
		AlphaBlend(hdc, rect.left, rect.top, TO_CX(rect), TO_CY(rect), hMenDC, 0, 0, m_cx, m_cy, pixelblend);
		SelectObject(hMenDC, hOldBmp);
		SAFE_DELETE_OBJECT(hMenBmp);
		SAFE_DELETE_OBJECT(hMenDC);
		return S_OK;
	error:
		SAFE_DELETE_OBJECT(hMenBmp);
		SAFE_DELETE_OBJECT(hMenDC);
		return S_FALSE;
	}
Пример #6
0
CFxMediaPool::~CFxMediaPool()
{
	ReleaseAllMedia();

	AutoLock lock(_CS);

    CFxMedia* pFxMedia = NULL;
    IFxMediaL::iterator Iter;
    for ( Iter = _FreeFxMediaL.begin( ); Iter != _FreeFxMediaL.end( ); Iter++ )
	{
        pFxMedia = static_cast<CFxMedia*>(*Iter);
        SAFE_DELETE_OBJECT(pFxMedia);
    }
}
Пример #7
0
/*-----------------------------------------------------------------------------*//*!
	ReleaseFx()
	Releases the Fx and its interfaces.
*//*-----------------------------------------------------------------------------*/
Int32 CFxNullRnd::ReleaseFx()
{
	/*! Stop and release Fx components */
	StopFx();

	SAFE_RELEASE_INTERFACE(_pFxParam);
	SAFE_DELETE_OBJECT(_pFxDescriptor);
	_pFxState->FxPublishState(FX_RELEASE_STATE);	//!< Update the Fx state to "Release"
	SAFE_RELEASE_INTERFACE(_pFxState);
	SAFE_RELEASE(_pFx);
	
	delete this; //!< Delete FxBase object
	return FX_OK;
}
Пример #8
0
Int32 CFxMediaPool::UpdateMedia(Uint32 dwSize, Uint32 dwNumber)
{
    /*! Update all free Media */
    IFxMediaL::iterator Iter;

	AutoLock lock(_CS);
	Uint32 dwCurrentSize;
	/*! For each FxMedia in used list */
	for ( Iter = _FreeFxMediaL.begin( ); Iter != _FreeFxMediaL.end( ); Iter++ )
	{
        (*Iter)->GetSize(&dwCurrentSize);
        if(dwCurrentSize != dwSize)
        {
            (*Iter)->SetSize(dwSize);
		    (*Iter)->SetUserParams((FX_PTR)NULL, (FX_PTR)NULL);
		    (*Iter)->SetDataLength(0);
		    (*Iter)->SetMediaMarker(UNDEFINED_MARKER);
		    (*Iter)->SetTimeStamp(0);
        }
	}

    CFxMedia* pFxMedia = NULL;
    if(_dwNumber < dwNumber)
    {
        for( Iter = _FreeFxMediaL.begin( ); Iter != _FreeFxMediaL.end( ), _dwNumber != dwNumber; Iter++ ,_dwNumber++)
	    {
            pFxMedia = new CFxMedia(dwSize, this);
		    if(pFxMedia != NULL)
		    {
			    /*! Setup free list  */
                _FreeFxMediaL.push_back(static_cast<IFxMedia*>(pFxMedia));
		    }
        }
    }
    else if(_dwNumber > dwNumber)
    {
        for ( Iter = _FreeFxMediaL.begin( ); Iter != _FreeFxMediaL.end( ), _dwNumber != dwNumber; _dwNumber--)
	    {
            pFxMedia = static_cast<CFxMedia*>(*Iter);
            SAFE_DELETE_OBJECT(pFxMedia);
            Iter = _FreeFxMediaL.erase(Iter);
        }
    }

    _dwSize = dwSize;
	_dwNumber = dwNumber;
    return FX_OK;
}
Пример #9
0
Void DrawingDocument::RemoveFxLineObject(CFxLine* pFxLine, Bool ShouldLock)
{
    AutoLock lock(_CSDoc, ShouldLock);

	DetachLineToFx(pFxLine);

	lFxLineIter It;
	It = std::find(_FxLineList.begin(),_FxLineList.end(), pFxLine);
	if( It != _FxLineList.end() )
	{
		Disconnect(pFxLine);
		SAFE_DELETE_OBJECT(pFxLine);
		_FxLineList.erase(It);
	}
    return;
}
Пример #10
0
bool CheckedWallsList::PopNode()
{
	CheckedWallsNode *pNode = GetLastNode(true);

	// If this the root node, we're done...
	if(pNode == NULL || pNode == &Root){return false;} // return faillure

	// Update pointers
	pNode->Prev->Next = NULL;

	// Delete the node
	SAFE_DELETE_OBJECT(pNode);
	NumNodesAllocated--;

	// return success
	return true;
}
Пример #11
0
Int32 CFxParam::RemoveFxParam(const std::string strParamName)
{
    AutoLock lock(_CS);

    /*! Find parameter */
    FX_PARAM_INFO* pFxParamInfo = NULL;
	if(FEF_SUCCEEDED(FindParamter(strParamName, &pFxParamInfo)))
    {
        if(pFxParamInfo)
        {
            SAFE_DELETE_OBJECT(pFxParamInfo->pFxParam->pvMaxValue);
            SAFE_DELETE_OBJECT(pFxParamInfo->pFxParam->pvMinValue);
            SAFE_DELETE_OBJECT(pFxParamInfo->pFxParam->pvDefaultValue);
            SAFE_DELETE_OBJECT(pFxParamInfo->pFxParam);
            SAFE_DELETE_ARRAY(pFxParamInfo->pvFxParam);
		    _lParams.remove(pFxParamInfo);
		    SAFE_DELETE_OBJECT(pFxParamInfo);
        }
        else
        {
		    _pLogTrace->FxTrace( "FxParam::RemoveFxParam FEF_FAILED !! (Invalid Parameter: strParamName)");
		    return FX_INVALPARAM;
	    }
    }
    FX_PARAM_STRING_INFO* pFxParamInfoString = NULL;
	if(FEF_SUCCEEDED(FindParamter(strParamName, &pFxParamInfoString)))
    {
        if(pFxParamInfoString)
        {
            SAFE_DELETE_OBJECT(pFxParamInfoString->pFxParam);
            _lParamsString.remove(pFxParamInfoString);
            SAFE_DELETE_OBJECT(pFxParamInfoString);
        }
        else
        {
		    _pLogTrace->FxTrace( "FxParam::RemoveFxParam FEF_FAILED !! (Invalid Parameter: strParamName)");
		    return FX_INVALPARAM;
	    }
    }
    
    if(!pFxParamInfoString && !pFxParamInfo)
    {
        _pLogTrace->FxTrace( "FxParam::RemoveFxParam FEF_FAILED !! (Invalid Parameter: strParamName)");
		return FX_INVALPARAM;
    }
    
    return FX_OK;
}
Пример #12
0
void ZipObject::closeArchive()
{
   if(mZipArchive == NULL)
      return;

   for(S32 i = 0;i < mStreamPool.size();++i)
   {
      StreamObject *so = mStreamPool[i];
      if(so && so->getStream() != NULL)
         closeFile(so);
      
      SAFE_DELETE_OBJECT(mStreamPool[i]);
   }
   mStreamPool.clear();

   mZipArchive->closeArchive();
   SAFE_DELETE(mZipArchive);
}
Пример #13
0
bool CheckedWallsList::DeleteNode(UINT Indx)
{
	CheckedWallsNode *pNode = GetNode(Indx);

	// If this the root node, we're done...
	if(!pNode || pNode == &Root){return false;} // return faillure

	// Update pointers
	CheckedWallsNode *pPrevNode = pNode->Prev;
	CheckedWallsNode *pNextNode = pNode->Next;

	pPrevNode->Next = pNextNode;
	if(pNextNode)
		pNextNode->Prev = pPrevNode;

	// Delete the node
	SAFE_DELETE_OBJECT(pNode);
	NumNodesAllocated--;

	// return success
	return true;
}
Пример #14
0
Void DrawingDocument::CloseDocument()
{
    Int32 hr;

	/*! Clear all Observer */
	FxMap::iterator Itmap;
	for ( Itmap = _FxMap.begin( ); Itmap != _FxMap.end( ); Itmap++ )
	{
		CFx* pFx = Itmap->second;
		hr = FEF_DetachFxObserver(_hFxEngine, pFx->GethFxState());
		if(FEF_FAILED(hr))
		{
			    (Void)wxMessageBox(wxT("FEF_DetachFxObserver failed !!"), wxT("FxEngineEditor Error"), wxICON_ERROR);
			continue;
		}
	}

    AutoLock lock(_CSDoc); //! Draw and callback state
	/*! Clear all FXs added */
	FxMap CopyMap;
	for ( Itmap = _FxMap.begin( ); Itmap != _FxMap.end( ); Itmap++ )
        CopyMap.insert(make_pair(Itmap->first, Itmap->second));

    for ( Itmap = _FxMap.begin( ); Itmap != _FxMap.end( ); Itmap++ )
	{
		CFx* pFx = Itmap->second;
		FX_HANDLE hFx= Itmap->first;

		/*! Delete the Fx object */
		if(_hFxEngine)
		{
			SAFE_DELETE_OBJECT(pFx);
		}
	}
	_FxMap.clear();
    lock.unlock(); //! allow to callback to process messages


	for ( Itmap = CopyMap.begin( ); Itmap != CopyMap.end( ); Itmap++ )
	{
		CFx* pFx = Itmap->second;
		FX_HANDLE hFx= Itmap->first;

		/*! Delete the Fx object */
		if(_hFxEngine)
		{
			hr = FEF_RemoveFx(_hFxEngine, hFx);
			if(FEF_FAILED(hr))
			{
				(Void)wxMessageBox(wxT("FEF_RemoveFx failed !!"), wxT("FxEngineEditor Error"), wxICON_ERROR);
				continue;
			}
		}
	}

	/*! Clear all Fxlines added */
	lFxLineIter It;
	lock.lock(); //! Draw and callback state
	for ( It = _FxLineList.begin( ); It != _FxLineList.end( ); It++ )
	{
		/*! Delete the FxLine object */
		SAFE_DELETE((*It));
	}
	_FxLineList.clear();
}
Пример #15
0
CFxLADSPA::~CFxLADSPA()
{
	SAFE_DELETE_OBJECT(_pWrapper);
	SAFE_RELEASE(_pFx);
    SAFE_DELETE_OBJECT(_pFxDescriptor);
}
Пример #16
0
duFont::~duFont()
{
	SAFE_DELETE_OBJECT(m_hFont);
}
Пример #17
0
wxSTD istream& DrawingDocument::LoadObject(wxSTD istream& stream)
{
    wxDocument::LoadObject(stream);

    wxView *pview = GetFirstView();

    Char strcFxPath[MAX_PATH];
	std::string strFxName;
	Uint32 dwFxPosX, dwFxPosY;
	Uint32 dwFxMaxPosX, dwFxMaxPosY;
	Uint32 dwFxCount;
	FX_HANDLE hFx = NULL;
    FX_HANDLE hFxState = NULL;
	Int32 hr;

    IFxParam* pIFxParam;
    std::string strParamName;
    Uint16 wParamCount;
    Uint8* pbParamValue;
	std::string strParamValue;
    Uint32 dwParamSize;

    Bool is10Version = FALSE;
    Bool is11Version = FALSE;
    Bool is12Version = FALSE;
	Bool is13Version = FALSE;
	Bool is14Version = FALSE;

	//ZeroMemory(strcFxPath, MAX_PATH * sizeof(Char));
	memset(strcFxPath, 0, MAX_PATH * sizeof(Char));

	dwFxMaxPosX = 0;
	dwFxMaxPosY = 0;

	stream.read((Char*)strcFxPath,MAX_PATH);
    if(strcmp("FxEngineEditor", strcFxPath) == 0)
        is10Version = TRUE;
    else if(strcmp("FxEngineEditor1.1", strcFxPath) == 0)
        is11Version = TRUE;
    else if(strcmp("FxEngineEditor1.2", strcFxPath) == 0)
        is12Version = TRUE;
	else if(strcmp("FxEngineEditor1.3", strcFxPath) == 0)
        is13Version = TRUE;
	else if(strcmp("FxEngineEditor1.4", strcFxPath) == 0)
        is14Version = TRUE;

	if( !is14Version && !is13Version && !is12Version && !is11Version && !is10Version)
	{
		wxMessageBox(wxT("Invalid FxEngineEditor file !!"), wxT("FxEngineEditor Error"), wxICON_ERROR);
		return stream;
	}

	/* Fx */
	stream.read((Char*)&dwFxCount,sizeof(Uint32));
    Char* strcFx;
    std::string strFxPath;
	for(Uint32 Idx = 0; Idx < dwFxCount; Idx++)
	{
        hFx = NULL;
        hFxState = NULL;

		if(is12Version || is13Version || is14Version)
        {
            Uint16 wFxPathLenght;
            stream.read((Char*)&wFxPathLenght, sizeof(Uint16));
            strcFx = new Char[wFxPathLenght + 1];
			strcFx[0] = '\0';
            stream.read((Char*)strcFx, wFxPathLenght);
            strcFx[wFxPathLenght] = '\0';
            strFxPath = strcFx;
            SAFE_DELETE_ARRAY(strcFx);
        }
        else
        {
            //ZeroMemory(strcFxPath, MAX_PATH * sizeof(Char));
            memset(strcFxPath, 0, MAX_PATH * sizeof(Char));
		    stream.read((Char*)strcFxPath,MAX_PATH);
            strFxPath = strcFxPath;
        }

        /*! get jump to next Fx */
        Uint32 dwJumpFx = 0;
        if(is14Version)
            stream.read((Char*)&dwJumpFx, sizeof(Uint32));

		/*! Verify the file */
		if (access(strFxPath.c_str(), 0) != 0)
		{
            wxString strErr = wxT("Cannot open: ") + s2ws(strFxPath);
			wxMessageBox(strErr, wxT("FxEngineEditor Error"), wxICON_ERROR);
			if(is14Version) {
				stream.seekg(dwJumpFx, ios::cur);
				continue;
			}
			else
				return stream;
		}
        else {
		    hr = FEF_AddFx(_hFxEngine, strFxPath, &hFx);
		    if(FEF_FAILED(hr))
		    {
			    wxString strErr = wxT("Invalid Fx: ") + s2ws(strFxPath);
			    wxMessageBox(strErr, wxT("FxEngineEditor Error"), wxICON_ERROR);
				if(is14Version){
					stream.seekg(dwJumpFx, ios::cur);
					continue;
				}
				else
					return stream;
		    }
            else {
		        hFxState = ((DrawingView*)pview)->canvas->AttachFxObserver(_hFxEngine, hFx);
		        //hr = FEF_AttachFxObserverEx(_hFxEngine, hFx, FxStateProc, (FX_PTR)this, &hFxState);
		        if(hFxState == NULL)
		        {
			        wxMessageBox(wxT("FEF_AttachFxObserverEx failed !!"), wxT("FxEngineEditor Error"), wxICON_ERROR);
			        if(is14Version){
						stream.seekg(dwJumpFx, ios::cur);
						continue;
					}
					else
						return stream;
		        }
            }
        }

        stream.read((Char*)&dwFxPosX, sizeof(Uint32));
		stream.read((Char*)&dwFxPosY, sizeof(Uint32));
		dwFxMaxPosX = (dwFxPosX > dwFxMaxPosX) ? dwFxPosX : dwFxMaxPosX;
		dwFxMaxPosY = (dwFxPosY > dwFxMaxPosY) ? dwFxPosY : dwFxMaxPosY;

		CFx* pFx = NULL;
        if(is12Version || is13Version || is14Version)
        {
            Uint16 wFxNameLenght;
            stream.read((Char*)&wFxNameLenght, sizeof(Uint16));
            Char* strTemp = new Char[wFxNameLenght + 1];
			strTemp[0] = '\0';
            stream.read((Char*)strTemp, wFxNameLenght);
            strTemp[wFxNameLenght] = '\0';
            strFxName = strTemp;
            SAFE_DELETE_ARRAY(strTemp);
			pFx = new CFx(_hFxEngine, hFx, hFxState, strFxPath, dwFxPosX, dwFxPosY, strFxName);
			pFx->InitFxPin();
        }
        else if(is11Version)
        {
            Char strTemp[60];
            stream.read((Char*)strTemp, 60);
            strFxName = strTemp;
			pFx = new CFx(_hFxEngine, hFx, hFxState, strFxPath, dwFxPosX, dwFxPosY, strFxName);
        }
		else
			pFx = new CFx(_hFxEngine, hFx, hFxState, strFxPath, dwFxPosX, dwFxPosY, NULL);

		if(pFx == NULL)
		{
			wxMessageBox(wxT("Internal Fx Error!!"), wxT("FxEngineEditor Error"), wxICON_ERROR);
			return stream;
		}


		_FxMap.insert(std::make_pair(hFx, pFx));

        if(is11Version || is12Version || is13Version || is14Version)
        {
            /*! read fx parameters */
            hr = FEF_QueryFxParamInterface(_hFxEngine, pFx->GethFxHandle(), &pIFxParam);
			if(FEF_FAILED(hr)) {
                wxMessageBox(wxT("Cannot get Fx Parameter Interface"), wxT("FxEngineEditor Error"), wxICON_ERROR);
				return stream;
			}

            pIFxParam->GetFxParamCount(&wParamCount);
            for(int i = 0; i < wParamCount; i++)
            {
                if(is12Version || is13Version || is14Version) {
                    Uint16 wParamNameLenght;
                    stream.read((Char*)&wParamNameLenght, sizeof(Uint16));
                    Char* strTemp = new Char[wParamNameLenght + 1];
					strTemp[0] = '\0';
                    stream.read((Char*)strTemp, wParamNameLenght);
                    strTemp[wParamNameLenght] = '\0';
                    strParamName = strTemp;
                    SAFE_DELETE_ARRAY(strTemp);
                }
                else if(is11Version) {
                    Char strTemp[60];
                    stream.read((Char*)strTemp, 60);
                    strParamName = strTemp;
                }
                stream.read((Char*)&dwParamSize, sizeof(Uint32));
                pbParamValue = new Uint8[dwParamSize];
				memset(pbParamValue, 0, dwParamSize*sizeof(Uint8));
                stream.read((Char*)pbParamValue, dwParamSize);
                pIFxParam->SetFxParamValue(strParamName, (Void*)pbParamValue);
                SAFE_DELETE_ARRAY(pbParamValue);
            }

			/*! Read string parameters */
			if(is13Version || is14Version) {
				pIFxParam->GetFxParamStringCount(&wParamCount);
				for(int i = 0; i < wParamCount; i++)
				{
					Uint16 wParamNameLenght;
                    stream.read((Char*)&wParamNameLenght, sizeof(Uint16));
                    Char* strTemp = new Char[wParamNameLenght + 1];
					strTemp[0] = '\0';
                    stream.read(strTemp, wParamNameLenght);
                    strTemp[wParamNameLenght] = '\0';
                    strParamName = strTemp;
                    SAFE_DELETE_ARRAY(strTemp);

					stream.read((Char*)&dwParamSize, sizeof(Uint32));
					strTemp = new Char[dwParamSize + 1];
					strTemp[0] = '\0';
                    stream.read(strTemp, dwParamSize);
                    strTemp[dwParamSize] = '\0';
					strParamValue = strTemp;
					pIFxParam->SetFxParamValue(strParamName, strParamValue);
					SAFE_DELETE_ARRAY(strTemp);
				}
			}

            pIFxParam->FxReleaseInterface();
            FEF_UpdateFxParam(_hFxEngine, pFx->GethFxHandle(), "", FX_PARAM_ALL);
        }
    }

    /*((DrawingView*)pview)->canvas->Refresh();
    ((DrawingView*)pview)->canvas->Update();*/

    /* Lines */
	Uint32 dwLineCount;
	Uint32 dwPointCount;
	wxPoint Point;
    int sdwPointType;
    FX_MEDIA_TYPE MediaType;
    MediaType.MainMediaType = MAIN_TYPE_UNDEFINED;
    MediaType.SubMediaType = SUB_TYPE_UNDEFINED;
	stream.read((Char*)&dwLineCount, sizeof(Uint32));
	for(Uint32 IdxLine = 0; IdxLine < dwLineCount; IdxLine++)
	{
        if(is11Version || is12Version || is13Version || is14Version)
        {
            stream.read((Char*)&MediaType.MainMediaType, sizeof(FX_MAIN_MEDIA_TYPE));
            stream.read((Char*)&MediaType.SubMediaType, sizeof(FX_SUB_MEDIA_TYPE));
        }

        CNode* ppNode[6];
		memset(ppNode, NULL, 6*sizeof(CNode*));
		stream.read((Char*)&dwPointCount, sizeof(Uint32));
		for(Uint32 IdxPoint = 0; IdxPoint < dwPointCount; IdxPoint++)
		{
			stream.read((Char*)&Point.x, sizeof(Uint32));
			stream.read((Char*)&Point.y, sizeof(Uint32));
            CNode* pNode = NULL;
            if(is14Version) {
                stream.read((Char*)&sdwPointType, sizeof(int));
			    pNode = new CNode(Point, (NODE_TYPE)sdwPointType);
            }
            else 
                pNode = new CNode(Point);
			if(IdxPoint == 0)
			{
                ppNode[IdxPoint] = pNode;
				//pNode->SetFirst();
				//pFxLine->AddPoint(pNode, TRUE);
				//CNodeManager::Instance()->Link(pNode);
			}
			else if(IdxPoint == (dwPointCount-1))
			{
				if(!is14Version)
					ppNode[5] = pNode;
				else
					ppNode[IdxPoint] = pNode;
            //pNode->SetEnd();
				//pFxLine->AddPoint(pNode, TRUE);
				//CNodeManager::Instance()->Link(pNode);
			}
			else if(is14Version)
			{
				ppNode[IdxPoint] = pNode;
				//pFxLine->AddConnectionPoint(pNode);
				//CNodeManager::Instance()->Link(pNode, FALSE);
			}
         else
				SAFE_DELETE_OBJECT(pNode);
		}
		CFxLine* pFxLine = new CFxLine(ppNode, 6);

		if(is14Version)
			pFxLine->UpdateAdjustedPoints(NULL); //!< set adjusted points

		_FxLineList.push_back(pFxLine);
		//pFxLine->Update();

        if(is11Version || is12Version || is13Version || is14Version)
        {
            pFxLine->SetMediaTypeConnection(MediaType);
            /*if( (MediaType.MainMediaType == MAIN_TYPE_UNDEFINED) &&
                (MediaType.SubMediaType == SUB_TYPE_UNDEFINED) )
		        Connect(pFxLine, NULL);
            else
                Connect(pFxLine, &MediaType);*/
        }
	}

    wxString strTilte = GetTitle();
    ((DrawingView*)pview)->_frame->SetTitle(strTilte);

    ((DrawingView*)pview)->canvas->TryConnection();
  /*((DrawingView*)pview)->canvas->ClearBackground();*/
  ((DrawingView*)pview)->canvas->Refresh();
  ((DrawingView*)pview)->canvas->Update();

  return stream;
}
Пример #18
0
// update CInvader component
void CInvaderGame::update(float delta)
{
  CComponent::update(delta);
  if(false == _firstGenned)
  {
    return;
  }

  if(nullptr == _player)
  {
    if((false == _countStarted)
      &&(nullptr != _stage))
    {
      unsigned int killCount = ((_stage->getLevel()-1)*STAGE_WIDTH*STAGE_HEIGHT)+
                              ((STAGE_WIDTH*STAGE_HEIGHT)-_stage->getEnermyCount());
      system("clear");
      printf("======================================\n");
      printf(" kill : %d\n", killCount);
      printf(" level : %d\n", _stage->getLevel()-1);
      printf(" score : %d\n", (_stage->getLevel()-1)*10000 + killCount*100);
      printf("======================================\n");

      CObject *stageOwner = _stage->getOwner();
      SAFE_DELETE_OBJECT(stageOwner);
      _stage = nullptr;
      _remainToRestart = TIME_TO_RESTART;
      _nextPrintTime = TIME_TO_RESTART;
      printf("press 'R' key to restart\n");
      return;
    }
    else if((false == _countStarted)
          &&(nullptr == _stage)
          &&(CInput::isKeyDown(SDLK_r)))
    {
      system("clear");
      printf("remain time to start : %f\n", TIME_TO_RESTART);
      _nextPrintTime -= PRINT_REMAIN_TIME_INTERVAL;
      _countStarted = true;
    }
    else if((true == _countStarted)
          &&(_remainToRestart <= _nextPrintTime))
    {
      if((_remainToRestart <= 0.0f))
      {
        CObject *playerObject = nullptr;
        CObject *stageObject = nullptr;

        system("clear");
        printf("start game!!!\n");

        playerObject = new CObject(CVector2(0.0f, -150.0f));
        stageObject = new CObject(CVector2(0.0f, 0.0f));
        _player = new CPlayer(this);
        _stage = new CStage();

        playerObject->addComponent(_player);
        playerObject->addComponent(new CSprite(CSize2(32.0f, 22.0f),
                                        "Resources/player.png"));
        playerObject->addComponent(new CCollider(5.0f));

        stageObject->addComponent(_stage);

        getOwner()->addChild(playerObject);
        getOwner()->addChild(stageObject);

        _remainToRestart = 0.0f;
        _nextPrintTime = 0.0f;
        _countStarted = false;
        return;
      }
      printf("remain time to start : %f\n", _nextPrintTime);
      _nextPrintTime -= PRINT_REMAIN_TIME_INTERVAL;
    }
  }
  if(_countStarted)
  {
    _remainToRestart -= delta;
  }
}
Пример #19
0
CVideoRender::~CVideoRender()
{
	SAFE_RELEASE(_pFx);
    SAFE_DELETE_OBJECT(_pFxDescriptor);
}
Пример #20
0
CBspline::~CBspline()
{
	SAFE_DELETE_OBJECT(splinePtr);
	ctrlVertices.clear();
}
Пример #21
0
CFxMToSMerger::~CFxMToSMerger()
{
	SAFE_RELEASE(_pFx);
    SAFE_DELETE_OBJECT(_pFxDescriptor);
}
Пример #22
0
duRgn::~duRgn()
{
	SAFE_DELETE_OBJECT(m_hRgn);
}