SFML Window with Event Handling

#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow win(sf::VideoMode(800, 600), "Hello SFML!");
// Run the program as long as the window is open
while (win.isOpen())
{
// Check all the window's events that were triggered
// since the last iteration of the main loop.
sf::Event event;
while (win.pollEvent(event))
{
// Close event so we close the window
if (event.type == sf::Event::Closed)
{
win.close();
}
// Escape key pressed
if ((event.type == sf::Event::KeyPressed)
&& (event.key.code == sf::Keyboard::Escape))
{
win.close();
}
}
}
return 0;
}

The above code only positions the eyes, so you need to add the object construction and draw() commands. Build and run the project to verify your code is correct. If you have problems, ask a classmate or the instructor for help before continuing.

Create and draw a nose using similar code as for drawing the eyes. Some suggested settings:

const int NOSE_SIZE = 30;

Next, add code to create and draw a line for the mouth using code like the following: