Improved Type

This commit is contained in:
Devine Lu Linvega
2017-03-28 13:56:00 -07:00
parent a8a23736bf
commit cc37e3ff98
27 changed files with 154 additions and 140 deletions

View File

@@ -94,6 +94,13 @@ function Command(content)
return null;
}
this.text = function()
{
var content_str = this.content.join(" ");
if(content_str.indexOf("\"") < 0){ return null; }
return content_str.split("\"")[1];
}
this.methods = function()
{
var a = [];

View File

@@ -1,6 +1,6 @@
var ronin = new Ronin();
ronin.element = document.getElementById('ronin');
ronin.surface.element = document.getElementById('surface');
ronin.frame.element = document.getElementById('frame');
ronin.cursor.element = document.getElementById('cursor');
ronin.terminal.element = document.getElementById('terminal');
ronin.cursor.mode = ronin.brush;
@@ -32,12 +32,12 @@ starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
ronin.terminal.query("~ "+ronin.timestamp());
ronin.terminal.query("surface.select main");
ronin.terminal.query("surface.resize "+starting_canvas.render());
ronin.terminal.query("frame.select main");
ronin.terminal.query("frame.resize "+starting_canvas.render());
// ronin.terminal.query("- color=#ff0000");
// ronin.terminal.query("# fill=#ff0000");
// ronin.terminal.query("~ Ready.");
ronin.terminal.input_element.focus();
ronin.terminal.update_hint();
ronin.surface.update_widget();
ronin.frame.update_widget();

View File

@@ -12,7 +12,7 @@ function Keyboard()
this.alt_held = true;
}
ronin.cursor.update(event);
ronin.surface.update_widget();
ronin.frame.update_widget();
ronin.terminal.update_hint();
}
@@ -45,7 +45,7 @@ function Keyboard()
// Passive
ronin.terminal.passive(ronin.terminal.input_element.value);
ronin.surface.update_widget();
ronin.frame.update_widget();
ronin.terminal.update_hint();
};

View File

@@ -5,14 +5,12 @@ function Ronin()
this.default = new Default("`");
this.surface = new Surface("@");
this.frame = new Frame("@");
this.path = new Path("+");
this.type = new Type("&");
this.brush = new Brush("-");
// this.fileload = new FileLoad("/");
// this.filesave = new FileSave("$");
this.source = new Source("$");
this.source = new Source("$");
this.eye = new Eye("*");
this.render = new Render("%");
@@ -22,14 +20,12 @@ function Ronin()
this.terminal = new Terminal(">");
this.cursor = new Cursor(".");
this.modules[this.surface.constructor.name] = this.surface;
this.modules[this.frame.constructor.name] = this.frame;
this.modules[this.type.constructor.name] = this.type;
this.modules[this.path.constructor.name] = this.path;
this.modules[this.brush.constructor.name] = this.brush;
// this.modules[this.fileload.constructor.name] = this.fileload;
// this.modules[this.filesave.constructor.name] = this.filesave;
this.modules[this.source.constructor.name] = this.source;
// this.modules[this.render.constructor.name] = this.render;
// this.modules[this.eye.constructor.name] = this.eye;
@@ -52,17 +48,17 @@ function Ronin()
this.position_in_canvas = function(e)
{
var x = e.clientX;
x -= (window.innerWidth - this.surface.settings["size"].width)/2;
x -= parseInt(this.surface.element.style.marginLeft) + (this.surface.settings["size"].width/2);
x -= (window.innerWidth - this.frame.settings["size"].width)/2;
x -= parseInt(this.frame.element.style.marginLeft) + (this.frame.settings["size"].width/2);
var y = e.clientY;
y -= (window.innerHeight - this.surface.settings["size"].height)/2;
y -= parseInt(this.surface.element.style.marginTop) + parseInt(this.surface.settings["size"].height/2);
y -= (window.innerHeight - this.frame.settings["size"].height)/2;
y -= parseInt(this.frame.element.style.marginTop) + parseInt(this.frame.settings["size"].height/2);
return new Position(x,y);
}
this.position_in_window = function(p)
{
return new Position(p.x + parseInt(this.surface.element.style.marginLeft),p.y + parseInt(this.surface.element.style.marginTop));
return new Position(p.x + parseInt(this.frame.element.style.marginLeft),p.y + parseInt(this.frame.element.style.marginTop));
}
this.timestamp = function()

View File

@@ -19,9 +19,9 @@ function Widget()
this.on_resize = function()
{
this.element.style.left = (window.innerWidth/2)-(ronin.surface.settings["size"].width/2);
this.element.style.top = (window.innerHeight/2)+(ronin.surface.settings["size"].height/2)+20;
this.element.style.width = ronin.surface.settings["size"].width+"px";
this.element.style.left = (window.innerWidth/2)-(ronin.frame.settings["size"].width/2);
this.element.style.top = (window.innerHeight/2)+(ronin.frame.settings["size"].height/2)+20;
this.element.style.width = ronin.frame.settings["size"].width+"px";
this.update();
}