当前位置: 首页>>代码示例>>C++>>正文


C++ CGraphic类代码示例

本文整理汇总了C++中CGraphic的典型用法代码示例。如果您正苦于以下问题:C++ CGraphic类的具体用法?C++ CGraphic怎么用?C++ CGraphic使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CGraphic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetDocument

void CEx_DrawView::OnDraw(CDC* pDC)
{
	// TODO: add draw code for native data here
    CEx_DrawDoc* pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    m_bufferDC.BitBlt(0, 0, m_size.cx, m_size.cy, pDC, 0, 0, WHITENESS);
    DrawGraphic(&m_bufferDC);
    if (pDoc->m_sel != -1)
    {
		ASSERT(pDoc->m_sel >= 0 && pDoc->m_sel < pDoc->m_obArray.GetSize());
        CGraphic* P = Convert_To_Graphic(pDoc->m_obArray[pDoc->m_sel]);
		ASSERT_VALID(P);
        P->Draw(&m_bufferDC);
        m_bufferDC.SelectObject(GetStockObject(WHITE_BRUSH));
        P->DrawSelectedEdge(&m_bufferDC);
        if (pDoc->m_bShowTab)
        {
            CString str;
            int bkMode = m_bufferDC.SetBkMode(TRANSPARENT);
            str.Format(_T("%d"), pDoc->m_sel);
            m_bufferDC.SelectObject(&m_tabFont);
            m_bufferDC.TextOut(P->m_pt1.x, P->m_pt1.y, str);
        }
    }
    pDC->BitBlt(0, 0, m_size.cx, m_size.cy, &m_bufferDC, 0, 0, SRCCOPY);
}
开发者ID:smithLiLi,项目名称:dev,代码行数:27,代码来源:Ex_DrawView.cpp

示例2: Draw

//////////////////////////////////////////////////////////////////////////
//From CControl
//////////////////////////////////////////////////////////////////////////
void CGradeDialog::Draw(CGraphic& gc)const
{
	gc.SetPenColor(TRgb(0,0,0));
	gc.SetPenStyle(CBitmapContext::ESolidPen);
	gc.SetBrushStyle(CBitmapContext::ENullBrush);

	gc.BitBlt(iStartPoint,iDialogBmp);

	gc.DrawText(iStartPoint+TPoint(iIconPoint.iX,iScreenLayout.FontHeight()/3),iTitle);

	for(TInt i=0;i<5;i++)
	{
		if(i<iGradeNum/2)
		{
			iBitmapFactory.DrawGradeBmpByID(gc,iStartPoint+iIconPoint+TPoint((iIconSize.iWidth+iIconPoint.iX)*i,0),0);	
		}
		else
		{
			if((iGradeNum-i*2)==1)
			{
				iBitmapFactory.DrawGradeBmpByID(gc,iStartPoint+iIconPoint+TPoint((iIconSize.iWidth+iIconPoint.iX)*i,0),1);	
			}
			else
			{
				iBitmapFactory.DrawGradeBmpByID(gc,iStartPoint+iIconPoint+TPoint((iIconSize.iWidth+iIconPoint.iX)*i,0),2);	
			}
		}
	}

}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:33,代码来源:GradeDialog.cpp

示例3: Draw

