diff --git a/sources/media/graphics/grid.svg b/sources/media/graphics/grid.svg deleted file mode 100644 index 0a59b28..0000000 --- a/sources/media/graphics/grid.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/sources/media/graphics/void.svg b/sources/media/graphics/void.svg deleted file mode 100644 index c07e17f..0000000 --- a/sources/media/graphics/void.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/sources/scripts/commander.js b/sources/scripts/commander.js index 92656f2..2068fd8 100644 --- a/sources/scripts/commander.js +++ b/sources/scripts/commander.js @@ -16,7 +16,7 @@ function Commander() { var q = new Query(query_str); - if(!ronin.modules[q.module]){ console.log("Unknown module",q); return; } + if(!ronin.modules[q.module]){ console.log("Unknown module",q.module); return; } // Update settings for(setting_id in q.settings){ @@ -28,8 +28,8 @@ function Commander() // Run methods for(method_id in q.methods){ var method_param = q.methods[method_id]; - if(!ronin.modules[q.module][method_id]){ console.log("Missing method",method_id); return; } - ronin.modules[q.module][method_id].run(method_param); + if(!ronin.modules[q.module].methods[method_id]){ console.log("Missing method",method_id); return; } + ronin.modules[q.module].methods[method_id](method_param); } ronin.modules[q.module].routes = q.routes; diff --git a/sources/scripts/grid.js b/sources/scripts/grid.js index 419e8ca..d1f06f6 100644 --- a/sources/scripts/grid.js +++ b/sources/scripts/grid.js @@ -52,6 +52,8 @@ function Grid() this.el.height = size.height * 2; this.el.style.width = size.width+"px"; this.el.style.height = size.height+"px"; + + this.draw(); } this.clear = function() diff --git a/sources/scripts/io.js b/sources/scripts/io.js index d9b4330..41af878 100644 --- a/sources/scripts/io.js +++ b/sources/scripts/io.js @@ -26,7 +26,7 @@ function IO() var width = base_image.naturalWidth; var height = base_image.naturalHeight; - ronin.resize_to({width:width * 0.5,height:height * 0.5}); + ronin.frame.resize_to({width:width * 0.5,height:height * 0.5}); ronin.render.context().drawImage(base_image, 0,0,width,height); } reader.readAsDataURL(file); diff --git a/sources/scripts/module.js b/sources/scripts/module.js index 48c0e83..0f1bb31 100644 --- a/sources/scripts/module.js +++ b/sources/scripts/module.js @@ -1,6 +1,7 @@ function Module(name) { this.name = name; + this.methods = {}; this.settings = {}; this.routes = {}; this.ports = {}; @@ -19,8 +20,6 @@ function Module(name) html += route_val+"->"+route_id+" "; } - console.log(this.name,this.settings); - return html.trim() != "" ? ""+this.name+" "+html.trim() : ""; } } \ No newline at end of file diff --git a/sources/scripts/modules/brush.js b/sources/scripts/modules/brush.js index fd94ac0..3a9f11b 100644 --- a/sources/scripts/modules/brush.js +++ b/sources/scripts/modules/brush.js @@ -6,10 +6,10 @@ function Brush() this.pointers = [ new Pointer({offset:{x:0,y:0}}), - new Pointer({offset:{x:1,y:0}}), - new Pointer({offset:{x:-1,y:0}}), - new Pointer({offset:{x:0,y:1}}), - new Pointer({offset:{x:0,y:-1}}), + // new Pointer({offset:{x:1,y:0}}), + // new Pointer({offset:{x:-1,y:0}}), + // new Pointer({offset:{x:0,y:1}}), + // new Pointer({offset:{x:0,y:-1}}), ]; this.ports.speed = 0; diff --git a/sources/scripts/modules/frame.js b/sources/scripts/modules/frame.js index 214dc9f..e1a9772 100644 --- a/sources/scripts/modules/frame.js +++ b/sources/scripts/modules/frame.js @@ -3,4 +3,30 @@ function Frame() Module.call(this,"frame"); this.settings = {width:200,height:200}; + + this.methods = {}; + + this.methods.resize = function(q) + { + if(q.indexOf("x") == -1){ return; } + + var size = {width:parseInt(q.split("x")[0]),height:parseInt(q.split("x")[1])}; + ronin.frame.resize(size); + } + + this.methods.rescale = function(p) + { + } + + this.resize_to = function(size) + { + ronin.frame.settings.width = size.width; + ronin.frame.settings.height = size.height; + + const {dialog,app} = require('electron').remote; + var win = require('electron').remote.getCurrentWindow(); + win.setSize(size.width,size.height); + ronin.render.resize_to(size); + ronin.grid.resize_to(size); + } } \ No newline at end of file diff --git a/sources/scripts/modules/rescale.js b/sources/scripts/modules/rescale.js deleted file mode 100644 index aa35d95..0000000 --- a/sources/scripts/modules/rescale.js +++ /dev/null @@ -1,7 +0,0 @@ -function Rescale() -{ - this.run = function(q) - { - console.log(q); - } -} \ No newline at end of file diff --git a/sources/scripts/ronin.js b/sources/scripts/ronin.js index a988253..c80a66d 100644 --- a/sources/scripts/ronin.js +++ b/sources/scripts/ronin.js @@ -47,12 +47,4 @@ function Ronin() this.render.update(); this.grid.update(); } - - this.resize_to = function(size) - { - const {dialog,app} = require('electron').remote; - var win = require('electron').remote.getCurrentWindow(); - win.setSize(size.width,size.height); - this.render.resize_to(size); - } } \ No newline at end of file