Exemple #1
0
void CWndShopCtrl::OnDraw(C2DRender* p2DRender) 
{
	CPoint pt( 3, 3 );
	CRect rect = GetClientRect();

	for( int i = 0; i < MAX_CART; i++ )
	{
		int x = i % 6;
		int y = i / 6;		
		CItemBase* pItemBase = m_pItemElem[ i ];
		if( pItemBase )
		{
			if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 35, y * 35 ), D3DCOLOR_ARGB( 255, 255, 100, 100 ) );
			else
				pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 35, y * 35 ) );
			
			CRect rectHittest = CRect( x * 35, y * 35 + 3, x * 35 + 35, y * 35 + 35 + 3);
			CPoint point = GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );

				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest );
			}

			CItemElem* pItemElem = (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				//short n	= m_nBuy[i];
				//if( IsUsingItem( pItemBase ) )
				//	n = pItemBase->GetExtra();																		
				short m_nItemNum	= pItemElem->m_nItemNum;
				if( pItemElem->GetExtra() > 0 )
				    m_nItemNum	-= (short)pItemElem->GetExtra();

				TCHAR szTemp[ 35 ];
				_stprintf( szTemp, "%d", m_nItemNum );
				//_stprintf( szTemp, "%d", n );
			    CD3DFont* pOldFont = p2DRender->GetFont();//adeilson
		        p2DRender->SetFont( CWndBase::m_Theme.m_pFontWndNewTitle );
				CSize size = m_p2DRender->m_pFont->GetTextExtent( szTemp );
				m_p2DRender->TextOut( x * 35 + 35 - size.cx, y * 35 + 35 - size.cy, szTemp, 0xFF000000 );
				m_p2DRender->TextOut( x * 35 + 34 - size.cx, y * 35 + 34 - size.cy, szTemp, 0xFF85FF8A );
				p2DRender->SetFont( pOldFont );

				//_stprintf( szTemp, "%d", n );
				//CSize size = p2DRender->m_pFont->GetTextExtent( szTemp );
				//p2DRender->TextOut( x * 35 + 35 - size.cx, y * 35 + 35 - size.cy, szTemp, 0xff1010ff );
			}
		}
	}
}
void CWndGuildMeritCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pItemContainer.size() <= 0 )
		return;

	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 32;

	// 스크롤바 관련   
	CPoint pt( 0, 0 );

	nWidth = 6;
	int nPage = nHeight;
	int nRange = m_pItemContainer.size() / nWidth;// - nPage;
	if( m_pItemContainer.size() % nWidth )
		nRange++;

	m_wndScrollBar.SetScrollRange( 0, nRange );
	m_wndScrollBar.SetScrollPage( nPage );
	
	pt.y = 0;
	pt.y += m_wndScrollBar.GetScrollPos() * nWidth;

	for( int i = pt.y; i < (int)( m_pItemContainer.size() ); i++ )
	{
		int x	= ( i - pt.x ) % 6;
		int y	= ( i - pt.y ) / 6;
		CItemBase* pItemBase	= m_pItemContainer[i];
		if( pItemBase )
		{
			pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 13, y * 32 + 7 ) );
			CRect rectHittest	= CRect( x * 32 + 13, y * 32  + 7, x * 32  + 13 + 32, y * 32 + 32 + 7 );
			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}
			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( x * 32 + 32 - size.cx + 17, y * 32 + 32 - size.cy + 10, szTemp, 0xff1010ff );
			}
		}
	}
}
Exemple #3
0
void CWndVendorCtrl::OnMouseMove( UINT nFlags, CPoint point )
{
	if( m_bDrag == FALSE )
		return;
	m_bDrag		= FALSE;
	CPoint pt( 3, 3 );
	CRect rect;

	CItemBase* pItemBase	= m_pFocusItem;
	if( IsUsingItem( pItemBase ) )
	{
		m_GlobalShortcut.m_pFromWnd		= this;
		m_GlobalShortcut.m_dwShortcut	= SHORTCUT_ITEM;
		m_GlobalShortcut.m_dwIndex	= m_nCurSel;
		m_GlobalShortcut.m_dwType	= 0;
		m_GlobalShortcut.m_dwId		= pItemBase->m_dwObjId;
		m_GlobalShortcut.m_pTexture		= pItemBase->GetTexture();
		m_GlobalShortcut.m_dwData	= (DWORD)pItemBase;
		_tcscpy( m_GlobalShortcut.m_szString, pItemBase->GetProp()->szName );
	}
}
Exemple #4
0
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pMover == NULL )
		return;

	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;

	for( int i = 0; i < MAX_VENDITEM; i++ )
	{
		int x	= i % 6;
		int y	= i / 6;
		//p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
		CRect rectHittest	= CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 );

		CPoint point	= GetMousePoint();

		if( rectHittest.PtInRect( point ) )
		{
			if( CWndBase::m_GlobalShortcut.m_dwData )
			{
				m_nCurSel = -1;
				CPoint ptx = CPoint(x * 32 + 7, y * 32 + 11);
				{
					m_pTex->Render( p2DRender, ptx );
				}
			}
		}			
		CItemBase* pItemBase = GetItem( i );
		if( pItemBase )
		{
			if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
			{
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ), D3DCOLOR_XRGB( 255, 100, 100 ) );
			}
			else
			{
				pItemBase->GetTexture()->Render( p2DRender, CPoint( x * 32 + 6, y * 32 + 10 ) );
			}

			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}
			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( x * 32 + 7, y * 32 + 11, x * 32 + 32 + 5, y * 32 + 32 + 9 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( x * 32 + 32 - size.cx+5, y * 32 + 32 - size.cy+12, szTemp, 0xff1010ff );
			}
		}
	}
}
Exemple #5
0
void CWndVendorCtrl::OnDraw( C2DRender* p2DRender )
{
	if( m_pMover == NULL )
		return;
	
	CRect rect	= GetClientRect();
	int nWidth	= rect.Width() / 32;
	int nHeight		= rect.Height() / 35;

#if __VER >= 8 //__S8_VENDOR_REVISION
	for( int i = 0; i < MAX_VENDOR_REVISION; i++ )
#else //__S8_VENDOR_REVISION
	for( int i = 0; i < MAX_VENDITEM; i++ )
#endif //__S8_VENDOR_REVISION
	{
		int x	= i % 2;
		int y	= i / 2;
		
		int nX;
		int nY = y * 32 + 8 + y * 4;
		if( x == 0 )
			nX = x * 32 + 15;
		else
			nX = 235;

		CRect rectHittest = CRect( nX, nY, nX + 180, nY + 32 );
		CPoint point	= GetMousePoint();
		if( rectHittest.PtInRect( point ) )
		{
			if( CWndBase::m_GlobalShortcut.m_dwData )
			{
				m_nCurSel = -1;
				{
					CPoint ptx = CPoint(nX, nY);
					m_pTex->Render( p2DRender, ptx );		// 아이템 테두리 그리기
				}
			}
		}			
		CItemBase* pItemBase = GetItem( i );
		if( pItemBase )
		{

			// 툴팁
			float fScal = 1.0f;
			CPoint point	= GetMousePoint();
			if( rectHittest.PtInRect( point ) )
			{
				fScal = 1.15f;
				CPoint point2 = point;
				ClientToScreen( &point2 );
				ClientToScreen( &rectHittest );
				g_WndMng.PutToolTip_Item( pItemBase, point2, &rectHittest, APP_VENDOR );
			}

			// 아이템 아이콘 
			if( ((CItemElem*)pItemBase)->IsFlag( CItemElem::expired ) )
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 100, 100 ) );					
			else
				pItemBase->GetTexture()->Render2( p2DRender, CPoint( nX, nY ), D3DCOLOR_XRGB( 255, 255, 255 ), fScal, fScal );

			// 아이템 이름, 판매가격
			OnDrawItemInfo( p2DRender, ((CItemElem*)pItemBase), nX, nY );

			if( i == m_nCurSel )
				p2DRender->RenderRect( CRect( nX, nY, nX + 32, nY + 32 ), 0xff00ffff );
			CItemElem* pItemElem	= (CItemElem*)pItemBase;
			if( pItemElem->GetProp()->dwPackMax > 1 )
			{
				short nItemNum	= pItemBase->GetExtra();
				TCHAR szTemp[32];
				_stprintf( szTemp, "%d", nItemNum );
				CSize size	= p2DRender->m_pFont->GetTextExtent( szTemp );
				p2DRender->TextOut( nX - 7 + 32 - size.cx+5, nY - 11 + 32 - size.cy+12, szTemp, 0xff1010ff );
			}
		}
	}
}