CS 3 (Spring 2024) Project 02: Gravity (Game)

In this project, you will add text to your game!

Code Correctness

Deliverable

This week, you will be adding on to your game by implementing text using the SDL TTF libraries.

Text

Now, it’s time to implement text! We have give you a TrueType (.ttf) file in the assets folder, along with two images. You will be writing code so that when you compile your C program, the following sequence occurs:

We expect your game to contain (at least) the following:

Here are a few hints for how to approach the game:

Feel free to play around with different fonts and images! As long as you meet the above guidelines, you are free to use different assets.

For some help, take a look at the official SDL documentation or some resources here! Also keep in mind that SDL_GetError() may come in handy when debugging your code (more information in the previous link).

Note that you should not be re-implementing image rendering code; one of your teammates should have implemented that last week. Thus, you should copy over your team’s image methods from sdl_wrapper.c/sdl_wrapper.h and use game.c from last week as a foundation for your game this week.

Important: Since we have rewritten sdl_draw_polygon to use polygon_t instead of vec_list_t, be careful not to overwrite it with the old sdl_draw_polygon method from last week.

As a reminder, to run the game, all you need to type is make game.