Guest User

Untitled

a guest
May 23rd, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. import controlP5.*;
  2. import javax.swing.*;
  3.  
  4. //Object for handling files
  5. JFileChooser fc = new JFileChooser("~/");
  6.  
  7. //Object for handling menus
  8. ControlP5 controlP5;
  9. MultiList l;
  10. MultiListButton file, brush, shape, scale, filling, filters, pick;
  11. Slider s;
  12. controlP5.Button fore, back;
  13.  
  14. //Canvas, the object that you can doodle on.
  15. PGraphics canvas;
  16.  
  17. //Some global variables, which would be modified by the items in the menu.
  18. float lineThickness = 1;
  19. color strokeColor = color(128, 128, 128);
  20. color fillColor = color(128, 128, 128);
  21. boolean isMenuActive = false;
  22. boolean should_i_refresh_the_screen = false;
  23. boolean previous_mouse_status = false;
  24. int drawing_method = 0;
  25. boolean is_fill = false;
  26. boolean is_picking = false;
  27.  
  28. boolean should_i_fill = true;
  29. boolean should_i_stroke = true;
  30.  
  31. // For line, ellipse and rectangle drawing =========
  32. boolean pending = false;
  33. float startX, startY;
  34. float endX, endY;
  35. // =================================================
  36.  
  37.  
  38. void setup(){
  39. size(500, 500);
  40. background(0);
  41. init_lists();
  42. canvas = createGraphics(width - 90, height - 20, P3D);
  43.  
  44. canvas.beginDraw();
  45. canvas.background(fillColor);
  46. canvas.ellipseMode(CORNER);
  47. canvas.endDraw();
  48. image(canvas, 80, 10);
  49. canvas.stroke(255);
  50. open_dialog_box();
  51. }
  52.  
  53. void draw(){
  54. background(0);
  55. canvas.beginDraw();
  56. if(drawing_method == 0) free_hand();
  57. canvas.endDraw();
  58. image(canvas, 80, 10);
  59. update_color();
  60. }
Add Comment
Please, Sign In to add comment