Question
Hi. I have a question about C++. The requirement is: Draw shape at the current mouse position by responding to MouseMoved events. This is what
Hi. I have a question about C++.
The requirement is: Draw shape at the current mouse position by responding to MouseMoved events.
This is what I have so far (Only the part relate to this question):
CODE:
sf::RectangleShape rectangle; rectangle.setSize(sf::Vector2f(120.f, 50.f)); rectangle.setPosition(200,200);
if (event.type == sf::Event::MouseMoved) {
std::cout << " X = " << event.mouseMove.x << ", Y =" < rectangle.getPosition().x + 0, rectangle.getPosition().y + 0); } I assumed it has sth to do with the getPosition function, but I don't know how to apply it. Some details would be appreciated!!!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started