Hello.
I am a student beggining a project using object oriented cpp.
I never used any graphical library before therefore my knowledge in the subject is pretty limited.
I am writing a method, draw that uses a given function, buildcircle (which is defined in an external file).
What I am trying to do is, using a provided test file, to be able to draw red circles on a window where my mouse points (defined in the test file).
I use a method called addTarget to add given targets to a list of vectors called "lesCibles".
I think that I need to call my method draw while adding the targets to my list (inside addTarget) in order to have these circles drawn.
I hope that this explanation is good enough.
//addTarget method
void Environment::addTarget(const Vec2d& cibles){
lesCibles.push_back(cibles);
//Call the draw method ?
}
//draw method
void Environment::draw(sf::RenderTarget& targetWindow)
{
for(auto lesCibles:lesCibles){
sf::CircleShape circle = buildCircle(lesCibles, 5, sf::Color(255, 0, 0));
targetWindow.draw(circle); //This command was given by the teacher
}
}
//Prototype of the buildCircle funtion (external file)
sf::CircleShape buildCircle(Vec2d const& position, double radius, sf::Color color);
/*!
* @brief Construct an annulus with a sf::CircleShape.
*
* @param position position of the centre of the ring
* @param radius inner radius of the ring
* @param color the color of the ring
* @param thickness width of the ring
* @param fillColor the color of the content
* @return a shape with all these parameters set
*/