Learn how to display graphics and capture events with Quil.
- [Narrator] With Quil setup, I'd like to add…our mouse events and some graphics.…First, in the setup function, I'm going to establish…the variables we'll be using in our program.…We'll use an X and Y value…for the X and Y coordinate of the mouse.…For the initial values we'll just use zero.…Next, I'll use a pressed key to track if the mouse button…is pressed and we'll default to false.…And lastly, I'll use a count variable…and start at zero, we'll use this to track…which frame we're on.…
Now, the setup routine also needs to configure some things…before we return our initial state.…First, I'll call Quil's frame-rate to establish…our frame-rate at 60 frames a second.…Next, I'll use q smooth to tell it to use smooth…drawing mode.…And lastly, for the color mode, I'll use color-mode…and the key hsb to use hue saturation…and brightness, the default is RGB for red, green and blue.…
Later, we'll be able to change the hue of our color…and draw a rainbow with relative ease.…Now, I'd like to move to the update state function…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.