Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 9 Add next and previous buttons
- 1. In a new tab, write a class called Button. This class has four float variables called x
- and y (coordinates of the button), and w and h (the width and a height of the button).
- 2. Write a constructor for Button that has four parameters, xp, yp, wd and ht which are
- used to assign values to your four class variables.
- 3. Write a function called display to display your button on the canvas as a red
- rectangle at its X and Y coordinates and useing its correct width and height.
- 4. Update your setup/draw tab to declare two global variables for the two buttons.
- 5. Initialise the variables in the setup passing parameter values to the Button
- constructor for X, Y width and height. Each button is 100 pixels wide and 75 high.
- 6. In the draw function, call each button’s display function.
- 7. Run the program to see the two red rectangles on the canvas. At this stage the
- buttons do not respond and there are no labels.
- 8. Fix any errors before continuing.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement