Advertisement
Guest User

Untitled

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