From b7e2247ac0fe4378808daecabd60c39c67e36f19 Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Fri, 11 Nov 2016 18:00:05 -0800 Subject: [PATCH] Added missing files. --- links/main.css | 3 +++ scripts/brush.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 links/main.css create mode 100644 scripts/brush.js diff --git a/links/main.css b/links/main.css new file mode 100644 index 0000000..0c578d6 --- /dev/null +++ b/links/main.css @@ -0,0 +1,3 @@ +body { margin:0px; padding:0px; overflow:hidden;} +canvas:hover { cursor: crosshair;} +#commander { background:black; padding:15px; position:fixed; bottom:30; color:white; left:30px; border:0; width:calc(100vw - 60px); font-family:courier; cursor:pointer;} diff --git a/scripts/brush.js b/scripts/brush.js new file mode 100644 index 0000000..c6f2f30 --- /dev/null +++ b/scripts/brush.js @@ -0,0 +1,46 @@ +function Brush() +{ + this.position = new Position(); + this.is_drawing = false; + + // Pointers + + this.pointers = [new Pointer(new Position(0,0))]; + + this.add_pointer = function(pointer) + { + this.pointers.push(pointer); + } + + // Draw + + this.draw = function(e) + { + if(this.is_drawing === false){return;} + + this.position = new Position(e.clientX,e.clientY); + + for (i = 0; i < this.pointers.length; i++) { + this.pointers[i].draw(); + } + } + + this.draw_start = function(e) + { + this.is_drawing = true; + + for (i = 0; i < this.pointers.length; i++) { + this.pointers[i].start(); + } + } + + this.draw_stop = function(e) + { + this.is_drawing = false; + + for (i = 0; i < this.pointers.length; i++) { + this.pointers[i].stop(); + } + } + +} \ No newline at end of file