Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import controlP5.*;
- import javax.swing.*;
- //Object for handling files
- JFileChooser fc = new JFileChooser("~/");
- //Object for handling menus
- ControlP5 controlP5;
- MultiList l;
- MultiListButton file, brush, shape, scale, filling, filters, pick;
- Slider s;
- controlP5.Button fore, back;
- //Canvas, the object that you can doodle on.
- PGraphics canvas;
- //Some global variables, which would be modified by the items in the menu.
- float lineThickness = 1;
- color strokeColor = color(128, 128, 128);
- color fillColor = color(128, 128, 128);
- boolean isMenuActive = false;
- boolean should_i_refresh_the_screen = false;
- boolean previous_mouse_status = false;
- int drawing_method = 0;
- boolean is_fill = false;
- boolean is_picking = false;
- boolean should_i_fill = true;
- boolean should_i_stroke = true;
- // For line, ellipse and rectangle drawing =========
- boolean pending = false;
- float startX, startY;
- float endX, endY;
- // =================================================
- void setup(){
- size(500, 500);
- background(0);
- init_lists();
- canvas = createGraphics(width - 90, height - 20, P3D);
- canvas.beginDraw();
- canvas.background(fillColor);
- canvas.ellipseMode(CORNER);
- canvas.endDraw();
- image(canvas, 80, 10);
- canvas.stroke(255);
- open_dialog_box();
- }
- void draw(){
- background(0);
- canvas.beginDraw();
- if(drawing_method == 0) free_hand();
- canvas.endDraw();
- image(canvas, 80, 10);
- update_color();
- }
Add Comment
Please, Sign In to add comment