Replacing commander with Terminal

This commit is contained in:
Devine Lu Linvega
2017-03-09 15:49:30 -07:00
parent 19d971fc79
commit 411d7d9fff
13 changed files with 226 additions and 175 deletions

View File

@@ -1,13 +1,10 @@
var ronin = new Ronin();
ronin.element = document.getElementById('ronin');
ronin.surface.element = document.getElementById('surface');
ronin.widget.element = document.getElementById('widget');
ronin.cursor.element = document.getElementById('cursor');
ronin.terminal.element = document.getElementById('terminal');
ronin.cursor.mode = ronin.brush;
var commander = new Commander(document.getElementById("commander"),document.getElementById("commander_input"));
commander.hint.element = document.getElementById('commander_hint');
// Cursor
document.addEventListener('mousedown', function(e){ ronin.cursor.mouse_down(ronin.position_in_canvas(e));}, false);
@@ -34,13 +31,14 @@ starting_canvas.height = window.innerHeight - 300;
starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
commander.query("~ "+ronin.timestamp());
commander.query("@ "+starting_canvas.render());
commander.query("@ layer=Background");
commander.query("@ #222");
commander.query("@ layer=Main");
commander.query("> 0,0");
commander.query("> 1,1");
commander.query("> 2,2");
commander.query("> #ff0000");
commander.query("~ Ready.");
ronin.terminal.query("~ "+ronin.timestamp());
ronin.terminal.query("@ "+starting_canvas.render());
ronin.terminal.query("@ layer=Main");
ronin.terminal.query("> 0,0");
ronin.terminal.query("> 1,1");
ronin.terminal.query("> 2,2");
ronin.terminal.query("> #ff0000");
ronin.terminal.query("~ Ready.");
ronin.terminal.input_element.focus();
ronin.surface.update_widget();

View File

@@ -12,7 +12,7 @@ function Keyboard()
this.alt_held = true;
}
ronin.cursor.update(event);
ronin.widget.update();
ronin.surface.update_widget();
}
this.listen_onkeyup = function(event)
@@ -43,10 +43,9 @@ function Keyboard()
}
// Passive
commander.passive(commander.element_input.value);
ronin.terminal.passive(ronin.terminal.input_element.value);
// ronin.cursor.set_mode(ronin.brush);
ronin.widget.update();
ronin.surface.update_widget();
};
this.key_tab = function()
@@ -55,7 +54,7 @@ function Keyboard()
this.key_enter = function()
{
commander.query(commander.element_input.value);
ronin.terminal.query(ronin.terminal.input_element.value);
}
this.key_space = function()
@@ -64,12 +63,10 @@ function Keyboard()
this.key_arrow_up = function()
{
commander.prev_cmd();
}
this.key_arrow_down = function()
{
commander.next_cmd();
}
this.key_arrow_left = function()
@@ -82,14 +79,11 @@ function Keyboard()
this.key_colon = function()
{
commander.show();
return false;
}
this.key_escape = function()
{
commander.hide();
if(ronin.module){ ronin.module.key_escape(); }
}

View File

@@ -2,22 +2,21 @@ function Ronin()
{
this.modules = {};
this.element = null;
this.widget = new Widget();
this.surface = new Surface("@");
this.fileload = new FileLoad("/");
this.filesave = new FileSave("$");
this.history = new History("^");
this.overlay = new Overlay("|");
this.brush = new Brush(">");
this.brush = new Brush("-");
this.eye = new Eye("*");
this.render = new Render("%");
this.stroke = new Stroke("_");
this.vector = new Vector("+");
this.help = new Help("?");
this.typo = new Typographe("&");
this.preset = new Preset("-");
this.cursor = new Cursor(".");
this.terminal = new Terminal(">");
this.modules[this.surface.rune] = this.surface;
this.modules[this.fileload.rune] = this.fileload;
@@ -30,8 +29,8 @@ function Ronin()
this.modules[this.typo.rune] = this.typo;
this.modules[this.stroke.rune] = this.stroke;
this.modules[this.vector.rune] = this.vector;
this.modules[this.preset.rune] = this.preset;
this.modules[this.help.rune] = this.help;
this.modules[this.terminal.rune] = this.terminal;
this.modules[this.cursor.rune] = this.cursor;
@@ -71,6 +70,5 @@ function Ronin()
this.on_resize = function()
{
this.widget.on_resize();
}
}