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:
- Copy your Game.h, Game.cpp, and Main.cpp files from the
Lab01
folder to theLab02
folder (make sure you copy using Finder or Explorer to copy files, don’t drag-and-drop within Visual Studio/Visual Studio Code as this will not copy properly) - Open your repo in Visual Studio or Visual Studio Code as usual
- Now you need to change the build target from “Lab01” to “Lab02.” In Visual Studio (PC) this is via the dropdown near the play button. For Visual Studio Code (Mac), you should change both instances of “Lab01” on the bottom toolbar (one for the build target and the other for the run target)
- Remove the following code, which was specific to Pong:
- The ball and paddle member variables
- The drawing code for the walls, ball, and paddle (keep the code that clears the background and presents to the screen)
- In
ProcessInput
, delete the code that updates the paddle direction variable. (Keep the poll event code and the code that callsSDL_GetKeyboardState
) - In
UpdateGame
, delete any code that updates the ball or paddle position, and tests collisions. (Keep the code that limits the framerate to 60fps, computes delta time, and caps the frame rate)
- Change the code in
GenerateOutput
so the screen clears to black, which is(0, 0, 0, 255)
.
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.