Removed old render()

This commit is contained in:
Devine Lu Linvega 2017-05-24 20:16:13 -10:00
parent b59abbd3bc
commit 5d8d7cadb5
27 changed files with 98 additions and 76 deletions

View File

@ -1,4 +1,8 @@
frame.resize 500x500 frame.resize 500x500
layer.fill #eeeeee layer.fill #eeeeee
brush:color #333333 brush:color #333333
brush:size 3 brush:size 3
frame.select main
brush.add 1,1
brush.add 2,2
brush.add 3,3

View File

@ -1,19 +1,17 @@
frame.resize 300x300 frame.resize 300x320
frame.select background layer.fill #000000
layer.fill #eeeeee path:line_width 28
frame.select stencil path:line_cap butt
render.stencil 45' #cccccc magnet.grid 15x15 4,4
frame.select logo frame.select logo
path:line_width 43 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:line_color #000000 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 square path:line_cap round
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 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
type:size 10 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
type:color #000000 magnet.grid 1x1 4,4
type.write 38,262 "RONIN" type:size 11
type:font "DIN Medium" type:font "DIN Medium"
type.write 38,252 "B09" type.write 45,280 "RONIN"
brush:color #ff0000 type:font "DIN"
brush:size 5 type.write 85,280 "09"
path:line_width 20
path:line_color #999999

View File

@ -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

View File

@ -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

12
presets/logo_ronin.rin Normal file
View File

@ -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

6
presets/neauoire.rin Normal file
View File

@ -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

View File

