CS 2261 LAB 01 Drawing Shapes solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

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
○ MUST BE FILLED IN (i.e. a solid rectangle, not just lines)
○ May be any color
○ May be any (GBA appropriate) size
○ May NOT be hardcoded. You may not just call setPixel for every colored-in
dot on your rectangle. You must use iteration to do so!

● TODO 3.0-3.1
void drawTriangle(int col, int row)
○ Draws a triangle at the specified column and row
○ May be any color, either filled in or not (your choice)
○ May be any (GBA appropriate) size
○ May NOT be hardcoded. You may not just call setPixel for every colored-in
dot on your triangle. You must use iteration to do so!

After writing the two functions, call the drawTriangle 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.

Your triangles and your rectangle may be any size, shape, color, rotation, or position you
want, as long as we can see that you drew two triangles and one filled-in rectangle. If you
want, you can add parameters to the function to control color, size, or shape.

 

After you have
completed all the TODOs and your output looks correct, you are finished with the lab after
you submit it.

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”.