I have created a Single Document project.
I would like to know if there is a way to make a "moving" object in MFC (CImage).
CcpPongView::CcpPongView() noexcept
{
// TODO: add construction code here
BackgdoundImage.Load(_T("background.png"));
}
void CcpPongView::OnDraw(CDC* dc)
{
FlickerFreeDC pDC(dc);
CcpPongDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
BackgdoundImage.Draw(pDC->GetSafeHdc(), 0, 0);
ball.getBallImage().Draw(pDC->GetSafeHdc(), ball.position.x, ball.position.y, 25, 25);
Invalidate();
}
but when we run this code again when it gets to the Draw function the program crash.
The project is Pong(the old game) i`m trying to make a ball moving and 2 paddles I got all the logic behind, but sadly don't know how to display it..
Please help me with this cant find it anywhere....