PS0

Home Assignments Lecture Blog Resources Discussion Group

Hello World

The main purpose of this assignment is for you to get up and running with your build environment. You'll write a bit of code. Also you'll join the class's Google discussion group, fill out a brief survey, and use submit to turn stuff in.

1. Get your build environment set up

Linux Setup Mac Setup Windows Setup Using the CS Cluster

You must use GCC and Make to configure and build your code. The reference compiler for the course is g++ version 4.6.3.

There are various options:

  1. You can configure our own Unix machine—Linux or Mac OS X.
  2. You can use the cs.uml.edu cluster. (You'll use an X windows server on your own machine so that you can receive windows sent by the cluster.) Note—this option won't work when we get to the assignments involving audio.
  3. You can use the department's Linux machines in the 308 and 310 labs.

Note: You can not use Visual Studio.

If you have a Windows machine and you don't want to install Linux in a partition or in a virtual machine, your best choice is to use the Xming Server to SSH into the cluster.

Option #2 above will work for all projects except for the GuitarHero, which requires audio. For that one, you'll have to configure your own machine, or physically work in 308 or 310.

We are using the C++ Simple Fast Media Library, SFML, www.sfml-dev.org. Either version 2.0 or 2.1 will work. Do not install 1.6.

You may use any IDE that you like, or none at all.

Please see setup instructions under the course Resources page. Come back here when you're set up.

2. Build the SFML Hello World code

The SFML “did I install everything correctly” code is about 20 lines long and results in your computer popping up a window like this:

Go to the tutorial for your platform, e.g. http://www.sfml-dev.org/tutorials/2.1/start-linux.php, and get the code running on your machine.

3. Extend the demo code.

Now that you've got things running, do something fun with SFML. In addition to the green circle, look at the documentation and get your window showing an image sprite and drawing text. Don't worry, it's super easy: http://www.sfml-dev.org/documentation/2.1/ .

You probably want to make your window bigger than the 200x200. Also, no need for audio now (we will be using it later).

Once you have stuff displayed, extend your code so that your sprite moves across the window as part of the event loop. You can simply make an index variable and have it go from left to right and then stop moving. You're welcome to do something more complicated if you like. The window.setFramerateLimit() method might be helpful if things move too fast (see “Controlling the framerate” at http://www.sfml-dev.org/tutorials/2.1/window-window.php).

Notes:

  • It's correct to clear everything in the window and redraw stuff each time through the event loop. That's how SFML works.
  • You reposition things (e.g. a sprite) by setting its position before you draw it. Check the sprite API docs.
  • If you draw stuff outside the bounds of the window, you won't see it :)

You'll submit your .cpp source file, and also, take a screensnap of your running code. (Linux users—Shutter is a great tool for screen grabs.)

Make sure your name is in a comment in your .cpp file!

4. Miscellaneous course participation stuff

Please do the following:

5. Assignment readme file

Before submitting, fill out info in the ps0-readme.txt file. Make sure you re-save it as a text only file.

6. Submit!

You will use the submit command on the CS Department main Linux machine cs.uml.edu to submit your work. You will have to copy your answer files to the CS server (use scp) and then log in to submit.

You will be submitting exactly three files:

  1. Your SFML demo program with a .cpp suffix.
  2. Your screen grab showing your code running.
  3. Your completed ps0-readme.txt file.

Once the files are up on cs.uml.edu, submit them with:

submit fredm 204-ps0 first-file second-file third-file

Please don't archive them first and then submit the archive.