Getting back to normality
This commit is contained in:
@@ -1,6 +1,38 @@
|
||||
function Command(content)
|
||||
{
|
||||
this.content = content;
|
||||
this.parts = content.split(" ");
|
||||
|
||||
this.module_name = null;
|
||||
this.method_name = null;
|
||||
this.setting_name = null;
|
||||
this.module = null;
|
||||
this.setthing = null;
|
||||
|
||||
this.module = function()
|
||||
{
|
||||
var module_name = null;
|
||||
if(content.indexOf(".") > -1){
|
||||
module_name = content.split(" ")[0].split(".")[0]
|
||||
}
|
||||
else if(content.indexOf(":") > -1){
|
||||
module_name = content.split(" ")[0].split(":")[0]
|
||||
}
|
||||
else{
|
||||
module_name = content.split(" ")[0];
|
||||
}
|
||||
return ronin.modules[module_name] ? ronin.modules[module_name] : null;
|
||||
}
|
||||
|
||||
this.method = function()
|
||||
{
|
||||
var module = this.module();
|
||||
if(!module){ return null; }
|
||||
|
||||
var method_name = content.indexOf(".") > -1 ? content.split(" ")[0].split(".")[1] : "default";
|
||||
return module.methods[method_name] ? module.methods[method_name] : null;
|
||||
}
|
||||
|
||||
|
||||
this.inject_position = function(injection)
|
||||
{
|
||||
@@ -12,80 +44,79 @@ function Command(content)
|
||||
|
||||
this.any = function()
|
||||
{
|
||||
if(this.content.join() === ""){ return null; }
|
||||
return new Any(this.content);
|
||||
}
|
||||
|
||||
this.rect = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("x") >= 0 && this.content[i].indexOf("/") < 0){ return new Rect(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("x") >= 0 && this.parts[i].indexOf("/") < 0){ return new Rect(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.position = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf(",") >= 0){ return new Position(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf(",") >= 0){ return new Position(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.color = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("#") >= 0){ return new Color(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("#") >= 0){ return new Color(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.filepath = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("/") >= 0){ return new Filepath(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("/") >= 0){ return new Filepath(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.value = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
var test = /[^$\-\d]/.test(this.content[i]);
|
||||
if(!test && this.content[i] !== ""){ return new Value(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
var test = /[^$\-\d]/.test(this.parts[i]);
|
||||
if(!test && this.parts[i] !== ""){ return new Value(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.range = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("..") >= 0){ return new Range(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("..") >= 0){ return new Range(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.bang = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("!") >= 0){ return new Bang(); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("!") >= 0){ return new Bang(); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.angle = function()
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("'") >= 0){ return new Angle(this.content[i]); }
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("'") >= 0){ return new Angle(this.parts[i]); }
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
this.setting = function(name)
|
||||
{
|
||||
for (i = 0; i < this.content.length; i++) {
|
||||
if(this.content[i].indexOf("=") >= 0){
|
||||
var parts = this.content[i].split("=");
|
||||
for (i = 0; i < this.parts.length; i++) {
|
||||
if(this.parts[i].indexOf("=") >= 0){
|
||||
var parts = this.parts[i].split("=");
|
||||
if(parts[0] == name){
|
||||
return new Setting(parts[0],parts[1]);
|
||||
}
|
||||
@@ -96,27 +127,8 @@ function Command(content)
|
||||
|
||||
this.text = function()
|
||||
{
|
||||
var content_str = this.content.join(" ");
|
||||
var content_str = this.parts.join(" ");
|
||||
if(content_str.indexOf("\"") < 0){ return null; }
|
||||
return content_str.split("\"")[1];
|
||||
}
|
||||
|
||||
this.methods = function()
|
||||
{
|
||||
var a = [];
|
||||
for(i in this.content){
|
||||
if(this.content[i].indexOf(":") > 0){
|
||||
a.push(this.content[i]);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
this.method = function(name)
|
||||
{
|
||||
for(i in this.methods()){
|
||||
var m = new Method(this.methods()[i]);
|
||||
if(m.name == name){ return m; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,6 @@ ronin.install();
|
||||
var target_file = window.location.hash ? window.location.hash : "default";
|
||||
target_file = target_file.substr(1,target_file.length-1);
|
||||
|
||||
// ronin.terminal.load(window.location.hash ? target_file+".rin" : "default.rin");
|
||||
ronin.widget.update();
|
||||
ronin.terminal.input.focus();
|
||||
ronin.start();
|
||||
|
||||
// ronin.terminal.load(window.location.hash ? target_file+".rin" : "default.rin");
|
||||
@@ -21,19 +21,19 @@ function Ronin()
|
||||
this.cursor = new Cursor(".");
|
||||
this.widget = new Widget("?");
|
||||
|
||||
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.frame.name] = this.frame;
|
||||
this.modules[this.type.name] = this.type;
|
||||
this.modules[this.path.name] = this.path;
|
||||
|
||||
this.modules[this.brush.constructor.name] = this.brush;
|
||||
this.modules[this.brush.name] = this.brush;
|
||||
|
||||
this.modules[this.source.constructor.name] = this.source;
|
||||
this.modules[this.render.constructor.name] = this.render;
|
||||
this.modules[this.source.name] = this.source;
|
||||
this.modules[this.render.name] = this.render;
|
||||
// this.modules[this.eye.constructor.name] = this.eye;
|
||||
// this.modules[this.magnet.constructor.name] = this.magnet;
|
||||
|
||||
this.modules[this.cursor.constructor.name] = this.cursor;
|
||||
this.modules[this.terminal.constructor.name] = this.terminal;
|
||||
this.modules[this.cursor.name] = this.cursor;
|
||||
this.modules[this.terminal.name] = this.terminal;
|
||||
|
||||
//
|
||||
|
||||
@@ -46,15 +46,23 @@ function Ronin()
|
||||
// this.terminal.install();
|
||||
this.widget.install();
|
||||
}
|
||||
|
||||
this.start = function()
|
||||
{
|
||||
ronin.terminal.update();
|
||||
ronin.widget.update();
|
||||
ronin.terminal.input.focus();
|
||||
}
|
||||
|
||||
this.cursors = [];
|
||||
|
||||
this.position_in_canvas = function(e)
|
||||
{
|
||||
var x = e.clientX;
|
||||
x -= (window.innerWidth - this.frame.settings["size"].width) * 0.4 - 25;
|
||||
x -= parseInt(0) + (this.frame.settings["size"].width/2);
|
||||
var y = e.clientY - 100;
|
||||
var y = e.clientY;
|
||||
// Canvas Size
|
||||
x += (-window.innerWidth/2) + (parseInt(this.frame.element.style.width)/2);
|
||||
y += (-window.innerHeight/2) + (parseInt(this.frame.element.style.height)/2);
|
||||
return new Position(x,y);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user