@ -5,13 +5,13 @@ function Brush(rune)
this.pointers = [new Pointer(new Position("0,0"))]; this.pointers = [new Pointer(new Position("0,0"))];
this.add_mode(new Mode("paint")); this.add_mode(new Mode("paint"));
this.add_mode(new Mode("erase","alt")); this.add_mode(new Mode("erase","shift"));
this.add_setting(new Setting("color","#00ff00")); this.add_setting(new Setting("color","#000000"));
this.add_setting(new Setting("size","2")); 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_method(new Method("clear"));
this.add_pointer = function(cmd, preview = false) this.add = function(cmd, preview = false)
{ {
if(cmd.option("mirror_x")){ if(cmd.option("mirror_x")){
var mirror_x = parseFloat(cmd.option("mirror_x").value); var mirror_x = parseFloat(cmd.option("mirror_x").value);
@ -36,12 +36,12 @@ function Brush(rune)
this.pointers.push(pointer); 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"; return 1, "ok";
} }
this.clear = function() this.remove = function()
{ {
this.pointers = []; this.pointers = [];
return 1,"Removed all pointers."; return 1,"Removed all pointers.";

View File

@ -141,6 +141,6 @@ function Pointer(offset = new Position(), color = null, scale = 1)
this.widget = function() this.widget = function()
{ {
return this.offset.render(); return this.offset.toString();
} }
} }

View File

@ -18,12 +18,12 @@ function Cursor(rune)
if(this.is_inside){ if(this.is_inside){
this.set_mode(ronin.default) 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()){ else if(ronin.terminal.cmd().module()){
this.set_mode(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){ else if(event && event.altKey == true){
this.set_mode(ronin.default); this.set_mode(ronin.default);
} }

View File

@ -9,7 +9,7 @@ function Eye(rune)
{ {
var pixel = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data; 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]}); 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 // Mouse

View File

@ -57,7 +57,7 @@ function Frame(rune)
this.size = rect; this.size = rect;
return 1, "Resized to "+this.size.render(); return 1, "Resized to "+this.size.toString();
} }
this.select = function(cmd, preview = false) this.select = function(cmd, preview = false)
@ -149,9 +149,9 @@ function Frame(rune)
this.mouse_up = function(position,rect) 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); ronin.terminal.update(line);
} }
@ -159,7 +159,7 @@ function Frame(rune)
{ {
var html = "" var html = ""
html += this.size.render()+" "; html += this.size.toString()+" ";
html += this.active_layer.name+" "; html += this.active_layer.name+" ";
var user_layers = 0; var user_layers = 0;

View File

@ -84,16 +84,6 @@ function Layer(name,manager = null)
return 1, "ok"; 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) this.clear = function(params, preview = false)
{ {
if(preview){ return; } if(preview){ return; }

View File

@ -4,6 +4,7 @@ function Magnet(rune)
this.add_setting(new Setting("grid","1x1")); this.add_setting(new Setting("grid","1x1"));
this.add_setting(new Setting("marker","4,4")); this.add_setting(new Setting("marker","4,4"));
this.add_setting(new Setting("color","#000000"));
this.add_method(new Method("grid",["rect","position"])); this.add_method(new Method("grid",["rect","position"]));
@ -17,8 +18,8 @@ function Magnet(rune)
this.draw_grid(cmd.rect(),cmd.position()); this.draw_grid(cmd.rect(),cmd.position());
if(preview == false){ if(preview == false){
this.settings["grid"].update(cmd.rect().render()); if(cmd.rect()){ this.settings["grid"].update(cmd.rect().toString());}
this.settings["marker"].update(cmd.position().render()); if(cmd.position()){ this.settings["marker"].update(cmd.position().toString());}
} }
return 1, preview ? "preview" : "ok"; return 1, preview ? "preview" : "ok";
@ -29,8 +30,8 @@ function Magnet(rune)
if(!rect){ rect = new Rect("20x20"); } if(!rect){ rect = new Rect("20x20"); }
if(!grid){ grid = new Position("4,4"); } if(!grid){ grid = new Position("4,4"); }
this.settings["grid"].update(rect.render()); this.settings["grid"].update(rect.toString());
this.settings["marker"].update(grid.render()); this.settings["marker"].update(grid.toString());
if(rect.width < 5 || rect.height < 5){ return; } if(rect.width < 5 || rect.height < 5){ return; }
@ -54,7 +55,7 @@ function Magnet(rune)
var magnetized = this.magnetic_position(position); var magnetized = this.magnetic_position(position);
this.context().beginPath(); this.context().beginPath();
this.context().arc(magnetized.x, magnetized.y, 4, 0, 2 * Math.PI, false); 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().stroke();
this.context().closePath(); this.context().closePath();
} }
@ -63,7 +64,7 @@ function Magnet(rune)
{ {
this.context().beginPath(); this.context().beginPath();
this.context().arc(position.x, position.y, size, 0, 2 * Math.PI, false); 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().fill();
this.context().closePath(); this.context().closePath();
} }

View File

@ -9,7 +9,7 @@ function Path(rune)
this.add_setting(new Setting("fill_color","#ff0000")); this.add_setting(new Setting("fill_color","#ff0000"));
this.add_setting(new Setting("line_width","3")); 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_setting(new Setting("line_cap","square"));
this.add_method(new Method("stroke",["Positions"],"Add point")); 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 method = ronin.terminal.cmd().method() ? ronin.terminal.cmd().method().name : "stroke";
var line = "path."+method+" "+this.create_path(); var line = "path."+method+" "+this.create_path();
line += "M"+position.render(); line += "M"+position.toString();
ronin.terminal.update(line); ronin.terminal.update(line);
} }
@ -114,7 +114,7 @@ function Path(rune)
{ {
var method = ronin.terminal.cmd().method().name; var method = ronin.terminal.cmd().method().name;
var line = "path."+method+" "+this.create_path(); var line = "path."+method+" "+this.create_path();
line += "L"+position.render(); line += "L"+position.toString();
ronin.terminal.update(line); ronin.terminal.update(line);
} }
@ -123,22 +123,22 @@ function Path(rune)
var method = ronin.terminal.cmd().method().name; var method = ronin.terminal.cmd().method().name;
if(this.coordinates.length == 0){ if(this.coordinates.length == 0){
this.coordinates.push("M"+position.render()); this.coordinates.push("M"+position.toString());
} }
else{ else{
var offset = this.last_pos ? position.offset(this.last_pos) : position; var offset = this.last_pos ? position.offset(this.last_pos) : position;
if(keyboard.shift_held == true && keyboard.alt_held == true){ 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){ 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){ 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{ else{
this.coordinates.push("l"+offset.render()); this.coordinates.push("l"+offset.toString());
} }
} }

View File

@ -56,7 +56,7 @@ function Source(rune)
ronin.source.unlock(); 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) this.save = function(params,preview = false)

