Starting from:

$34.99

CS2261 LAB 01: Solution

Drawing Shapes
Provided Files
● lab01.c
Files to Edit/Add
● lab01.c
● Makefile
● .vscode tasks.json

Instructions
Note: Make sure to copy over your Makefile and .vscode/tasks.json from Lab00.
In this lab, you will be completing TODOs to finish writing three functions:
● TODO 1.0-1.1
void setPixel(int col, int row, unsigned short color)
○ Fills the pixel at the specified col and row with the specified color
● TODO 2.0-2.1
void drawRect(int col, int row)
○ Draws a rectangle at the specified column and row
● TODO 3.0-3.1
void drawLetter(int col, int row)
○ You can choose any capital letter (one of your initials or a random letter) to draw. At least one of the lines in your letter must be diagonal. Examples: A, Y, K, Z, V, W, etc.
○ Draws a letter at the specified column and row
After writing the two functions, call the drawLetter function two times and call the drawRect function one time in your main function, with different parameters. The output of your program should look something like the following.



Tips
● For-loops are really great for drawing lines
● The GBA screen size is 240 pixels wide and 160 pixels tall
● If you add parameters to your drawLetter function, you must change its prototype
● If you add parameters to your drawRect function, you must change its prototype


Submission Instructions
Zip up your entire project folder, including all source files, the Makefile, and everything produced during compilation (including the .gba file). Submit this zip on Canvas. Name your submission Lab01_FirstameLastname, for example: “Lab01_GeorgeBurdell.zip”.

More products