diff --git a/scripts/brush.js b/scripts/brush.js index 21028ab..7e3e0be 100644 --- a/scripts/brush.js +++ b/scripts/brush.js @@ -2,9 +2,18 @@ function Brush() { this.position = new Position(); this.is_drawing = false; + this.size = 1; + this.opacity = 1; // Commander + this.settings = function(p) + { + if(p[0]){ this.size = parseInt(p[0]); } + if(p[1]){ this.opacity = parseFloat(p[1]); } + if(p[2]){ this.color = new Color(p[2]); } + } + this.add = function(p) { if(p.length > 1){ diff --git a/scripts/commander.js b/scripts/commander.js index e94ead5..db53416 100644 --- a/scripts/commander.js +++ b/scripts/commander.js @@ -15,25 +15,29 @@ function Commander(element,element_input) this.element_input.value = ""; } - this.validate = function() + this.validate = function(command) { - var parts = this.element_input.value.split(" "); + var parts = command; // Canvas if(parts[0] == "@"){ canvas.setAttribute('width',parts[1]+"px"); canvas.setAttribute('height',parts[2]+"px"); + ronin.guides_element.setAttribute('width',parts[1]+"px"); + ronin.guides_element.setAttribute('height',parts[2]+"px"); } // Brush - if(parts[0] == "+"){ + if(parts[0] == "&"){ + parts.shift(); + brush.settings(parts); + } + + // Pointers + if(parts[0] == ">"){ parts.shift(); brush.add(parts); } - if(parts[0] == "-"){ - parts.shift(); - brush.remove(parts); - } // Save if(parts[0] == "$"){ diff --git a/scripts/keyboard.js b/scripts/keyboard.js index 4adc6f3..059d94f 100644 --- a/scripts/keyboard.js +++ b/scripts/keyboard.js @@ -41,7 +41,18 @@ function Keyboard() this.key_enter = function() { - commander.validate(); + var cmd = commander.element_input.value; + + if(cmd.indexOf(";") > 0){ + var cmds = cmd.split(";"); + for (i = 0; i < cmds.length; i++) { + cmd = cmds[i].replace(/^\s+|\s+$/g, ''); + commander.validate(cmd.split(" ")); + } + } + else{ + commander.validate(cmd.split(" ")); + } } this.key_space = function()