1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
void CSprite::Draw(float _fWidthDivisor, float _fHeightDivisor, int _iWidthAddition)
{
float fW = GetWidth()/_fWidthDivisor;
float fH = GetHeight()/_fHeightDivisor;
float SCREEN_OFFSET_X = CGame::GetInstance().GetLevel()->m_Camera->GetScreenOffsetX();
float SCREEN_OFFSET_Y = CGame::GetInstance().GetLevel()->m_Camera->GetScreenOffsetY();
float fX = m_fX - (fW/2) - SCREEN_OFFSET_X;
float fY = m_fY - (fH/2) - SCREEN_OFFSET_Y;
CBackBuffer* pBackBuffer = CGame::GetInstance().GetBackBuffer();
HGDIOBJ hOldObj = SelectObject(s_hSharedSpriteDC, m_hMask);
BitBlt(pBackBuffer->GetBackDC(), fX, fY, fW, fH, s_hSharedSpriteDC, 0, 0, SRCAND);
SelectObject(s_hSharedSpriteDC, m_hSprite);
BitBlt(pBackBuffer->GetBackDC(), fX, fY, fW, fH, s_hSharedSpriteDC, 0, 0, SRCPAINT);
SelectObject(s_hSharedSpriteDC, hOldObj);
}
|