Answer the question
In order to leave comments, you need to log in
How to control key animation in c++?
Hello, could you tell me what code you need to write to control the animation in c ++, that is, so that when an object is pressed, let's move to the left, and then when it moves to the left, we press another and the movement changes to the right
Answer the question
In order to leave comments, you need to log in
Well, for example, to catch the message of pressing the corresponding key and change the coordinates of the object. Here in MFC something like this for example.
BOOL CMainWindow::PreTranslateMessage(MSG* pMsg)
{
if( pMsg->message == WM_KEYDOWN)
{
if (pMsg->wParam == VK_SPACE)
{
// поймали нажатие пробела, что то там делаем, например меняем координату;
x += 5;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question