Esempio n. 1
0
void CWnd::Blt(LPDIRECTDRAWSURFACE7 lpSurf)
{
	if (childwindow)
	{
		childwindow->Blt(lpSurf);
		return;
	}
	PreBlt();
	RECT r={0,0,w,h};
	lpSurf->BltFast(x,y,surf,&r,0);
}
Esempio n. 2
0
void CCursor::Draw(LPDIRECTDRAWSURFACE7 lpSurf,const int w,const int h)const
{
//#define STRETCHCURSOR
	if (lpSurface[curframe]==NULL)return;
	if ((CursorPos.x<0)||(CursorPos.y<0)||(CursorPos.x>w)||(CursorPos.y>w))return;

	const int hotspotx=10;
	const int hotspoty=5;

#ifdef STRETCHCURSOR
	const int cw=(width*w)/800;
	const int ch=(height*h)/600;

	RECT s={0,0,width,height};
	RECT d={x,y,x+cw,y+ch};
	if (d.right>w)
	{
		s.right-=((d.right-w)*800)/w;
		d.right=w;
	}
	if (d.bottom>h)
	{
		s.bottom-=((d.bottom-h)*600)/h;
		d.bottom=h;
	}

	lpSurf->Blt(&d,lpSurface[curframe],&s,DDBLT_WAIT|DDBLT_KEYSRC,NULL);
#else
	RECT src={0,0,width,height};
	int mx=CursorPos.x-hotspotx;
	int my=CursorPos.y-hotspoty;

	if (mx<0)
	{
		src.left-=mx;
		mx=0;
	}
	if (my<0)
	{
		src.top-=my;
		my=0;
	}
	if (mx+src.right>w)
		src.right=w-mx;
	if (my+src.bottom>h)
		src.bottom=h-my;

	lpSurf->BltFast(mx,my,lpSurface[curframe],&src,DDBLTFAST_SRCCOLORKEY);
#endif
}