[Solved] CS2261 LAB1-Drawing Shapes

$25

File Name: CS2261_LAB1-Drawing_Shapes.zip
File Size: 244.92 KB

SKU: [Solved] CS2261 LAB1-Drawing Shapes Category: Tag:
5/5 - (1 vote)

Drawing Shapes

Provided Files

  • lab01.c

Files to Edit/Add

  • 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

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS2261 LAB1-Drawing Shapes
$25