/**
**  Draw a sprite with is like a bar (several stages)
**
**  @param x       X screen pixel position
**  @param y       Y screen pixel position
**  @param unit    Unit pointer
**  @todo fix sprite configuration.
*/
void CDecoVarSpriteBar::Draw(int x, int y,
	const CUnitType *, const CVariable &Variable) const
{
	int n;                   // frame of the sprite to show.
	CGraphic *sprite;        // the sprite to show.
	Decoration *decosprite;  // Info on the sprite.

	Assert(Variable.Max);
	Assert(this->NSprite != -1);

	decosprite = &DecoSprite.SpriteArray[(int)this->NSprite];
	sprite = decosprite->Sprite;
	x += decosprite->HotX; // in addition of OffsetX... Usefull ?
	y += decosprite->HotY; // in addition of OffsetY... Usefull ?

	n = sprite->NumFrames - 1;
	n -= (n * Variable.Value) / Variable.Max;

	if (this->IsCenteredInX) {
		x -= sprite->Width / 2;
	}
	if (this->IsCenteredInY) {
		y -= sprite->Height / 2;
	}
	sprite->DrawFrameClip(n, x, y);
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例4:

bool sqr_tools::CEditModel::AddPieceGroup( const char* szFileName )
{
	CPieceGroup* pPieceGroup = NULL;
	CGraphic* pGraphic = CGraphic::GetInst();
	if ( pGraphic->CreatePieceGroup(szFileName, &pPieceGroup) == -1 )
	{
		string log = szFileName;
		log = log + "模型没有找到,可能该文件不存在";

		MessageBox(NULL, log.c_str(), "错误", MB_OK);

		return false;
	}

	size_t nPieceClassNum = pPieceGroup->GetPieceClassNum();
	for ( size_t i = 0; i < nPieceClassNum; i++)
	{
		this->AddMeshPiece(pPieceGroup, pPieceGroup->GetPieceClassName(i), 0);
	}

	pPieceGroup->Release();
	m_strModelName = szFileName;

	return true;
}	
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:25,代码来源:CEditModel.cpp

示例5: RenderSelWndList

	void CWndAreaRendere::RenderSelWndList()
	{
		if( !m_renderWndList || m_renderWndList->size() <= 1 )
			return;
		
		CGraphic* pGraphic = CGraphic::GetInst();
		vector<SQRWnd*>::iterator it = m_renderWndList->begin();
		vector<SQRWnd*>::iterator eit = m_renderWndList->end();
		while(it != eit)
		{
			SQRWnd* pwnd = *it;
			if (pwnd)
			{
				CFRect rt; pwnd->GetWndRect(rt);
				VerColor2D v[5]=
				{
					VerColor2D( (float)rt.left,  (float)rt.top,    0,	0xffff00ff ),
					VerColor2D( (float)rt.right, (float)rt.top,    0,	0xffff00ff ),
					VerColor2D( (float)rt.right, (float)rt.bottom, 0,	0xffff00ff ),
					VerColor2D( (float)rt.left,  (float)rt.bottom, 0,	0xffff00ff ),
					VerColor2D( (float)rt.left,  (float)rt.top,    0,	0xffff00ff ),
				};
				VerColor2D* pVB;
				RenderState * pRS;
				pGraphic->GetRenderStack( RS_FONT, NULL, NULL, PT_LINESTRIP, 5, 4, 
					VerColor2D::Format, sizeof(VerColor2D), (void**)&pVB, NULL, (void**)&pRS );
				pRS->m_ZTestEnable = false;
				pRS->m_ZTestFun    = CMP_ALWAYS;
				memcpy( pVB, v, sizeof( VerColor2D )*5 );
			}
			
			++it;
		}
		
	}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:35,代码来源:WndAreaRenderer.cpp

示例6: OnSelGraph

void CEx_Ctrl::OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint) 
{
	// TODO: Add your specialized code here and/or call the base class
	
    if (lHint == 0x2000)
    {
        m_sel_graph.SetCurSel(GetDocument()->m_GM.m_DrawType);
        OnSelGraph();
    }
    else if (lHint == 0x4000)
    {
        CObArray& arr = GetDocument()->m_obArray;
        CString str;
        CGraphic* P = NULL;
        m_lists.ResetContent();
        for (int i = 0; i < arr.GetSize(); i++)
        {
            P = Convert_To_Graphic(arr[i]);
            str.Format(_T("%d - %s - %s"), i, P->GetName(), P->m_lpszName);
            m_lists.InsertString(0, str);
        }
    }
    else if (lHint == 0x4001)
    {
        int sel = GetDocument()->m_sel;
        if (sel != -1)
        {
            m_lists.SetCurSel(m_lists.GetCount() - sel - 1);
        }
    }
}
开发者ID:smithLiLi,项目名称:dev,代码行数:31,代码来源:Ex_Ctrl.cpp

示例7: Render

