Answer the question
In order to leave comments, you need to log in
Why does the drawing stretch and not move?
Hello. The essence of the program is to draw the cosine and sine so that the arrows can move the drawing, that is, the norm moves up and down, but it does not move it to the sides, but stretches it. You can see it on the screenshots:
My button code:
if (Keyboard.IsKeyPressed(Keyboard.Key.Left))
{
lambda--;
window.Clear();
window.Draw(GetVertexArray(50, y, lambda));
window.Draw(GetVertexArraySin(50, y, lambda));
window.Display();
}
if (Keyboard.IsKeyPressed(Keyboard.Key.Right))
{
lambda++;
window.Clear();
window.Draw(GetVertexArray(50, y, lambda));
window.Draw(GetVertexArraySin(50, y, lambda));
window.Display();
}
Answer the question
In order to leave comments, you need to log in
Well, probably because you are changing the lambda, but it would be worth changing some variable x and rewriting the code a little to this:
x--; // ну и соотвественно x++ в альтернативном случае
window.Draw(x + GetVertexArray(50, y, lambda));
window.Draw(x + GetVertexArraySin(50, y, lambda));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question