This lab is due by Friday, November 07, 2025, Before Class.
As with all labs you may, and are encouraged, to pair program a solution to this lab.  If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.
Jump To: · Rubric · Submission ·
Concepts
For this assignment, you have the opportunity to play with the power that SFML (a special framework called Simple and Fast Multimedia Library) offers.
SFML
SFML is a multimedia Application Programming Interface (API) written in C++ with bindings for various programming languages, including Java, Python, and Ruby. SFML provides an easy way to write code that utilizes graphics, sound effects, and/or networking. SFML is the chosen platform for many cool games, including the Atom Zombie Smasher. You can check out everything SFML has to offer by reading the SFML 3.0.2 documentation.
Setup
Based on your operating system and compiler version that you are using, the installation process will vary. Use the following links to jump to the appropriate section.
Windows with class MinGW provided in L0
The prebuilt SFML Windows library is only compatible with the following MinGW package: WinLibs UCRT 14.2.0 (64-bit). This was the compiler purposely chosen back in Lab0 to assist with the SFML installation at this time.
    From the SFML Download page, download the zip package
    for the GCC 14.2.0 MinGW (SEH) (UCRT) 64-bit version.  When the download completes, unzip the file.  There are three sets of files to
    copy into your MinGW installation:
- Find your MinGW installation folder (ideally 
C:/mingw64or similar). Copy the entireSFMLfolder from~/SFML-3.0.2/includeto the~/mingw64/x86_64-w64-mingw32/includefolder contained within the MinGW folder (if thex86_64-w64-mingw32folder does not exist, then place theSFMLfolder inside theincludefolder in~/mingw64/include. You should now have the location~/include/SFML/inside of MinGW. - Find your MinGW installation folder (ideally 
C:/mingw64or similar). Copy the 34lib*.afiles from~/SFML-3.0.2/libto the~/mingw64/libfolder contained within the MinGW folder. - Find your MinGW installation folder (ideally 
C:/mingw64or similar). Copy the tensfml-*.dllfiles from~/SFML-3.0.2/binto the~/mingw64/binfolder contained within the MinGW folder so they reside alongside theg++program. 
Proceed down to the Instructions portion of the lab.
Windows with a different version of MinGW
If you are not using the compatible version of MinGW, then you have two options:
- Return to L0 and install the appropriate compiler.
 - Download the full SFML source code and build from source. The project is configured as a cmake project so you will need to follow the appropriate steps. If you proceed with this route, developer beware. We can offer some help via Ed but recommend the first solution.
 
macOS
From the SFML Download page, download the zip package for your appropriate version. When the download completes, unzip the file.
You'll now need to copy the library files to your installation. There are a few steps to accomplish this and some will need to be done through the command line:
- Begin by opening a terminal and run the following commands to create a set of folders (they may already exist)
        
NOTE: When requestingcd /usr/local sudo mkdir -p include sudo mkdir -p libsudoaccess, you will be prompted to enter your user password into the terminal. As a security measure, no feedback is shown through the terminal. Type your password and hit enter. - Leave the terminal open as we'll need to do more work here later.  We'll use the Finder GUI to copy the next set of files.  In one Finder, use the top menu
        to select 
Go > Go to Folderand enter/usr/localto work with the folders we just created. - Copy the entire 
SFMLfolder from~/SFML-3.0.2/includeto the/usr/local/includefolder. You should now have the location/usr/local/include/SFML/. - Copy the 26 
lib*.aandlib*.dylibfiles from~/SFML-3.0.2/libto the/usr/local/libfolder. - Now, return to the terminal and move into the lib directory
        
cd /usr/local/lib - When Apple downloads code from unknown sources, it quarantines the files to prevent them from being run.  We can trust the source of these downloads so
        we will need to manually unlock the files and patch a few symbolic links.  Copy and paste the following block of code to patch the library files:
        
NOTE: You may get a message statingcd /usr/local/lib sudo xattr -d com.apple.quarantine lib*.a sudo xattr -d com.apple.quarantine lib*.dylib sudo rm libsfml-audio.3.0.dylib sudo rm libsfml-audio.dylib sudo ln -s libsfml-audio.3.0.2.dylib libsfml-audio.3.0.dylib sudo ln -s libsfml-audio.3.0.dylib libsfml-audio.dylib sudo rm libsfml-graphics.3.0.dylib sudo rm libsfml-graphics.dylib sudo ln -s libsfml-graphics.3.0.2.dylib libsfml-graphics.3.0.dylib sudo ln -s libsfml-graphics.3.0.dylib libsfml-graphics.dylib sudo rm libsfml-network.3.0.dylib sudo rm libsfml-network.dylib sudo ln -s libsfml-network.3.0.2.dylib libsfml-network.3.0.dylib sudo ln -s libsfml-network.3.0.dylib libsfml-network.dylib sudo rm libsfml-system.3.0.dylib sudo rm libsfml-system.dylib sudo ln -s libsfml-system.3.0.2.dylib libsfml-system.3.0.dylib sudo ln -s libsfml-system.3.0.dylib libsfml-system.dylib sudo rm libsfml-window.3.0.dylib sudo rm libsfml-window.dylib sudo ln -s libsfml-window.3.0.2.dylib libsfml-window.3.0.dylib sudo ln -s libsfml-window.3.0.dylib libsfml-window.dylibNo such xattr: com.apple.quarantine, that's safe to ignore. - Back to the Finders.  Copy the six folders from 
~/SFML-3.0.2/Frameworksto/Library/Frameworks(useGo > Go to Folderto get to this location). - Return to the terminal one last time to do a similar patching to unquarantine these files.  Copy and paste the following block of code to patch the framework files:
        
NOTE: You may get a message statingcd /Library/Frameworks sudo xattr -d com.apple.quarantine *.framework sudo xattr -d com.apple.quarantine *.framework/* sudo xattr -d com.apple.quarantine *.framework/*/* sudo xattr -d com.apple.quarantine *.framework/*/*/* sudo xattr -d com.apple.quarantine *.framework/*/*/*/* sudo xattr -d com.apple.quarantine *.framework/*/*/*/*/* cd sfml-audio.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Resources sudo rm sfml-audio sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/sfml-audio sfml-audio cd ../sfml-graphics.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Resources sudo rm sfml-graphics sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/sfml-graphics sfml-graphics cd ../sfml-network.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Resources sudo rm sfml-network sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/sfml-network sfml-network cd ../sfml-system.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Resources sudo rm sfml-system sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/sfml-system sfml-system cd ../sfml-window.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Resources sudo rm sfml-window sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/sfml-window sfml-window cd ../SFML.framework/Versions sudo rm Current sudo ln -s 3.0.2 Current cd .. sudo rm Headers sudo rm Resources sudo rm SFML sudo ln -s Versions/Current/Headers Headers sudo ln -s Versions/Current/Resources Resources sudo ln -s Versions/Current/SFML SFML cd ..No such xattr: com.apple.quarantine, that's safe to ignore. 
Proceed down to the Instructions portion of the lab.
Linux
Attention Linux users: you are encouraged to get SFML from your distro specific package manager. If you're running Linux, then we trust/hope you know what you're doing and why. Proceed down to the Instructions portion of the lab.
Instructions
Download the SFML Template.  This
    will create an empty window to start working with.
    First, take a look at the main.cpp file provided.  In class, we discussed each of the
	commands shown (e.g., creation of the window object and the polling for events); ask questions if there is any confusion.
Second, we also saw the development of a smiley face in class today. A few key lines of code covered follow:
// Draw a circle object called face and color it yellow
sf::CircleShape face;
face.setPosition( sf::Vector2f(15.f, 15.f) );
face.setRadius( 300.f );
face.setFillColor( sf::Color::Yellow );
window.draw( face );
        
// Draw a rectangle object called eye and color it blue
sf::RectangleShape eye;
eye.setSize( sf::Vector2f( 45.f, 150.f ) );
eye.setPosition( sf::Vector2f( 200.f, 150.f ) );
eye.setFillColor( sf::Color(0, 0, 255));
window.draw( eye );
         
// Draw a text object called label
sf::Font myFont;
if( !myFont.openFromFile( "data/arial.ttf" ) )
    return -1;
Text label( myFont );
label.setString( "Hello World!" );
label.setPosition( sf::Vector2f(250.f, 520.f) );
label.setFillColor( sf::Color::Black );
window.draw( label ); 
Your job is to draw something in SFML. What you draw can be anything you want EXCEPT a smiley face (e.g., a tree, a bike, a dog, a word using rectangles/circles, etc.). For full credit, you must draw using at least five shape objects. Be creative and have fun!
Grading Rubric
Your submission will be graded according to the following rubric:
| Points | Requirement Description | 
| 0.70 | Fully meets specifications | 
| 0.15 | Submitted correctly by Friday, November 07, 2025, Before Class | 
| 0.15 | Best Practices and Style Guide followed | 
| 1.00 | Total Points | 
Lab Submission
Always, always, ALWAYS update the header comments at the top of your main.cpp file. And if you ever get stuck, remember that there is LOTS of help available.
Zip together your main.cpp, Makefile, data/* file(s) and name the zip file L4C_USERNAME.zip.  Upload this zip file to Canvas under L4C.
This lab is due by Friday, November 07, 2025, Before Class.
As with all labs you may, and are encouraged, to pair program a solution to this lab.  If you choose to pair program a solution, be sure that you individually understand how to generate the correct solution.