void CFlashRender::Render()
{
	CGraphic* pGraphic = CGraphic::GetInst();
	pGraphic->ClearStack();
	CMainWindowTarget::GetInst()->Clear();
	if(m_pText)
	{
		VerText2D* pVB;
		RenderState* pRS;
		CMatrix* Matrix = pGraphic->GetRenderStack( RS_GUI, m_pText, NULL, PT_TRIANGLESTRIP, 
			4, 2, VerText2D::Format, sizeof(VerText2D), (void**)&pVB, NULL, (void**)&pRS );
		pRS->m_Cull = 1;
		pRS->m_AlphaBlendEnable = m_bAlphaBlend;
		pRS->m_AlphaTestEnable  = m_bAlphaTest;
		pRS->m_ZTestEnable		= FALSE;
		Matrix->Identity();

		pVB[0].x = m_fOffX;  					pVB[0].y = m_fOffY;						pVB[0].z = 1.0f; 
		pVB[1].x = float(m_Width)+ m_fOffX;		pVB[1].y = m_fOffY;						pVB[1].z = 1.0f;	
		pVB[2].x = m_fOffX;						pVB[2].y = float(m_Height) + m_fOffY;	pVB[2].z = 1.0f;	
		pVB[3].x = float(m_Width)+ m_fOffX;		pVB[3].y = float(m_Height) + m_fOffY;	pVB[3].z = 1.0f;	

		pVB[0].w = 1.0;		pVB[0].tu = 0.0;	pVB[0].tv = 0.0;
		pVB[1].w = 1.0;		pVB[1].tu = 1.0;	pVB[1].tv = 0.0;
		pVB[2].w = 1.0;		pVB[2].tu = 0.0;	pVB[2].tv = 1.0; 
		pVB[3].w = 1.0;		pVB[3].tu = 1.0;	pVB[3].tv = 1.0;	

		if(m_bShowRect)
		{
			VerColor2D* pVBRenct;
			RenderState* pLRS;
			Matrix = pGraphic->GetRenderStack( RS_GUI, NULL, NULL, PT_TRIANGLESTRIP, 
				4, 2, VerColor2D::Format, sizeof(VerColor2D), (void**)&pVBRenct, NULL, (void**)&pLRS );
			Matrix->Identity();
			pLRS->m_Cull = 1;
			pLRS->m_AlpOP_S1		= TOP_SELECTARG1;
			pLRS->m_AlpArg1_S1		= TA_DIFFUSE;

			pLRS->m_TexOP_S1		= TOP_BLENDDIFFUSEALPHA;
			pLRS->m_TexArg1_S1		= TA_CURRENT;
			pLRS->m_TexArg2_S1		= TA_DIFFUSE;

			pLRS->m_AlphaBlendEnable = TRUE;
			pLRS->m_AlphaTestEnable = FALSE;
			pLRS->m_ZTestEnable		= FALSE;

			pVBRenct[0].x = m_fOffX + m_fRect.left;  	pVBRenct[0].y = m_fOffY + m_fRect.top;		pVBRenct[0].z = 1.0f;  
			pVBRenct[1].x = m_fOffX + m_fRect.right;	pVBRenct[1].y = m_fOffY + m_fRect.top;		pVBRenct[1].z = 1.0f;	
			pVBRenct[2].x = m_fOffX + m_fRect.left;		pVBRenct[2].y = m_fOffY + m_fRect.bottom;	pVBRenct[2].z = 1.0f;	
			pVBRenct[3].x = m_fOffX + m_fRect.right;	pVBRenct[3].y = m_fOffY + m_fRect.bottom;	pVBRenct[3].z = 1.0f;

			pVBRenct[0].w = 1.0f;
			pVBRenct[1].w = 1.0f;
			pVBRenct[2].w = 1.0f;
			pVBRenct[3].w = 1.0f;

			pVBRenct[0].diffuse = pVBRenct[1].diffuse = pVBRenct[2].diffuse = pVBRenct[3].diffuse = 0x800000FF;
		}
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:60,代码来源:CFlashRender.cpp

示例8: RenderRootRect

	void CWndAreaRendere::Render()
	{
		// first render the root rect
		RenderRootRect();

		// then render the wnd rect selected
		if( !m_bRender )
			return;

		CGraphic* pGraphic = CGraphic::GetInst();
		VerColor2D v[5]=
		{
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.top,    0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.right, (float)m_curRect.top,    0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.right, (float)m_curRect.bottom, 0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.bottom, 0,	0xff0000ff ),
			VerColor2D( (float)m_curRect.left,  (float)m_curRect.top,    0,	0xff0000ff ),
		};
		VerColor2D* pVB;
		RenderState * pRS;
		pGraphic->GetRenderStack( RS_FONT, NULL, NULL, PT_LINESTRIP, 5, 4, 
			VerColor2D::Format, sizeof(VerColor2D), (void**)&pVB, NULL, (void**)&pRS );
		pRS->m_ZTestEnable = false;
		pRS->m_ZTestFun    = CMP_ALWAYS;
		memcpy( pVB, v, sizeof( VerColor2D )*5 );

		// render wnd list
		RenderSelWndList();
	}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:29,代码来源:WndAreaRenderer.cpp

示例9: ASSERT

void CCurThreeListBoxItem::Draw(CGraphic& aGraphic,TPoint& aPoint) const
{
	TPoint point = aPoint;

	ASSERT(iSlideText);
	TRect rect;
	if(iActive)
	{
		TSize size = iItemSize;
		size.iHeight *= 3;
		rect = size;
		rect.Move(point);

		aGraphic.SetPenColor(KTextColor);
		aGraphic.SetPenStyle(CGraphicsContext::ESolidPen);
		aGraphic.SetBrushColor(KListSelectedColor);
		aGraphic.SetBrushStyle(CGraphicsContext::ESolidBrush);
		aGraphic.DrawRect(rect);
		aGraphic.SetBrushStyle(CGraphicsContext::ENullBrush);
	}
	if(iIcon)
	{
		ASSERT(iIconMask);
		aGraphic.BitBltMasked(point,iIcon,iIconMask);
	}
	rect = iItemSize;
	if(iIcon)
	{
		rect.iTl.iX += iIcon->SizeInPixels().iWidth;
	}
	rect.Move(point);
	iSlideText->SetClientRect(rect);
	iSlideText->Draw(aGraphic);

	if(iActive)
	{	
		aGraphic.SetPenColor(iTextColor);
		rect.Move(0,iItemSize.iHeight);
		if(iSecondText)
		{
			aGraphic.DrawText(*iSecondText,rect);
		}
		rect.Move(0,iItemSize.iHeight);
		if(iThirdText)
		{
			aGraphic.DrawText(*iThirdText,rect);
		}

		aPoint.iY += iItemSize.iHeight*3;
	}
	else
	{
		aPoint.iY += iItemSize.iHeight;
	}
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:55,代码来源:ListBoxItem.cpp

示例10: Draw

//////////////////////////////////////////////////////////////////////////
//From CControl
//////////////////////////////////////////////////////////////////////////
void CContentInfoDialog::Draw(CGraphic& gc)const
{
	gc.SetPenColor(TRgb(255,255,255));
	gc.SetBrushColor(TRgb(64,61,90));
	gc.SetPenStyle(CBitmapContext::ESolidPen);
	gc.SetBrushStyle(CBitmapContext::ESolidBrush);

	gc.DrawRoundRect(iBackRect);

	TPoint point=iStartPoint;

	if(iBool&&iShowBmp==NULL)
	{
		gc.DrawRoundRect(TRect(iStartPoint-TPoint(2,2),TSize(iIconSize.iWidth+4,iIconSize.iHeight+4)));
		gc.DrawText(iMainEngine.GetDesById(ECoCoTextRes_GetImage),TRect(point,iIconSize),CGraphicsContext::ELeft);
		point.iY=point.iY+iIconSize.iHeight;
	}

	if(iShowBmp)
	{
		/*TPoint iconPoint(0,0);
		TSize iconSize=iIconSize;

		if(iSelectIndex<iAllLine)
		{
			iconPoint.iY=iconPoint.iY+iTextSize.iHeight*iSelectIndex;
			
			iconSize.iHeight=iIconSize.iHeight-iTextSize.iHeight*iSelectIndex;

			if(iconPoint.iY>=0&&iconSize.iHeight>0)
				gc.BitBlt(point,iShowBmp,TRect(iconPoint,iconSize));
		}*/
		gc.BitBlt(point,iShowBmp);
		point.iY=point.iY+iIconSize.iHeight;
	}

	TInt index=0;
	for(TInt i=0;i<iMaxLine;i++)
	{
		index=i+iFirstIndex;

		if(index>=iDesArray->Count())
			break;

		gc.DrawText((*iDesArray)[index],TRect(point+TPoint(0,i*iTextSize.iHeight),iTextSize),CGraphicsContext::ELeft);
	}	
	gc.SetBrushStyle(CGraphicsContext::ENullBrush);		
	
	if(iScrollbar)
		iScrollbar->Draw(gc);
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:54,代码来源:ContentInfoDialog.cpp

示例11: SetMainPlayerModel

	void CToolMainPlayer::SetMainPlayerModel(string & str)
	{
		if ( str == "" || m_pMainPlayer == NULL )
			return;

		if( m_strMainPlayerModel !=  str )
			m_pMainPlayer->DelFramework();

		m_strMainPlayerModel = str;

		m_pMainPlayer->ClearMeshPiece();

		CPieceGroup  *pPieceGroup = NULL;

		CGraphic * pCoreGraphic = CGraphic::GetInst();

		SQR_TRY
		{
			if ( pCoreGraphic->CreatePieceGroup(str.c_str(), &pPieceGroup) == INVALID )
			{
				string log = str;
				log = log + "主角模型文件没有找到";

				MessageBox(NULL, log.c_str(), "错误", MB_OK);

				return;
			}
		}
		SQR_CATCH(exp)
		{
			MessageBox(NULL, exp.ErrorMsg(), "错误", MB_OK);

			return;
		}
		SQR_TRY_END;

		for ( size_t i = 0; i < pPieceGroup->GetPieceClassNum(); i++)
		{
			m_pMainPlayer->AddMeshPiece(pPieceGroup,pPieceGroup->GetPieceClassName(i),0);
		}

		m_bLoadMainPlayer = true;

		pPieceGroup->Release();
	}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:45,代码来源:ToolMainPlayer.cpp

示例12: rect

//////////////////////////////////////////////////////////////////////////
//From CControl
//////////////////////////////////////////////////////////////////////////
void CSelectGroup::Draw(CGraphic& gc)const
{
    TInt index=0;
    for(TInt i=0; i<iMaxLinePerPage; i++)
    {
        index=i+iFirstIndex;
        if(index>=iSelectArray.Count())
            break;

        if(index==iSelectedIndex)
        {
            TRect rect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize);
            gc.SetPenColor(KPopMenuRectColor);
            gc.SetPenStyle(CGraphicsContext::ESolidPen);
            gc.SetBrushColor(KNaviPaneSelectedItemColor);
            gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
            gc.DrawRect(rect);

            gc.SetBrushStyle(CGraphicsContext::ENullBrush);
            gc.SetPenColor(KRgbWhite);
        }
        iSelectArray[index]->DrawItem(gc,TRect(iStartPoint+TPoint(0,i*iLineHeight),iItemSize));
    }
    if(iScrollbar)
        iScrollbar->Draw(gc);
}
开发者ID:flaithbheartaigh,项目名称:wapbrowser,代码行数:29,代码来源:SelectGroup.cpp

示例13: GraphicHitTest

BOOL CEx_DrawView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message) 
{
    // TODO: Add your message handler code here and/or call default
    BOOL bResult = FALSE;
    GraphicHitTest(m_ptCursor, bResult, m_iTrackID);
    
    if ((bResult || (m_bLButtonDown && m_pMoveTarget != NULL)) && GetDocument()->m_GM.m_DrawType == SELECT && !m_bContextMenu)
    {
        BOOL bRet = FALSE;
        CGraphic* P = Convert_To_Graphic(GetDocument()->m_obArray[m_iTrackID]);
		ASSERT_VALID(P);
        LPCTSTR cursor = P->HitSizingTest(m_ptCursor, bRet);
        if (bRet) { SetCursor(AfxGetApp()->LoadStandardCursor(cursor)); return TRUE; }
        SetCursor(AfxGetApp()->LoadStandardCursor(IDC_SIZEALL));
        return TRUE;
    }
    
	return CScrollView::OnSetCursor(pWnd, nHitTest, message);
}
开发者ID:smithLiLi,项目名称:dev,代码行数:19,代码来源:Ex_DrawView.cpp

示例14: LoadFonts

/**
**  Load all fonts.
*/
void LoadFonts()
{
	for (FontFamiliesType::iterator iter = FontFamilies.begin();
	     iter != FontFamilies.end(); ++iter) {
		CFontFamily *fontFamily = iter->second;
		CGraphic *g = fontFamily->G;
		if (g) {
			ShowLoadProgress("Fonts %s", g->File.c_str());
			g->Load();
			fontFamily->MeasureWidths();
			if (UseOpenGL) {
				fontFamily->MakeFontColorGraphics();
			}
		}
	}

	// TODO: remove this
	SmallFont = CFont::Get("small");
	GameFont = CFont::Get("game");
	LargeFont = CFont::Get("large");
}
开发者ID:OneSleepyDev,项目名称:boswars_osd,代码行数:24,代码来源:font.cpp

示例15: VideoDrawChar

/**
**  Draw character with current color.
**
**  @param g   Pointer to object
**  @param gx  X offset into object
**  @param gy  Y offset into object
**  @param w   width to display
**  @param h   height to display
**  @param x   X screen position
**  @param y   Y screen position
*/
static void VideoDrawChar(const CGraphic &g,
						  int gx, int gy, int w, int h, int x, int y, const CFontColor &fc)
{
	if (!UseOpenGL) {
		SDL_Rect srect = {gx, gy, w, h};
		SDL_Rect drect = {x, y, 0, 0};
		std::vector<SDL_Color> sdlColors(fc.Colors, fc.Colors + MaxFontColors);
		SDL_SetColors(g.Surface, &sdlColors[0], 0, MaxFontColors);
		SDL_BlitSurface(g.Surface, &srect, TheScreen, &drect);
	} else {
		g.DrawSub(gx, gy, w, h, x, y);
	}
}
开发者ID:stefanhendriks,项目名称:stratagus,代码行数:24,代码来源:font.cpp


注:本文中的CGraphic类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。