From 5d8d7cadb51250914a62b540ad2119acda94277b Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 24 May 2017 20:16:13 -1000 Subject: [PATCH] Removed old render() --- presets/blank.rin | 6 +++++- presets/default.rin | 32 +++++++++++++++----------------- presets/logo_nataniev.rin | 8 ++++++++ presets/logo_neauoire.rin | 8 ++++++++ presets/logo_ronin.rin | 12 ++++++++++++ presets/neauoire.rin | 6 ++++++ scripts/modules/brush.js | 12 ++++++------ scripts/modules/brush.pointer.js | 2 +- scripts/modules/cursor.js | 6 +++--- scripts/modules/eye.js | 2 +- scripts/modules/frame.js | 8 ++++---- scripts/modules/layer.js | 10 ---------- scripts/modules/magnet.js | 13 +++++++------ scripts/modules/path.js | 16 ++++++++-------- scripts/modules/source.js | 2 +- scripts/modules/type.js | 6 +++--- scripts/units/angle.js | 2 +- scripts/units/any.js | 2 +- scripts/units/bang.js | 2 +- scripts/units/color.js | 2 +- scripts/units/filepath.js | 2 +- scripts/units/mode.js | 5 ----- scripts/units/position.js | 2 +- scripts/units/range.js | 2 +- scripts/units/rect.js | 2 +- scripts/units/setting.js | 2 +- scripts/units/value.js | 2 +- 27 files changed, 98 insertions(+), 76 deletions(-) create mode 100644 presets/logo_nataniev.rin create mode 100644 presets/logo_neauoire.rin create mode 100644 presets/logo_ronin.rin create mode 100644 presets/neauoire.rin diff --git a/presets/blank.rin b/presets/blank.rin index 22a6c07..23780dc 100644 --- a/presets/blank.rin +++ b/presets/blank.rin @@ -1,4 +1,8 @@ frame.resize 500x500 layer.fill #eeeeee brush:color #333333 -brush:size 3 \ No newline at end of file +brush:size 3 +frame.select main +brush.add 1,1 +brush.add 2,2 +brush.add 3,3 \ No newline at end of file diff --git a/presets/default.rin b/presets/default.rin index f3ba2f6..cec06be 100644 --- a/presets/default.rin +++ b/presets/default.rin @@ -1,19 +1,17 @@ -frame.resize 300x300 -frame.select background -layer.fill #eeeeee -frame.select stencil -render.stencil 45' #cccccc +frame.resize 300x320 +layer.fill #000000 +path:line_width 28 +path:line_cap butt +magnet.grid 15x15 4,4 frame.select logo -path:line_width 43 -path:line_color #000000 -path:line_cap square -path.stroke M105,240 a-45,-45 0 0,0 -45,-45 M150,240 a-90,-90 0 0,0 -90,-90 M150,60 a90,90 0 0,0 90,90 M195,60 a45,45 0 0,0 45,45 M60,105 a45,-45 0 0,0 45,-45 M240,195 a-45,45 0 0,0 -45,45 -type:size 10 -type:color #000000 -type.write 38,262 "RONIN" +path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M90,240 l0,-60 a30,-30 0 0,1 30,-30 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 +path.stroke M45,60 l15,0 M45,90 l15,0 M210,45 l0,15 M240,45 l0,15 M255,210 l-15,0 M255,240 l-15,0 M90,255 l0,-15 M60,255 l0,-15 +path:line_cap round +path.stroke M120,60 a60,60 0 0,1 60,60 M240,120 a-60,60 0 0,1 -60,60 M180,240 a-60,-60 0 0,1 -60,-60 M60,180 a60,-60 0 0,1 60,-60 +path.stroke M120,90 a30,30 0 0,1 30,30 M210,120 a-30,30 0 0,1 -30,30 M180,210 a-30,-30 0 0,1 -30,-30 M90,180 a30,-30 0 0,1 30,-30 +magnet.grid 1x1 4,4 +type:size 11 type:font "DIN Medium" -type.write 38,252 "B09" -brush:color #ff0000 -brush:size 5 -path:line_width 20 -path:line_color #999999 \ No newline at end of file +type.write 45,280 "RONIN" +type:font "DIN" +type.write 85,280 "09" \ No newline at end of file diff --git a/presets/logo_nataniev.rin b/presets/logo_nataniev.rin new file mode 100644 index 0000000..9c123d9 --- /dev/null +++ b/presets/logo_nataniev.rin @@ -0,0 +1,8 @@ +frame.resize 300x300 +layer.fill #ff0000 +path:line_width 28 +path:line_cap round +magnet.grid 30x30 2,2 +frame.select logo +path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 M90,240 l0,-60 a30,-30 0 0,1 30,-30 +magnet.grid 1x1 2,2 \ No newline at end of file diff --git a/presets/logo_neauoire.rin b/presets/logo_neauoire.rin new file mode 100644 index 0000000..fcf991b --- /dev/null +++ b/presets/logo_neauoire.rin @@ -0,0 +1,8 @@ +frame.resize 300x300 +layer.fill #ff0000 +path:line_width 28 +path:line_cap round +magnet.grid 30x30 2,2 +frame.select logo +path.stroke M120,60 a0,90 0 0,0 0,90 a30,30 0 0,0 30,30 M90,60 l0,90 a60,60 0 0,0 60,60 M60,60 l0,90 a90,90 0 0,0 90,90 M180,240 l0,-90 a-30,-30 0 0,0 -30,-30 M210,240 l0,-90 a-60,-60 0 0,0 -60,-60 M240,240 l0,-90 a-90,-90 0 0,0 -90,-90 +magnet.grid 1x1 2,2 \ No newline at end of file diff --git a/presets/logo_ronin.rin b/presets/logo_ronin.rin new file mode 100644 index 0000000..60d05fe --- /dev/null +++ b/presets/logo_ronin.rin @@ -0,0 +1,12 @@ +frame.resize 300x300 +layer.fill #ff0000 +path:line_width 28 +path:line_cap butt +magnet.grid 15x15 4,4 +frame.select logo +path.stroke M60,60 l60,0 a60,60 0 0,1 60,60 M240,60 l0,60 a-60,60 0 0,1 -60,60 M240,240 l-60,0 a-60,-60 0 0,1 -60,-60 M60,240 l0,-60 a60,-60 0 0,1 60,-60 M90,240 l0,-60 a30,-30 0 0,1 30,-30 M60,90 l60,0 a30,30 0 0,1 30,30 M210,60 l0,60 a-30,30 0 0,1 -30,30 M240,210 l-60,0 a-30,-30 0 0,1 -30,-30 +path.stroke M45,60 l15,0 M45,90 l15,0 M210,45 l0,15 M240,45 l0,15 M255,210 l-15,0 M255,240 l-15,0 M90,255 l0,-15 M60,255 l0,-15 +path:line_cap round +path.stroke M120,60 a60,60 0 0,1 60,60 M240,120 a-60,60 0 0,1 -60,60 M180,240 a-60,-60 0 0,1 -60,-60 M60,180 a60,-60 0 0,1 60,-60 +path.stroke M120,90 a30,30 0 0,1 30,30 M210,120 a-30,30 0 0,1 -30,30 M180,210 a-30,-30 0 0,1 -30,-30 M90,180 a30,-30 0 0,1 30,-30 +magnet.grid 1x1 4,4 \ No newline at end of file diff --git a/presets/neauoire.rin b/presets/neauoire.rin new file mode 100644 index 0000000..fce27df --- /dev/null +++ b/presets/neauoire.rin @@ -0,0 +1,6 @@ +frame.resize 300x300 +layer.fill #72dec2 +path:line_width 28 +path:line_cap round +magnet.grid 15x15 4,4 +frame.select logo \ No newline at end of file diff --git a/scripts/modules/brush.js b/scripts/modules/brush.js index 0b1d8ec..97f92b7 100644 --- a/scripts/modules/brush.js +++ b/scripts/modules/brush.js @@ -5,13 +5,13 @@ function Brush(rune) this.pointers = [new Pointer(new Position("0,0"))]; this.add_mode(new Mode("paint")); - this.add_mode(new Mode("erase","alt")); - this.add_setting(new Setting("color","#00ff00")); + this.add_mode(new Mode("erase","shift")); + this.add_setting(new Setting("color","#000000")); this.add_setting(new Setting("size","2")); - this.add_method(new Method("add_pointer",["Position","Color","Scale","mirror_x","mirror_y"])); + this.add_method(new Method("add",["Position","Color","Scale","mirror_x","mirror_y"])); this.add_method(new Method("clear")); - this.add_pointer = function(cmd, preview = false) + this.add = function(cmd, preview = false) { if(cmd.option("mirror_x")){ var mirror_x = parseFloat(cmd.option("mirror_x").value); @@ -36,12 +36,12 @@ function Brush(rune) this.pointers.push(pointer); - ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.render())); + ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.toString())); return 1, "ok"; } - this.clear = function() + this.remove = function() { this.pointers = []; return 1,"Removed all pointers."; diff --git a/scripts/modules/brush.pointer.js b/scripts/modules/brush.pointer.js index 4972621..9edb7a1 100644 --- a/scripts/modules/brush.pointer.js +++ b/scripts/modules/brush.pointer.js @@ -141,6 +141,6 @@ function Pointer(offset = new Position(), color = null, scale = 1) this.widget = function() { - return this.offset.render(); + return this.offset.toString(); } } \ No newline at end of file diff --git a/scripts/modules/cursor.js b/scripts/modules/cursor.js index e62b332..d651c4e 100644 --- a/scripts/modules/cursor.js +++ b/scripts/modules/cursor.js @@ -18,12 +18,12 @@ function Cursor(rune) if(this.is_inside){ this.set_mode(ronin.default) } - else if(keyboard.shift_held,keyboard.alt_held){ - this.set_mode(ronin.frame.active_layer); - } else if(ronin.terminal.cmd().module()){ this.set_mode(ronin.terminal.cmd().module()); } + else if(keyboard.shift_held,keyboard.alt_held){ + this.set_mode(ronin.frame.active_layer); + } else if(event && event.altKey == true){ this.set_mode(ronin.default); } diff --git a/scripts/modules/eye.js b/scripts/modules/eye.js index 36f8594..d7dbf1d 100644 --- a/scripts/modules/eye.js +++ b/scripts/modules/eye.js @@ -9,7 +9,7 @@ function Eye(rune) { var pixel = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data; var hex = new Color().rgb_to_hex({r:pixel[0],g:pixel[1],b:pixel[2]}); - ronin.terminal.log(new Log(this,"Color at "+position.render()+" is "+hex)); + ronin.terminal.log(new Log(this,"Color at "+position.toString()+" is "+hex)); } // Mouse diff --git a/scripts/modules/frame.js b/scripts/modules/frame.js index e080b34..3b9fcfa 100644 --- a/scripts/modules/frame.js +++ b/scripts/modules/frame.js @@ -57,7 +57,7 @@ function Frame(rune) this.size = rect; - return 1, "Resized to "+this.size.render(); + return 1, "Resized to "+this.size.toString(); } this.select = function(cmd, preview = false) @@ -149,9 +149,9 @@ function Frame(rune) this.mouse_up = function(position,rect) { - ronin.overlay.draw(this.mouse_from,rect)+" "+rect.render(); + ronin.overlay.draw(this.mouse_from,rect)+" "+rect.toString(); - var line = "frame.resize "+this.mouse_from.render()+" "+rect.render(); + var line = "frame.resize "+this.mouse_from.toString()+" "+rect.toString(); ronin.terminal.update(line); } @@ -159,7 +159,7 @@ function Frame(rune) { var html = "" - html += this.size.render()+" "; + html += this.size.toString()+" "; html += this.active_layer.name+" "; var user_layers = 0; diff --git a/scripts/modules/layer.js b/scripts/modules/layer.js index ecd519f..df74096 100644 --- a/scripts/modules/layer.js +++ b/scripts/modules/layer.js @@ -84,16 +84,6 @@ function Layer(name,manager = null) return 1, "ok"; } - this.rename = function(params, preview = false) - { - if(preview){ return; } - - // TODO - // ronin.frame.layers[params.text()] = this; - // ronin.frame.layers[this.name] = null; - ronin.terminal.log(new Log(this,"Renamed layer "+this.name+" to "+params.text())); - } - this.clear = function(params, preview = false) { if(preview){ return; } diff --git a/scripts/modules/magnet.js b/scripts/modules/magnet.js index 96a3298..88439a4 100644 --- a/scripts/modules/magnet.js +++ b/scripts/modules/magnet.js @@ -4,6 +4,7 @@ function Magnet(rune) this.add_setting(new Setting("grid","1x1")); this.add_setting(new Setting("marker","4,4")); + this.add_setting(new Setting("color","#000000")); this.add_method(new Method("grid",["rect","position"])); @@ -17,8 +18,8 @@ function Magnet(rune) this.draw_grid(cmd.rect(),cmd.position()); if(preview == false){ - this.settings["grid"].update(cmd.rect().render()); - this.settings["marker"].update(cmd.position().render()); + if(cmd.rect()){ this.settings["grid"].update(cmd.rect().toString());} + if(cmd.position()){ this.settings["marker"].update(cmd.position().toString());} } return 1, preview ? "preview" : "ok"; @@ -29,8 +30,8 @@ function Magnet(rune) if(!rect){ rect = new Rect("20x20"); } if(!grid){ grid = new Position("4,4"); } - this.settings["grid"].update(rect.render()); - this.settings["marker"].update(grid.render()); + this.settings["grid"].update(rect.toString()); + this.settings["marker"].update(grid.toString()); if(rect.width < 5 || rect.height < 5){ return; } @@ -54,7 +55,7 @@ function Magnet(rune) var magnetized = this.magnetic_position(position); this.context().beginPath(); this.context().arc(magnetized.x, magnetized.y, 4, 0, 2 * Math.PI, false); - this.context().strokeStyle = 'white'; + this.context().strokeStyle = this.settings["color"].value; this.context().stroke(); this.context().closePath(); } @@ -63,7 +64,7 @@ function Magnet(rune) { this.context().beginPath(); this.context().arc(position.x, position.y, size, 0, 2 * Math.PI, false); - this.context().fillStyle = 'white'; + this.context().fillStyle = this.settings["color"].value; this.context().fill(); this.context().closePath(); } diff --git a/scripts/modules/path.js b/scripts/modules/path.js index 6e82b9a..9003b21 100644 --- a/scripts/modules/path.js +++ b/scripts/modules/path.js @@ -9,7 +9,7 @@ function Path(rune) this.add_setting(new Setting("fill_color","#ff0000")); this.add_setting(new Setting("line_width","3")); - this.add_setting(new Setting("line_color","#999")); + this.add_setting(new Setting("line_color","#ffffff")); this.add_setting(new Setting("line_cap","square")); this.add_method(new Method("stroke",["Positions"],"Add point")); @@ -106,7 +106,7 @@ function Path(rune) { var method = ronin.terminal.cmd().method() ? ronin.terminal.cmd().method().name : "stroke"; var line = "path."+method+" "+this.create_path(); - line += "M"+position.render(); + line += "M"+position.toString(); ronin.terminal.update(line); } @@ -114,7 +114,7 @@ function Path(rune) { var method = ronin.terminal.cmd().method().name; var line = "path."+method+" "+this.create_path(); - line += "L"+position.render(); + line += "L"+position.toString(); ronin.terminal.update(line); } @@ -123,22 +123,22 @@ function Path(rune) var method = ronin.terminal.cmd().method().name; if(this.coordinates.length == 0){ - this.coordinates.push("M"+position.render()); + this.coordinates.push("M"+position.toString()); } else{ var offset = this.last_pos ? position.offset(this.last_pos) : position; if(keyboard.shift_held == true && keyboard.alt_held == true){ - this.coordinates.push("M"+position.render()); + this.coordinates.push("M"+position.toString()); } else if(keyboard.shift_held == true){ - this.coordinates.push("a"+offset.render()+" 0 0,1 "+offset.render()); + this.coordinates.push("a"+offset.toString()+" 0 0,1 "+offset.toString()); } else if(keyboard.alt_held == true){ - this.coordinates.push("a"+offset.render()+" 0 0,0 "+offset.render()); + this.coordinates.push("a"+offset.toString()+" 0 0,0 "+offset.toString()); } else{ - this.coordinates.push("l"+offset.render()); + this.coordinates.push("l"+offset.toString()); } } diff --git a/scripts/modules/source.js b/scripts/modules/source.js index a6404c4..944802f 100644 --- a/scripts/modules/source.js +++ b/scripts/modules/source.js @@ -56,7 +56,7 @@ function Source(rune) ronin.source.unlock(); } - return 1,"Loaded "+params.filepath().path+" at "+position.render(); + return 1,"Loaded "+params.filepath().path+" at "+position.toString(); } this.save = function(params,preview = false) diff --git a/scripts/modules/type.js b/scripts/modules/type.js index b4098da..efb8227 100644 --- a/scripts/modules/type.js +++ b/scripts/modules/type.js @@ -27,7 +27,7 @@ function Type(rune) if(!preview){ this.layer.remove(this); } - return 1, "Wrote "+text+" at "+position.render(); + return 1, "Wrote "+text+" at "+position.toString(); } // Mouse @@ -40,7 +40,7 @@ function Type(rune) this.mouse_down = function(position) { var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder"; - var line = "type.write "+position.render()+" \""+str+"\""; + var line = "type.write "+position.toString()+" \""+str+"\""; ronin.terminal.update(line); } @@ -51,7 +51,7 @@ function Type(rune) this.mouse_up = function(position) { var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder"; - var line = "type.write "+position.render()+" \""+str+"\""; + var line = "type.write "+position.toString()+" \""+str+"\""; ronin.terminal.update(line); } diff --git a/scripts/units/angle.js b/scripts/units/angle.js index 578e258..f395c79 100644 --- a/scripts/units/angle.js +++ b/scripts/units/angle.js @@ -6,7 +6,7 @@ function Angle(angle_str = "0'") this.degrees = parseFloat(angle_str.replace('\'','')); - this.render = function() + this.toString = function() { return this.degrees+"'"; } diff --git a/scripts/units/any.js b/scripts/units/any.js index 3e2428f..3311a2d 100644 --- a/scripts/units/any.js +++ b/scripts/units/any.js @@ -5,7 +5,7 @@ function Any(str) this.example = ""; this.string = str; - this.render = function() + this.toString = function() { return this.string; } diff --git a/scripts/units/bang.js b/scripts/units/bang.js index 127a44e..38587da 100644 --- a/scripts/units/bang.js +++ b/scripts/units/bang.js @@ -4,7 +4,7 @@ function Bang() this.example = ""; - this.render = function() + this.toString = function() { return "BANG"; } diff --git a/scripts/units/color.js b/scripts/units/color.js index 042b351..67cd505 100644 --- a/scripts/units/color.js +++ b/scripts/units/color.js @@ -26,7 +26,7 @@ function Color(hex = '#000000') return { r:rgb.r/255, g:rgb.g/255, b:rgb.b/255 } } - this.render = function() + this.toString = function() { return this.hex; } diff --git a/scripts/units/filepath.js b/scripts/units/filepath.js index d856346..636fb68 100644 --- a/scripts/units/filepath.js +++ b/scripts/units/filepath.js @@ -5,7 +5,7 @@ function Filepath(path_str) this.example = "assets/demo.png"; this.path = path_str; - this.render = function() + this.toString = function() { return this.path; } diff --git a/scripts/units/mode.js b/scripts/units/mode.js index 83a1d95..a2821c8 100644 --- a/scripts/units/mode.js +++ b/scripts/units/mode.js @@ -6,11 +6,6 @@ function Mode(name,key = "") this.name = name; this.key = key; - this.render = function() - { - return "?"; - } - this.toString = function() { return "~"+this.name+(this.key ? '['+this.key+']' : '')+"" diff --git a/scripts/units/position.js b/scripts/units/position.js index d9a63ba..d250b15 100644 --- a/scripts/units/position.js +++ b/scripts/units/position.js @@ -40,7 +40,7 @@ function Position(position_str = "0,0",y = null) } } - this.render = function() + this.toString = function() { return (isNaN(this.x) ? 0 : this.x)+","+(isNaN(this.y) ? 0 : this.y); } diff --git a/scripts/units/range.js b/scripts/units/range.js index 3dc3d38..ad94ac3 100644 --- a/scripts/units/range.js +++ b/scripts/units/range.js @@ -8,7 +8,7 @@ function Range(range_str) this.from = parseFloat(this.range_str.split("..")[0]); this.to = parseFloat(this.range_str.split("..")[1]); - this.render = function() + this.toString = function() { return this.from+".."+this.to; } diff --git a/scripts/units/rect.js b/scripts/units/rect.js index 212eb3c..de5d7cb 100644 --- a/scripts/units/rect.js +++ b/scripts/units/rect.js @@ -9,7 +9,7 @@ function Rect(rect_str) this.example = "200x300"; - this.render = function() + this.toString = function() { return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height); } diff --git a/scripts/units/setting.js b/scripts/units/setting.js index 5545596..891d1d3 100644 --- a/scripts/units/setting.js +++ b/scripts/units/setting.js @@ -6,7 +6,7 @@ function Setting(name,value) this.name = name; this.value = value; - this.render = function() + this.toString = function() { return "?"; } diff --git a/scripts/units/value.js b/scripts/units/value.js index 3bb7e26..79c9724 100644 --- a/scripts/units/value.js +++ b/scripts/units/value.js @@ -7,7 +7,7 @@ function Value(value_str) this.float = parseFloat(this.value); this.int = parseInt(this.value); - this.render = function() + this.toString = function() { return this.value; }