diff --git a/links/main.css b/links/main.css index 3f03bf9..8ed3158 100644 --- a/links/main.css +++ b/links/main.css @@ -1,28 +1,23 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium",courier,monospace;} *:focus {outline: none; } -#ronin { width:100%; height:100%; overflow:hidden; background:#ccc; background-image:url(../media/graphics/grid.svg); background-position: center center; } -#frame { width:50vw; height:50vh; overflow:hidden; position:fixed; left: calc(40vw + 15px); top:100px; background:#ddd;} +#ronin { background:#ddd; width:100%; height:100%; overflow:hidden; background-image:url(../media/graphics/grid.svg); background-position: center center; } +#frame { background:#111; width:50vw; height:50vh; overflow:hidden; position:fixed; left: calc(40vw + 15px); top:100px; border-radius: 3px} #frame > .layer { position:absolute; top:0px; left:0px; width:100%; height:100%;} -#frame.bright widget { color:#000; } #overlay { position:absolute; z-index:1000;} #frame { cursor:none;} -#terminal { position: fixed;bottom: 0px;left: 0px;background: #eee;width: 100vw;height: 30px;overflow: hidden; } -#terminal logs { display: none;position: absolute;bottom:20px;width:100vw;color:white} -#terminal logs log { display: block; font-size:10px; line-height:25px; padding:0px 5px; color:#666;} -#terminal logs log .rune { color:white; } -#terminal logs log.error .rune { color:red; } -#terminal logs log.input { color:white; } -#terminal logs log.image img { height:85px;width:auto;border-radius: 3px } -#terminal.locked input { color:red; } -#terminal status { display: block;position: absolute;bottom: 0px;right: 0px;padding: 5px 15px 5px 31px;font-size: 12px;line-height: 20px;color: white;width:calc(40vw - 45px) } -#terminal status .details { float:right; color:#555; } +#terminal { position: fixed;bottom: 0px;left: 0px;background: #eee;width: 100vw;height: 60px;overflow: hidden;} -#terminal.hide { height:25px; } -#terminal.mini { height:120px; } -#terminal.full { height:100vh; } +#terminal #hint, #terminal #widget, #terminal input, #terminal #logs { display: block;position: fixed;bottom: 0px;line-height: 20px; width:calc(100vw - 40px); background:none; color:#777; font-size:11px; padding:5px 20px; white-space: pre; } -#terminal input { position:fixed; bottom:0px; z-index:900; line-height: 20px; width:calc(100vw - 20px); background:none; color:black; font-size:11px; padding:5px 10px;} -#terminal hint { display: block;position: fixed;bottom: 0px;line-height: 20px; width:calc(100vw - 20px); background:none; color:#999; font-size:11px; padding:5px 10px; white-space: pre; } -#terminal #widget { display: block;position: fixed;bottom: 0px;line-height: 20px; width:calc(100vw - 20px); background:none; color:#999; font-size:11px; padding:5px 10px; white-space: pre; text-align: right} \ No newline at end of file +#terminal input { z-index: 9000; color:red; font-family: 'input_mono_regular'} +#terminal input:focus { color:#000; } + +#terminal #logs { position:fixed; bottom:30px; border-bottom:1px solid #fff; } + +#terminal #widget { text-align: right} + +#terminal #hint .module { display: inline-block; color:black; } +#terminal #hint .method { display: inline-block; color:black; } +#terminal #hint .params { display: inline-block; color:#999; font-style: italic } \ No newline at end of file diff --git a/media/graphics/grid.svg b/media/graphics/grid.svg index f6fd372..0a59b28 100644 --- a/media/graphics/grid.svg +++ b/media/graphics/grid.svg @@ -1,5 +1,6 @@ - - - + + + + \ No newline at end of file diff --git a/scripts/core/keyboard.js b/scripts/core/keyboard.js index fb4a9cf..200df91 100644 --- a/scripts/core/keyboard.js +++ b/scripts/core/keyboard.js @@ -21,12 +21,14 @@ function Keyboard() this.shift_held = false; this.alt_held = false; - switch (event.key || event.which) { + switch (event.key || event.keyCode || event.which) { case "Enter": this.key_enter(); break; case "ArrowUp": this.key_arrow_up(); break; case "ArrowDown": this.key_arrow_down(); break; case "ArrowLeft": this.key_arrow_left(); break; case "ArrowRight": this.key_arrow_right(); break; + case "]": ronin.brush.size_up(); break; + case "[": ronin.brush.size_down(); break; case ":": this.key_colon(); break; case "Escape": this.key_escape(); break; case 13: this.key_enter(); break; diff --git a/scripts/modules/brush.js b/scripts/modules/brush.js index c781e2e..88deb58 100644 --- a/scripts/modules/brush.js +++ b/scripts/modules/brush.js @@ -36,16 +36,12 @@ function Brush(rune) this.size_up = function() { - this.settings["size"] -= this.settings["size"] > 1 ? 1 : 0; - ronin.frame.widget.update(); - ronin.terminal.log(new Log(this,"Increased pointer size to: "+this.settings["size"])); + this.settings["size"] += 1; } this.size_down = function() { - this.settings["size"] += 1; - ronin.frame.widget.update(); - ronin.terminal.log(new Log(this,"Decreased pointer size to: "+this.settings["size"])); + this.settings["size"] -= this.settings["size"] > 1 ? 1 : 0; } // Eraser diff --git a/scripts/modules/cursor.js b/scripts/modules/cursor.js index 910ab8a..e766db4 100644 --- a/scripts/modules/cursor.js +++ b/scripts/modules/cursor.js @@ -152,9 +152,11 @@ function Cursor(rune) this.set_mode = function(mode = ronin.brush) { + if(!mode){ mode = ronin.brush; } + if(this.mode == mode){ return; } this.mode = mode; - document.body.setAttribute("class",this.mode.constructor.name); + document.body.setAttribute("class",this.mode.name); ronin.widget.update(); } diff --git a/scripts/modules/frame.js b/scripts/modules/frame.js index b0cabe3..5255dd4 100644 --- a/scripts/modules/frame.js +++ b/scripts/modules/frame.js @@ -9,7 +9,7 @@ function Frame(rune) this.active_layer = null; this.render_layer = null; - this.add_method(new Method("resize",[new Rect().name])); + this.add_method(new Method("resize",[new Position().name,new Rect().name])); this.add_method(new Method("select",["text"])); this.install = function() @@ -24,8 +24,8 @@ function Frame(rune) // Clamp - starting_canvas.width = parseInt(starting_canvas.width/40) * 40; - starting_canvas.height = parseInt(starting_canvas.height/40) * 40; + starting_canvas.width = parseInt(starting_canvas.width/40) * 40 - 40; + starting_canvas.height = parseInt(starting_canvas.height/40) * 40 - 40; this.resize(new Command(starting_canvas.width+"x"+starting_canvas.height)); } @@ -55,7 +55,7 @@ function Frame(rune) this.settings.size = rect; - return 1, "ok"; + return 1, "Resized to "+this.settings.size.render(); } this.select = function(params, preview = false) diff --git a/scripts/modules/module.js b/scripts/modules/module.js index d082116..ecfe736 100644 --- a/scripts/modules/module.js +++ b/scripts/modules/module.js @@ -51,17 +51,27 @@ function Module(rune) this.methods[method.name] = method; } - this.hint = function(content) + this.hint = function(method) { var html = ""; - for(method in this.methods){ - html += "."+method+" "; + if(method){ + html += method.hint(); } - for(setting in this.settings){ - html += setting+"="+this.settings[setting]+" "; + else{ + for(id in this.methods){ + html += "."+this.methods[id].name+" "; + } } + + // for(method in this.methods){ + // html += "."+method+" "; + // } + // for(setting in this.settings){ + // html += setting+"="+this.settings[setting]+" "; + // } + return html; } diff --git a/scripts/modules/terminal.js b/scripts/modules/terminal.js index a353761..16bf0fe 100644 --- a/scripts/modules/terminal.js +++ b/scripts/modules/terminal.js @@ -4,8 +4,11 @@ function Terminal(rune) this.element = document.createElement("div"); this.input = document.createElement("input"); - this.hint_element = document.createElement("hint"); - this.logs_element = document.createElement("logs"); + this.hint_element = document.createElement("div"); + this.logs_element = document.createElement("div"); + this.hint_element.id = "hint"; + this.logs_element.id = "logs"; + this.logs_element.innerHTML = "Hello there"; this.history = []; this.locks = []; @@ -26,7 +29,6 @@ function Terminal(rune) this.run = function() { - var command = this.cmd(); var module = command.module(); var method = command.method(); @@ -47,18 +49,33 @@ function Terminal(rune) if(method){ method.preview(command); } - this.hint_element.innerHTML = ""+this.input.value+" "+(module ? module.hint() : this.hint()); + this.hint_element.innerHTML = ""+this.input.value+""+(this.input.value ? " " : "")+(module ? module.hint(method) : this.hint(method)); + ronin.cursor.set_mode(module); } - this.hint = function() + this.hint = function(method) { var html = ""; - for(id in ronin.modules){ - html += ronin.modules[id].name+" "; + if(this.input.value){ + for(id in ronin.modules){ + if(this.input.value != ronin.modules[id].name.substr(0,this.input.value.length)){ continue; } + html += ""+ronin.modules[id].name+" "; + } + } + else{ + for(id in ronin.modules){ + html += ""+ronin.modules[id].name+" "; + } } return html; } + this.log = function(log) + { + this.logs_element.innerHTML = ""; + this.logs_element.appendChild(log.element); + } + this.cmd = function() { return new Command(this.input.value); @@ -86,32 +103,6 @@ function Terminal(rune) rawFile.send(null); ronin.widget.update(); } - - this.parsed_input = function() - { - var content = this.input.value; - - if(content.trim() == ""){ ronin.cursor.set_mode(ronin.brush); return "~"; } - if(content.trim()[0] == "~"){ return "~"; } - - if(content.indexOf(".") > -1){ - var module_name = content.split(" ")[0].split(".")[0] - } - else if(content.indexOf(":") > -1){ - var module_name = content.split(" ")[0].split(":")[0] - } - else{ - var module_name = content.split(" ")[0]; - } - - var method_name = content.indexOf(".") > -1 ? content.split(" ")[0].split(".")[1] : "default"; - var setting_name = content.indexOf(":") > -1 ? content.split(" ")[0].split(":")[1] : null; - - var parameters = content.split(" "); parameters.shift(); - var parameters = new Command(parameters); - - return {module_name: module_name, method_name: method_name, setting_name: setting_name, parameters: parameters}; - } } // Log @@ -123,6 +114,6 @@ function Log(host,message,error = false) this.error = error; this.element = document.createElement("log"); this.element.setAttribute("class",error ? "error" : "okay"); - this.element.innerHTML = ""+(host.rune ? host.rune : ">")+" "+message; + this.element.innerHTML = ""+host.name+": "+message; console.log(this.host.constructor.name,this.message); } \ No newline at end of file diff --git a/scripts/units/method.js b/scripts/units/method.js index 8bbcd15..ab6f236 100644 --- a/scripts/units/method.js +++ b/scripts/units/method.js @@ -19,11 +19,11 @@ function Method(name,params,mouse_event) return s; } - this.help = function() + this.hint = function() { var s = ""; for(id in this.params){ - s += this.params[id]+":" + s += ""+this.params[id]+" "; } s = s.substr(0,s.length-1); @@ -37,6 +37,6 @@ function Method(name,params,mouse_event) this.run = function(cmd) { - return this.host[this.name](cmd,false); + return ronin.terminal.log(new Log(this.host,this.host[this.name](cmd,false))); } } \ No newline at end of file