Skip to main content Link Search Menu Expand Document (external link)

Theme: auto

Setup

Merge Pull Request

If you’ve not already done so, make sure you merge the pull request on your repo on GitHub.

To do this:

  1. On your GitHub repo page, click the “Pull Request” tab: Pull Request tab

  2. Next, click on the open pull request listed: Pull request

  3. In here, click the “Merge pull request” button: Merge pull request

  4. Now on your computer, you will need to “pull” or “fetch” the changes using your git client, from command line this would be just:

    git pull origin main
    

    In GitHub desktop, you can click the “fetch” button on the top toolbar.

Code Setup

This lab builds on the code in Lab 1. If you did not complete Lab 1, ask the TAs and/or instructor for help to finish the lab during today’s lab session.

Now do the following to get your Lab 1 files ready for Lab 2:

  1. Copy the .cpp/.h files from your Lab01 folder to your Lab02 folder. DO NOT copy the CMakeLists.txt file over or any other files other than the .cpp/.h files. (Make sure you copy files using Finder or Explorer, not in CLion)
  2. Now open your Lab02 folder in CLion. Keep in mind since you’re opening Lab02 for the first time, you will need to enable ClangFormat and format on save, as outlined in the “Configuration for EVERY Project” instructions
  3. Remove the following code, which was specific to Pong:
    • The member variables for the various walls, ball, and paddle
    • Delete all the code inside LoadData
    • In GenerateOutput, comment out the loop that draws the actors, as we’ll be doing this differently from now on. Keep the other code in here
    • In ProcessInput, delete the code that detects the A/D keys (keep the code for the ESC key)
    • In UpdateGame, delete the code that updates the ball or paddle positions, and tests collisions. Keep all the code for delta time, though
    • Remove any Pong-specific constants you may have made

You should be able to compile and run the game, and the screen should be black. You should still be able to press ESC to quit.

Now you’re ready for part 1 of the lab.