Exemplo n.º 1
0
void Monster::DrawToMiniMap(FLOAT scalX, FLOAT scalY)
{
	IEngine* pEngine = GetEngine();
	IVideo* pVideo = pEngine->getVideo();

	int x = 0, y = 0;

	if (m_isMouseMove || m_isSelected) {
		// Ñ¡ÖÐ״̬
		m_nameColor = RED;
		m_Effect = EF_RED;
		int x1=0, y1=0, x2=0, y2=0;

		// ³öÉú·¶Î§
		x = m_pt.x / CXTILE;
		y = m_pt.y / CYTILE;
		int birthW = m_info.birthRect.cx;
		int birthH = m_info.birthRect.cy;
		x1 = x - birthW;
		y1 = y - birthH;
		x2 = x + birthW + 1;
		y2 = y + birthH + 1;
		x1 = x1 * CXTILE / scalX;
		y1 = y1 * CYTILE / scalY;
		x2 = x2 * CXTILE / scalX;
		y2 = y2 * CYTILE / scalY;
		pVideo->drawRect(Pointf(x1, y1), Pointf(x2, y2), YELLOW);

		// ÊÓÒ°·¶Î§
		x = m_pt.x / CXTILE;
		y = m_pt.y / CYTILE;
		int viewW = m_info.view;
		int viewH = m_info.view;
		x1 = x - viewW;
		y1 = y - viewH;
		x2 = x + viewW + 1;
		y2 = y + viewH + 1;
		x1 = x1 * CXTILE / scalX;
		y1 = y1 * CYTILE / scalY;
		x2 = x2 * CXTILE / scalX;
		y2 = y2 * CYTILE / scalY;
		pVideo->drawRect(Pointf(x1, y1), Pointf(x2, y2), RED);
	} else {
		// ·ÇÑ¡ÖÐ״̬
		m_nameColor = YELLOW;
		m_Effect = EF_NORMAL;
	}
}
Exemplo n.º 2
0
void Monster::DrawPositionToMiniMap(FLOAT scalX, FLOAT scalY)
{
	IEngine* pEngine = GetEngine();
	IVideo* pVideo = pEngine->getVideo();

	int x1 = m_pt.x / CXTILE;
	int x2 = x1 + 1;
	int y1 = m_pt.y / CYTILE;
	int y2 = y1 + 1;
	x1 = x1 * CXTILE / scalX;
	y1 = y1 * CYTILE / scalY;
	x2 = x2 * CXTILE / scalX;
	y2 = y2 * CYTILE / scalY;
	pVideo->drawSolidRect(Pointf(x1, y1), Pointf(x2, y2), YELLOW);
	pVideo->drawRect(Pointf(x1, y1), Pointf(x2, y2), RED);
}
Exemplo n.º 3
0
void Monster::Draw(POINT ptMap)
{
	IEngine* pEngine = GetEngine();
	IVideo* pVideo = pEngine->getVideo();
	easy2d::IFont* pFont = pEngine->getFont();

	// »­¹ÖÎïÉíÌåͼƬ
	int x = m_pt.x - ptMap.x;
	int y = m_pt.y - ptMap.y;
	mSpriteSheet.render(x+CXTILE/2, y+CYTILE/2);
	if (CommData::isShowMiniMap) {
		pVideo->drawSolidRect(Pointf(x, y), Pointf(x+CXTILE, y+CYTILE), 0x50FFFF00);
		pVideo->drawRect(Pointf(x, y), Pointf(x+CXTILE, y+CYTILE), RED, 2.0f);
	}

	if (m_isMouseMove || m_isSelected) {
		// Ñ¡ÖÐ״̬
		m_nameColor = RED;
		m_Effect = EF_RED;
		int x1=0, y1=0, x2=0, y2=0;
		
		// ³öÉúÇøÓò
		x = m_pt.x - ptMap.x;
		y = m_pt.y - ptMap.y;
		int birthW = m_info.birthRect.cx * CXTILE;
		int birthH = m_info.birthRect.cy * CYTILE;
		x1 = x - birthW;
		y1 = y - birthH;
		x2 = x + birthW + CXTILE;
		y2 = y + birthH + CYTILE;
		pVideo->drawRect(Pointf(x1, y1), Pointf(x2, y2), YELLOW);

		// ÊÓÒ°(¹¥»÷)·¶Î§
		x = m_pt.x - ptMap.x;
		y = m_pt.y - ptMap.y;
		int viewW = m_info.view * CXTILE;
		int viewH = m_info.view * CYTILE;
		x1 = x - viewW;
		y1 = y - viewH;
		x2 = x + viewW + CXTILE;
		y2 = y + viewH + CYTILE;
		pVideo->drawRect(Pointf(x1, y1), Pointf(x2, y2), RED);
	} else {
		// ·ÇÑ¡ÖÐ״̬
		m_nameColor = YELLOW;
		m_Effect = EF_NORMAL;
	}

	// »æÖÆÃû×Ö¡¢ÊýÁ¿¡¢µôÂä±àºÅ
	CString strName = m_name.c_str();
	if (m_num > 1) {
		CString strNum;
		strNum.Format("(ÊýÁ¿*%d)", m_num);
		strName += strNum;
	}
	if (m_info.dropInfo[0].dropId != 0) {
		CString strDrop;
		strDrop.Format("[µôÂä%d]", m_info.dropInfo[0].dropId);
		strName += strDrop;
	}

	// »­¹ÖÎïÃû×Ö
	int frameHeight = 0;
	int offsetX = (int)strName.GetLength() * 4 - CXTILE/2;
	FRAME_INFO* frm = mSpriteSheet.getFrame(0);
	if (frm != NULL) {
		frameHeight = mSpriteSheet.getFrame(0)->height;
	} else {
		frameHeight = 86;
	}

	stFontEffect fontEff;
	pFont->drawString(x-offsetX, y-frameHeight, strName, m_nameColor, fontEff);
}