Progress on source files.
This commit is contained in:
parent
29ca5aa5cd
commit
df8d94d3d5
@ -2,11 +2,52 @@ function Commander(element,element_input)
|
||||
{
|
||||
this.element = element;
|
||||
this.element_input = element_input;
|
||||
this.cmd = null;
|
||||
this.storage = [];
|
||||
this.storage_index = 0;
|
||||
this.always_show = false;
|
||||
|
||||
this.query = function(input_str)
|
||||
{
|
||||
if(input_str.indexOf(";") > 0){
|
||||
var multi = input_str.split(";");
|
||||
for (i = 0; i < multi.length; i++) {
|
||||
this.query(multi[i]);
|
||||
}
|
||||
}
|
||||
else{
|
||||
this.active(input_str);
|
||||
}
|
||||
}
|
||||
|
||||
this.active = function(content)
|
||||
{
|
||||
var key = content[0];
|
||||
var cmd = new Command(content.substring(1).split(" "));
|
||||
|
||||
if(ronin.modules[key]){
|
||||
ronin.modules[key].active(cmd);
|
||||
}
|
||||
|
||||
this.hide();
|
||||
|
||||
ronin.history.add(content);
|
||||
}
|
||||
|
||||
this.passive = function(content)
|
||||
{
|
||||
var key = content[0];
|
||||
var cmd = new Command(content.substring(1).split(" "));
|
||||
|
||||
ronin.module = null;
|
||||
|
||||
if(ronin.modules[key]){
|
||||
ronin.modules[key].passive(cmd);
|
||||
ronin.module = ronin.modules[key];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
this.show = function()
|
||||
{
|
||||
this.element.setAttribute('class','visible');
|
||||
@ -42,39 +83,5 @@ function Commander(element,element_input)
|
||||
this.element_input.value = this.storage[this.storage_index];
|
||||
}
|
||||
|
||||
this.active = function(content)
|
||||
{
|
||||
this.storage.push(content.join(" "));
|
||||
this.storage_index = this.storage.length;
|
||||
|
||||
var key = content[0][0];
|
||||
content[0] = content[0].slice(1);
|
||||
var cmd = new Command(content);
|
||||
|
||||
if(ronin.modules[key]){
|
||||
ronin.modules[key].active(this.cmd);
|
||||
}
|
||||
|
||||
switch(key) {
|
||||
case "~":
|
||||
this.always();
|
||||
break;
|
||||
}
|
||||
this.hide();
|
||||
|
||||
ronin.history.add(content.join(" "));
|
||||
}
|
||||
|
||||
this.passive = function(content)
|
||||
{
|
||||
var key = content[0][0];
|
||||
content[0] = content[0].slice(1);
|
||||
this.cmd = new Command(content);
|
||||
ronin.module = null;
|
||||
|
||||
if(ronin.modules[key]){
|
||||
ronin.modules[key].passive(this.cmd);
|
||||
ronin.module = ronin.modules[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,5 +23,8 @@ var starting_canvas = new Rect();
|
||||
starting_canvas.width = window.innerWidth - 200;
|
||||
starting_canvas.height = window.innerHeight - 200;
|
||||
|
||||
|
||||
ronin.canvas.resize(starting_canvas);
|
||||
ronin.overlay.resize(starting_canvas);
|
||||
ronin.overlay.resize(starting_canvas);
|
||||
|
||||
commander.query("@ 200x200");
|
@ -51,8 +51,7 @@ function Keyboard()
|
||||
}
|
||||
|
||||
// Passive
|
||||
var cmd = commander.element_input.value;
|
||||
commander.passive(cmd.split(" "));
|
||||
commander.passive(commander.element_input.value);
|
||||
ronin.hint.update();
|
||||
|
||||
ronin.cursor.set_mode(new Mode_Paint());
|
||||
@ -70,20 +69,7 @@ function Keyboard()
|
||||
|
||||
this.key_enter = function()
|
||||
{
|
||||
var cmd = commander.element_input.value;
|
||||
|
||||
if(cmd.indexOf(";") > 0){
|
||||
var multi = cmd.split(";");
|
||||
var i = 0;
|
||||
while(i < 100){
|
||||
if(multi[i]){commander.active(multi[i].split(" "));}
|
||||
else{ break; }
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
else{
|
||||
commander.active(cmd.split(" "));
|
||||
}
|
||||
commander.query(commander.element_input.value);
|
||||
}
|
||||
|
||||
this.key_space = function()
|
||||
|
@ -15,7 +15,7 @@ function Ronin()
|
||||
this.stroke = new Stroke("_");
|
||||
this.vector = new Vector("+");
|
||||
this.help = new Help("?");
|
||||
this.history = new History(";");
|
||||
this.history = new History("^");
|
||||
|
||||
this.cursor = new Cursor();
|
||||
|
||||
|
@ -17,6 +17,6 @@ function History(rune)
|
||||
this.widget = function()
|
||||
{
|
||||
if(this.lines.length === 0){ return "";}
|
||||
return "; "+this.lines.length+" ";
|
||||
return "^ "+this.lines.length+" ";
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user