View File

@ -27,7 +27,7 @@ function Type(rune)
if(!preview){ this.layer.remove(this); } if(!preview){ this.layer.remove(this); }
return 1, "Wrote "+text+" at "+position.render(); return 1, "Wrote "+text+" at "+position.toString();
} }
// Mouse // Mouse
@ -40,7 +40,7 @@ function Type(rune)
this.mouse_down = function(position) this.mouse_down = function(position)
{ {
var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder"; 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); ronin.terminal.update(line);
} }
@ -51,7 +51,7 @@ function Type(rune)
this.mouse_up = function(position) this.mouse_up = function(position)
{ {
var str = ronin.terminal.cmd().text() ? ronin.terminal.cmd().text() : "Placeholder"; 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); ronin.terminal.update(line);
} }

View File

@ -6,7 +6,7 @@ function Angle(angle_str = "0'")
this.degrees = parseFloat(angle_str.replace('\'','')); this.degrees = parseFloat(angle_str.replace('\'',''));
this.render = function() this.toString = function()
{ {
return this.degrees+"'"; return this.degrees+"'";
} }

View File

@ -5,7 +5,7 @@ function Any(str)
this.example = ""; this.example = "";
this.string = str; this.string = str;
this.render = function() this.toString = function()
{ {
return this.string; return this.string;
} }

View File

@ -4,7 +4,7 @@ function Bang()
this.example = ""; this.example = "";
this.render = function() this.toString = function()
{ {
return "BANG"; return "BANG";
} }

View File

@ -26,7 +26,7 @@ function Color(hex = '#000000')
return { r:rgb.r/255, g:rgb.g/255, b:rgb.b/255 } return { r:rgb.r/255, g:rgb.g/255, b:rgb.b/255 }
} }
this.render = function() this.toString = function()
{ {
return this.hex; return this.hex;
} }

View File

@ -5,7 +5,7 @@ function Filepath(path_str)
this.example = "assets/demo.png"; this.example = "assets/demo.png";
this.path = path_str; this.path = path_str;
this.render = function() this.toString = function()
{ {
return this.path; return this.path;
} }

View File

@ -6,11 +6,6 @@ function Mode(name,key = "")
this.name = name; this.name = name;
this.key = key; this.key = key;
this.render = function()
{
return "?";
}
this.toString = function() this.toString = function()
{ {
return "<span class='mode'>~"+this.name+(this.key ? '['+this.key+']' : '')+"</span>" return "<span class='mode'>~"+this.name+(this.key ? '['+this.key+']' : '')+"</span>"

View File

@ -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); return (isNaN(this.x) ? 0 : this.x)+","+(isNaN(this.y) ? 0 : this.y);
} }

View File

@ -8,7 +8,7 @@ function Range(range_str)
this.from = parseFloat(this.range_str.split("..")[0]); this.from = parseFloat(this.range_str.split("..")[0]);
this.to = parseFloat(this.range_str.split("..")[1]); this.to = parseFloat(this.range_str.split("..")[1]);
this.render = function() this.toString = function()
{ {
return this.from+".."+this.to; return this.from+".."+this.to;
} }

View File

@ -9,7 +9,7 @@ function Rect(rect_str)
this.example = "200x300"; this.example = "200x300";
this.render = function() this.toString = function()
{ {
return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height); return (isNaN(this.width) ? 0 : this.width)+"x"+(isNaN(this.height) ? 0 : this.height);
} }

View File

@ -6,7 +6,7 @@ function Setting(name,value)
this.name = name; this.name = name;
this.value = value; this.value = value;
this.render = function() this.toString = function()
{ {
return "?"; return "?";
} }

View File

@ -7,7 +7,7 @@ function Value(value_str)
this.float = parseFloat(this.value); this.float = parseFloat(this.value);
this.int = parseInt(this.value); this.int = parseInt(this.value);
this.render = function() this.toString = function()
{ {
return this.value; return this.value;
} }