Assignment 01: Blobilism

Due Thursday, January 26, before midnight

The goals for this assignment are:

  • Build and write a simple interactive application

  • Repond to user key and mouse events

  • Write a C++ program

  • Use std::vector

  • Work within a 2D coordinate system

1. Description

In the file, src/blobilism.cpp, implement a drawing program.

  • Support a circle brush type

  • Support multiple brush sizes (no smaller than size 1)

  • Support multiple colors with a pallette (at least three)

  • Support transparency

  • Clear an image

Your program will use a simple API based on openGL and GLFW. Click here to see the documentation.

2. Build

Fork the repository at https://github.com/BrynMawr-CS313-S23/blobilism into your own repository.

Clone the repository to your own machine and follow the directions in the README to build.

Don’t forget to do an "out of source" build and run cmake .. from the /build directory!
$ git clone git@github.com:<username>/blobilism.git
$ cd blobilism
$ mkdir build
$ cd build
$ cmake ..
$ make (or start blobilism.sln)
$ ../bin/blobilism (or ../bin/Debug/blobilism from the developer console in Visual Studio)

You are given basecode for this assignment in src/blobilism.cpp. When you run the basecode, you should see the following image.

basecode

3. Requirements

  • Your program should accept the following key input

    • The 'c' key should clear the canvas.

    • The 'UP' key should increase the brush size

    • The 'DOWN' key should decrease the brush size. The brush size should not be allowed to go smaller than 1.

    • The 'RIGHT' key should decrease the transparency. The transparency should go no smaller than 0.

    • The 'LEFT' key should increase the transparency.

  • You program should have circle buttons for changing the current color

    • Check whether the user clicked inside any of the pallet buttons. If yes, change the current color to the pallet button’s color.

  • Draw a circle whenever the user moves the mouse with the left-mouse button pressed. To implement this feature, store the current size, color, and (x,y) coordinate in a vector whenever the mouse moves. (Hint: Use a struct or class to store this information together. Add the information in response to the "mouse move" event)

  • Your program should follow the course coding standard guide.

  • DON’T FORGET to update the README with images that you’ve made with your program!

Please feel free to customize your drawer! Some ideas

  • Choose your own pallette colors

  • Implement a unique brush. Although the draw API only supports circles, rectangles, and triangles, you can combine them to make different shapes.

4. Hints

Computing distance

To check whether the user clicks a pallette circle, compute the distance between the current mouse position and each of the circles in your pallette. Recall that the distance between two points a and b is

\[d = \sqrt{(ax - bx)^2 + (ay - by)^2}\]

5. Submit your work

Submission checklist:

  • Compiles on unix (test on a lab machine or goldengate.cs.brynmawr.edu).

  • Updated README (All "todos" should be replaced with your work!)

  • Pushed to github

To push to github, make sure you add and commit your local changes and then push to Github.

$ cd blobilism
$ git add .
$ git commit -m "assignment complete"
$ git push