*
This commit is contained in:
parent
540452ea39
commit
70910f7cb9
@ -28,7 +28,7 @@
|
|||||||
<script type="text/javascript" src="scripts/modules/type.js"></script>
|
<script type="text/javascript" src="scripts/modules/type.js"></script>
|
||||||
<script type="text/javascript" src="scripts/modules/render.js"></script>
|
<script type="text/javascript" src="scripts/modules/render.js"></script>
|
||||||
<script type="text/javascript" src="scripts/modules/magnet.js"></script>
|
<script type="text/javascript" src="scripts/modules/magnet.js"></script>
|
||||||
<script type="text/javascript" src="scripts/modules/widget.js"></script>
|
<script type="text/javascript" src="scripts/modules/terminal.widget.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript" src="scripts/filters/filter.js"></script>
|
<script type="text/javascript" src="scripts/filters/filter.js"></script>
|
||||||
<script type="text/javascript" src="scripts/filters/stencil.js"></script>
|
<script type="text/javascript" src="scripts/filters/stencil.js"></script>
|
||||||
|
@ -2,18 +2,17 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium"
|
|||||||
*:focus {outline: none; }
|
*:focus {outline: none; }
|
||||||
|
|
||||||
#ronin { width:100%; height:100%; overflow:hidden; background:#111; background-image:url(../media/graphics/grid.svg); background-position: center center; }
|
#ronin { width:100%; height:100%; overflow:hidden; background:#111; background-image:url(../media/graphics/grid.svg); background-position: center center; }
|
||||||
#frame { width:50vw; height:50vh; overflow:hidden; position:fixed; left:50%; top:50%; background:none; border-radius:5px; border:1px solid #333;}
|
#frame { width:50vw; height:50vh; overflow:hidden; position:fixed; left: calc(40vw + 15px); top:100px; background:none; border-radius:5px; border:1px solid #333;}
|
||||||
#frame > .layer { position:absolute; top:0px; left:0px; width:100%; height:100%;}
|
#frame > .layer { position:absolute; top:0px; left:0px; width:100%; height:100%;}
|
||||||
#frame.bright widget { color:#000; }
|
#frame.bright widget { color:#000; }
|
||||||
#overlay { position:absolute; z-index:1000;}
|
#overlay { position:absolute; z-index:1000;}
|
||||||
#frame { cursor:none;}
|
#frame { cursor:none;}
|
||||||
|
|
||||||
#terminal { position: fixed; bottom:0px; left:0px; background:#000; width:100vw; height: 125px;overflow: hidden;}
|
#terminal { position: fixed;top: 0px;left: 0px;background: #000;width: 40vw;height: 100vh;overflow: hidden;}
|
||||||
#terminal input { display: block; position:absolute; bottom:0px; width:100vw; padding:0px 5px; font-size:10px; line-height: 20px; background:none; z-index:900; color:white;}
|
#terminal textarea { display: block;position: fixed;top: 100px;width: calc(40vw - 16px);height: calc(100vh - 130px);padding: 0px 15px;line-height: 20px;font-size: 12px;background: none;color: #999;border-left:1px solid #333;margin-left:15px}
|
||||||
#terminal hint { background:#000; position:absolute; bottom:0px; line-height: 20px; padding:0px 5px; width:100vw; color:#777; font-size:10px; white-space: pre;}
|
#terminal textarea:hover { border-left:1px solid #555; }
|
||||||
#terminal hint b { font-family: "input_mono_regular"; color:#999; }
|
#terminal textarea { z-index:900; }
|
||||||
#terminal hint i { font-style: italic; color:#fff; }
|
#terminal logs { display: none;position: absolute;bottom:20px;width:100vw;color:white}
|
||||||
#terminal logs { display: block;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 { display: block; font-size:10px; line-height:25px; padding:0px 5px; color:#666;}
|
||||||
#terminal logs log .rune { color:white; }
|
#terminal logs log .rune { color:white; }
|
||||||
#terminal logs log.error .rune { color:red; }
|
#terminal logs log.error .rune { color:red; }
|
||||||
@ -21,15 +20,23 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium"
|
|||||||
#terminal logs log.image img { height:85px;width:auto;border-radius: 3px }
|
#terminal logs log.image img { height:85px;width:auto;border-radius: 3px }
|
||||||
#terminal menu { display: inline-block;position: absolute;bottom: 0px;right: 0px;padding: 0px 5px;font-size: 10px;line-height: 20px;color:white }
|
#terminal menu { display: inline-block;position: absolute;bottom: 0px;right: 0px;padding: 0px 5px;font-size: 10px;line-height: 20px;color:white }
|
||||||
#terminal.locked input { color:red; }
|
#terminal.locked input { color:red; }
|
||||||
|
#terminal status { display: block;position: absolute;bottom: 0px;left: 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.hide { height:25px; }
|
#terminal.hide { height:25px; }
|
||||||
#terminal.mini { height:120px; }
|
#terminal.mini { height:120px; }
|
||||||
#terminal.full { height:100vh; }
|
#terminal.full { height:100vh; }
|
||||||
|
|
||||||
#widget { position: absolute; top:0px; left:0px; line-height: 20px; font-size:10px; z-index:9000; color:white; width:100%; height:100%; }
|
#terminal #widget { display:none; position: absolute; top:0px; left:0px; line-height: 20px; font-size:10px; z-index:9000; color:white; width:50vw; height:100px; }
|
||||||
#widget span { display:inline-block; line-height:15px; padding:0px 5px; vertical-align: top; min-width:100px;}
|
#terminal #widget span { display:inline-block; line-height:15px; padding:0px 5px; vertical-align: top; min-width:100px;}
|
||||||
#widget span name { display: block; border-bottom: 1px solid #333; line-height:25px; margin-bottom:5px;}
|
#terminal #widget span name { display: block; border-bottom: 1px solid #333; line-height:25px; margin-bottom:5px;}
|
||||||
#widget li { display:block; }
|
#terminal #widget li { display:block; }
|
||||||
#widget li.active { color:#72dec2; }
|
#terminal #widget li.active { color:#72dec2; }
|
||||||
#widget li.inactive { color:#fff; }
|
#terminal #widget li.inactive { color:#fff; }
|
||||||
#widget li.managed { color:#777; }
|
#terminal #widget li.managed { color:#777; }#terminal
|
||||||
|
|
||||||
|
#terminal hint { display: block;position: fixed;top: 100px;width: calc(40vw - 60px);height: calc(100vh - 130px);padding: 0px 15px;line-height: 20px;font-size: 12px;background: none;color: #999;border-left:1px solid #333;margin-left:15px}
|
||||||
|
|
||||||
|
#terminal hint line { display: inline; width:calc(100% - 30px); }
|
||||||
|
#terminal hint line .input { background:red; }
|
||||||
|
#terminal hint line .status { position: absolute;right:30px; }
|
@ -1,11 +1,11 @@
|
|||||||
frame.select background ;
|
~ Default
|
||||||
frame.resize 400x400 ;
|
|
||||||
brush:color #ff0000 ;
|
frame.resize 300x300
|
||||||
brush.add_pointer 1,1 ;
|
frame.select background
|
||||||
brush.add_pointer 2,2 ;
|
layer.fill #000000
|
||||||
layer.fill #A1A1A1 ;
|
path:line_width 43
|
||||||
render.stencil #72dec2 ;
|
path:line_color #EEEEEE
|
||||||
type:size 50 ;
|
path.stroke M105,240 a-45,-45 0 0,0 -45,-45 M150,240 a-90,-90 0 0,0 -90,-90 M150,60 a90,90 0 0,0 90,90 M195,60 a45,45 0 0,0 45,45 M60,105 a45,-45 0 0,0 45,-45 M240,195 a-45,45 0 0,0 -45,45
|
||||||
type.write 50,150 "RONIN" ;
|
type:size 10
|
||||||
type:size 15 ;
|
type.write 38,262 "RONIN"
|
||||||
type.write 55,180 "VER 0.1 " ;
|
type.write 38,252 "B07"
|
||||||
|
@ -10,7 +10,7 @@ ronin.cursor.mode = ronin.brush;
|
|||||||
document.addEventListener('mousedown', function(e){ ronin.cursor.mouse_down(ronin.position_in_canvas(e));}, false);
|
document.addEventListener('mousedown', function(e){ ronin.cursor.mouse_down(ronin.position_in_canvas(e));}, false);
|
||||||
document.addEventListener('mousemove', function(e){ ronin.cursor.mouse_move(ronin.position_in_canvas(e));}, false);
|
document.addEventListener('mousemove', function(e){ ronin.cursor.mouse_move(ronin.position_in_canvas(e));}, false);
|
||||||
document.addEventListener('mouseup', function(e){ ronin.cursor.mouse_up(ronin.position_in_canvas(e));}, false);
|
document.addEventListener('mouseup', function(e){ ronin.cursor.mouse_up(ronin.position_in_canvas(e));}, false);
|
||||||
document.addEventListener('contextmenu', function(ev){ ev.preventDefault(); return false;}, false);
|
// document.addEventListener('contextmenu', function(ev){ ev.preventDefault(); return false;}, false);
|
||||||
window.addEventListener('resize', function(){ ronin.on_resize(); }, true);
|
window.addEventListener('resize', function(){ ronin.on_resize(); }, true);
|
||||||
|
|
||||||
// Keyboard
|
// Keyboard
|
||||||
@ -31,8 +31,4 @@ starting_canvas.height = window.innerHeight - 300;
|
|||||||
starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
|
starting_canvas.width = parseInt(starting_canvas.width/40) * 40;
|
||||||
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
|
starting_canvas.height = parseInt(starting_canvas.height/40) * 40;
|
||||||
|
|
||||||
ronin.terminal.query("terminal.load default.rin");
|
|
||||||
|
|
||||||
ronin.terminal.input_element.focus();
|
|
||||||
ronin.terminal.update_hint();
|
|
||||||
ronin.widget.update();
|
ronin.widget.update();
|
@ -13,7 +13,8 @@ function Keyboard()
|
|||||||
}
|
}
|
||||||
ronin.cursor.update(event);
|
ronin.cursor.update(event);
|
||||||
ronin.widget.update();
|
ronin.widget.update();
|
||||||
ronin.terminal.update_hint();
|
ronin.terminal.timer = 0;
|
||||||
|
ronin.terminal.update_status();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.listen_onkeyup = function(event)
|
this.listen_onkeyup = function(event)
|
||||||
@ -44,9 +45,8 @@ function Keyboard()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Passive
|
// Passive
|
||||||
ronin.terminal.passive(ronin.terminal.input_element.value);
|
|
||||||
ronin.widget.update();
|
ronin.widget.update();
|
||||||
ronin.terminal.update_hint();
|
ronin.terminal.update_status();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.key_tab = function()
|
this.key_tab = function()
|
||||||
@ -55,7 +55,6 @@ function Keyboard()
|
|||||||
|
|
||||||
this.key_enter = function()
|
this.key_enter = function()
|
||||||
{
|
{
|
||||||
ronin.terminal.query(ronin.terminal.input_element.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.key_space = function()
|
this.key_space = function()
|
||||||
|
@ -43,7 +43,7 @@ function Ronin()
|
|||||||
this.modules[key].install();
|
this.modules[key].install();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.terminal.install();
|
// this.terminal.install();
|
||||||
this.widget.install();
|
this.widget.install();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,11 +52,11 @@ function Ronin()
|
|||||||
this.position_in_canvas = function(e)
|
this.position_in_canvas = function(e)
|
||||||
{
|
{
|
||||||
var x = e.clientX;
|
var x = e.clientX;
|
||||||
x -= (window.innerWidth - this.frame.settings["size"].width)/2;
|
x -= (window.innerWidth - this.frame.settings["size"].width) * 0.4 - 25;
|
||||||
x -= parseInt(this.frame.element.style.marginLeft) + (this.frame.settings["size"].width/2);
|
x -= parseInt(0) + (this.frame.settings["size"].width/2);
|
||||||
var y = e.clientY;
|
var y = e.clientY;
|
||||||
y -= (window.innerHeight - this.frame.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);
|
y -= parseInt(-100) + parseInt(this.frame.settings["size"].height/2);
|
||||||
return new Position(x,y);
|
return new Position(x,y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
function Widget()
|
|
||||||
{
|
|
||||||
this.element = null;
|
|
||||||
|
|
||||||
this.update = function()
|
|
||||||
{
|
|
||||||
var s = "";
|
|
||||||
|
|
||||||
s += "<div class='module'>";
|
|
||||||
for (var key in ronin.modules){
|
|
||||||
s += ronin.modules[key].widget() ? ronin.modules[key].widget()+"<br />" : "";
|
|
||||||
}
|
|
||||||
s += "</div>";
|
|
||||||
|
|
||||||
s += "<div class='cursor'>"+ronin.cursor.mode.widget_cursor()+"</div>";
|
|
||||||
|
|
||||||
this.element.innerHTML = s;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.on_resize = function()
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
@ -10,6 +10,8 @@ function Filter_Stencil()
|
|||||||
|
|
||||||
ronin.frame.active_layer.clear();
|
ronin.frame.active_layer.clear();
|
||||||
this.draw(ronin.frame.context(),angle,color);
|
this.draw(ronin.frame.context(),angle,color);
|
||||||
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.preview = function(cmd)
|
this.preview = function(cmd)
|
||||||
|
@ -4,7 +4,7 @@ function Brush(rune)
|
|||||||
|
|
||||||
// this.parameters = {"offset":Position,"mirror":Rect,"angle":Angle,"reset":Bang};
|
// this.parameters = {"offset":Position,"mirror":Rect,"angle":Angle,"reset":Bang};
|
||||||
this.parameters = [];
|
this.parameters = [];
|
||||||
this.settings = {"color":"#ff0000","size":1};
|
this.settings = {"color":"#ff0000","size":4};
|
||||||
this.pointers = [new Pointer(new Position("0,0"))];
|
this.pointers = [new Pointer(new Position("0,0"))];
|
||||||
|
|
||||||
this.add_method(new Method("add_pointer",["Position"]));
|
this.add_method(new Method("add_pointer",["Position"]));
|
||||||
@ -18,7 +18,8 @@ function Brush(rune)
|
|||||||
this.pointers.push(pointer);
|
this.pointers.push(pointer);
|
||||||
|
|
||||||
ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.render()));
|
ronin.terminal.log(new Log(this,"Added pointer at: "+pointer.offset.render()));
|
||||||
ronin.widget.update();
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.passive = function(cmd)
|
this.passive = function(cmd)
|
||||||
|
@ -12,7 +12,7 @@ function Pointer(offset = new Position(), color = new Color('000000'))
|
|||||||
{
|
{
|
||||||
var ratio = 10/this.position().distance_to(this.position_prev[0]);
|
var ratio = 10/this.position().distance_to(this.position_prev[0]);
|
||||||
ratio = ratio > 1 ? 1 : ratio;
|
ratio = ratio > 1 ? 1 : ratio;
|
||||||
return ronin.brush.settings["size"].float * ratio;
|
return parseInt(ronin.brush.settings["size"]) * ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -130,6 +130,8 @@ function Cursor(rune)
|
|||||||
|
|
||||||
this.update = function(event)
|
this.update = function(event)
|
||||||
{
|
{
|
||||||
|
// this.set_mode(ronin.brush);
|
||||||
|
return;
|
||||||
if(event.altKey == true && event.shiftKey == true){
|
if(event.altKey == true && event.shiftKey == true){
|
||||||
this.set_mode(ronin.frame.active_layer);
|
this.set_mode(ronin.frame.active_layer);
|
||||||
}
|
}
|
||||||
@ -157,10 +159,10 @@ function Cursor(rune)
|
|||||||
if(this.mode.constructor.name != Cursor.name){
|
if(this.mode.constructor.name != Cursor.name){
|
||||||
this.mode.mouse_from = this.position;
|
this.mode.mouse_from = this.position;
|
||||||
this.mode.mouse_held = true;
|
this.mode.mouse_held = true;
|
||||||
|
if(!position.is_outside()){
|
||||||
this.mode.mouse_down(this.position);
|
this.mode.mouse_down(this.position);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
ronin.terminal.update_hint();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_move = function(position)
|
this.mouse_move = function(position)
|
||||||
@ -184,7 +186,7 @@ function Cursor(rune)
|
|||||||
this.mode.mouse_move(this.position,rect);
|
this.mode.mouse_move(this.position,rect);
|
||||||
this.mode.mouse_prev = this.position;
|
this.mode.mouse_prev = this.position;
|
||||||
}
|
}
|
||||||
ronin.terminal.update_hint();
|
// ronin.terminal.update_hint();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_up = function(position)
|
this.mouse_up = function(position)
|
||||||
@ -195,15 +197,25 @@ function Cursor(rune)
|
|||||||
rect.width = this.position.x - this.mode.mouse_from.x;
|
rect.width = this.position.x - this.mode.mouse_from.x;
|
||||||
rect.height = this.position.y - this.mode.mouse_from.y;
|
rect.height = this.position.y - this.mode.mouse_from.y;
|
||||||
|
|
||||||
|
if(!this.mode){ return; }
|
||||||
|
|
||||||
if(this.mode.constructor.name != Cursor.name){
|
if(this.mode.constructor.name != Cursor.name){
|
||||||
|
if(!position.is_outside()){
|
||||||
this.mode.mouse_up(this.position,rect);
|
this.mode.mouse_up(this.position,rect);
|
||||||
|
}
|
||||||
this.mode.mouse_held = false;
|
this.mode.mouse_held = false;
|
||||||
}
|
}
|
||||||
ronin.terminal.input_element.focus();
|
|
||||||
ronin.terminal.update_hint();
|
|
||||||
this.mode.mouse_from = null;
|
this.mode.mouse_from = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.release = function()
|
||||||
|
{
|
||||||
|
this.mode.mouse_held = false;
|
||||||
|
this.mode.mouse_from = null;
|
||||||
|
this.mode = ronin.brush;
|
||||||
|
ronin.terminal.textarea.focus();
|
||||||
|
}
|
||||||
|
|
||||||
this.widget = function()
|
this.widget = function()
|
||||||
{
|
{
|
||||||
return this.mode.mouse_mode();
|
return this.mode.mouse_mode();
|
||||||
|
@ -4,33 +4,7 @@ function Default(rune)
|
|||||||
|
|
||||||
this.hint = function()
|
this.hint = function()
|
||||||
{
|
{
|
||||||
if(ronin.terminal.input_element.value == ""){
|
return "";
|
||||||
var s = "";
|
|
||||||
for(module in ronin.modules){
|
|
||||||
s += ronin.modules[module].constructor.name+" ";
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
var candidates = [];
|
|
||||||
|
|
||||||
for(module in ronin.modules){
|
|
||||||
for(method in ronin.modules[module].methods){
|
|
||||||
candidates.push(module.toLowerCase()+"."+method);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var s = "";
|
|
||||||
|
|
||||||
for(candidate in candidates){
|
|
||||||
if(candidates[candidate].indexOf(ronin.terminal.input_element.value) > -1){
|
|
||||||
s += candidates[candidate]+" ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cursor
|
// Cursor
|
||||||
|
@ -17,7 +17,7 @@ function Eye(rune)
|
|||||||
{
|
{
|
||||||
var imgData = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data;
|
var imgData = ronin.frame.context().getImageData(position.x*2, position.y*2, 1, 1).data;
|
||||||
var c = new Color();
|
var c = new Color();
|
||||||
ronin.terminal.input_element.value = "* "+(c.rgb_to_hex(imgData));
|
// ronin.terminal.input_element.value = "* "+(c.rgb_to_hex(imgData));
|
||||||
ronin.terminal.update_hint();
|
ronin.terminal.update_hint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@ function Frame(rune)
|
|||||||
this.install = function()
|
this.install = function()
|
||||||
{
|
{
|
||||||
this.blink();
|
this.blink();
|
||||||
|
var l = new Layer("background");
|
||||||
|
this.add_layer(l);
|
||||||
|
this.select_layer(l);
|
||||||
|
|
||||||
|
this.resize(new Command(["300x300"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Methods
|
// Methods
|
||||||
@ -34,10 +39,10 @@ function Frame(rune)
|
|||||||
ronin.frame.element.height = this.settings["size"].height * 2;
|
ronin.frame.element.height = this.settings["size"].height * 2;
|
||||||
ronin.frame.element.style.width = this.settings["size"].width+"px";
|
ronin.frame.element.style.width = this.settings["size"].width+"px";
|
||||||
ronin.frame.element.style.height = this.settings["size"].height+"px";
|
ronin.frame.element.style.height = this.settings["size"].height+"px";
|
||||||
ronin.frame.element.style.marginLeft = -(this.settings["size"].width/2);
|
|
||||||
ronin.frame.element.style.marginTop = -(this.settings["size"].height/2);
|
|
||||||
|
|
||||||
ronin.on_resize();
|
ronin.on_resize();
|
||||||
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.crop = function(params, preview = false)
|
this.crop = function(params, preview = false)
|
||||||
@ -61,6 +66,8 @@ function Frame(rune)
|
|||||||
this.select_layer(this.layers[layer_name]);
|
this.select_layer(this.layers[layer_name]);
|
||||||
ronin.modules["layer"] = this.layers[layer_name];
|
ronin.modules["layer"] = this.layers[layer_name];
|
||||||
ronin.layer = this.layers[layer_name];
|
ronin.layer = this.layers[layer_name];
|
||||||
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.context = function()
|
this.context = function()
|
||||||
@ -132,7 +139,7 @@ function Frame(rune)
|
|||||||
|
|
||||||
this.mouse_move = function(position,rect)
|
this.mouse_move = function(position,rect)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "frame."+ronin.terminal.method_name+" "+this.mouse_from.render()+" "+rect.render()+" ";
|
// ronin.terminal.input_element.value = "frame."+ronin.terminal.method_name+" "+this.mouse_from.render()+" "+rect.render()+" ";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ function Layer(name,manager = null)
|
|||||||
ronin.frame.context().rotate(-angle*Math.PI/180);
|
ronin.frame.context().rotate(-angle*Math.PI/180);
|
||||||
ronin.frame.context().restore();
|
ronin.frame.context().restore();
|
||||||
ronin.render.get_layer().clear();
|
ronin.render.get_layer().clear();
|
||||||
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.translate = function(params,preview = false)
|
this.translate = function(params,preview = false)
|
||||||
@ -62,6 +64,8 @@ function Layer(name,manager = null)
|
|||||||
this.clear();
|
this.clear();
|
||||||
this.context().putImageData(data, params.position().x * 2, params.position().y * 2);
|
this.context().putImageData(data, params.position().x * 2, params.position().y * 2);
|
||||||
ronin.overlay.get_layer(true).clear();
|
ronin.overlay.get_layer(true).clear();
|
||||||
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fill = function(params,preview = false)
|
this.fill = function(params,preview = false)
|
||||||
@ -76,7 +80,8 @@ function Layer(name,manager = null)
|
|||||||
this.context().rect(position.x, position.y, rect.width, rect.height);
|
this.context().rect(position.x, position.y, rect.width, rect.height);
|
||||||
this.context().fillStyle = params.color().hex;
|
this.context().fillStyle = params.color().hex;
|
||||||
this.context().fill();
|
this.context().fill();
|
||||||
ronin.terminal.log(new Log(this,"Filled layer "+this.name+": "+params.color().hex));
|
|
||||||
|
return 1, "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rename = function(params, preview = false)
|
this.rename = function(params, preview = false)
|
||||||
@ -150,7 +155,7 @@ function Layer(name,manager = null)
|
|||||||
|
|
||||||
this.mouse_down = function(position)
|
this.mouse_down = function(position)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" 0,0";
|
// ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" 0,0";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +168,7 @@ function Layer(name,manager = null)
|
|||||||
ronin.overlay.draw_cross(position);
|
ronin.overlay.draw_cross(position);
|
||||||
ronin.overlay.draw_line(this.mouse_from,position);
|
ronin.overlay.draw_line(this.mouse_from,position);
|
||||||
|
|
||||||
ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" "+offset.render();
|
// ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" "+offset.render();
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +181,7 @@ function Layer(name,manager = null)
|
|||||||
ronin.overlay.draw_circle(this.mouse_from);
|
ronin.overlay.draw_circle(this.mouse_from);
|
||||||
ronin.overlay.draw_line(this.mouse_from,position);
|
ronin.overlay.draw_line(this.mouse_from,position);
|
||||||
|
|
||||||
ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" "+offset.render();
|
// ronin.terminal.input_element.value = "layer."+ronin.terminal.method_name+" "+offset.render();
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
|
|
||||||
// if(this.coordinates.length == 0){
|
// if(this.coordinates.length == 0){
|
||||||
|
@ -26,6 +26,9 @@ function Magnet(rune)
|
|||||||
if(!rect){ rect = new Rect("20x20"); }
|
if(!rect){ rect = new Rect("20x20"); }
|
||||||
if(!grid){ grid = new Position("4,4"); }
|
if(!grid){ grid = new Position("4,4"); }
|
||||||
|
|
||||||
|
this.settings["grid"] = rect;
|
||||||
|
this.settings["marker"] = grid;
|
||||||
|
|
||||||
if(rect.width < 5 || rect.height < 5){ return; }
|
if(rect.width < 5 || rect.height < 5){ return; }
|
||||||
|
|
||||||
var horizontal = ronin.frame.settings["size"].width/rect.width;
|
var horizontal = ronin.frame.settings["size"].width/rect.width;
|
||||||
|
@ -41,8 +41,7 @@ function Module(rune)
|
|||||||
this.update_setting = function(name,value)
|
this.update_setting = function(name,value)
|
||||||
{
|
{
|
||||||
this.settings[name] = value.content.join(" ");
|
this.settings[name] = value.content.join(" ");
|
||||||
ronin.terminal.log(new Log(this,"Updated setting: "+name+", to "+this.settings[name]));
|
return 1, "ok";
|
||||||
ronin.widget.update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.add_method = function(method)
|
this.add_method = function(method)
|
||||||
|
@ -180,7 +180,7 @@ function Overlay(rune)
|
|||||||
ronin.overlay.clear();
|
ronin.overlay.clear();
|
||||||
ronin.overlay.draw_pointer(position);
|
ronin.overlay.draw_pointer(position);
|
||||||
this.live_draw_from = position;
|
this.live_draw_from = position;
|
||||||
ronin.terminal.input_element.value = "| "+this.live_draw_from.render();
|
// ronin.terminal.input_element.value = "| "+this.live_draw_from.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_move = function(position)
|
this.mouse_move = function(position)
|
||||||
@ -194,7 +194,7 @@ function Overlay(rune)
|
|||||||
rect.height = position.y - this.live_draw_from.y;
|
rect.height = position.y - this.live_draw_from.y;
|
||||||
|
|
||||||
ronin.overlay.draw_rect(this.live_draw_from,rect);
|
ronin.overlay.draw_rect(this.live_draw_from,rect);
|
||||||
ronin.terminal.input_element.value = "| "+this.live_draw_from.render()+" "+rect.render();
|
// ronin.terminal.input_element.value = "| "+this.live_draw_from.render()+" "+rect.render();
|
||||||
|
|
||||||
ronin.terminal.update_hint();
|
ronin.terminal.update_hint();
|
||||||
}
|
}
|
||||||
@ -202,7 +202,7 @@ function Overlay(rune)
|
|||||||
this.mouse_up = function(position)
|
this.mouse_up = function(position)
|
||||||
{
|
{
|
||||||
this.live_draw_from = null;
|
this.live_draw_from = null;
|
||||||
ronin.terminal.input_element.focus();
|
// ronin.terminal.input_element.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget
|
// Widget
|
||||||
|
@ -26,6 +26,8 @@ function Path(rune)
|
|||||||
context.strokeStyle = this.settings["line_color"];
|
context.strokeStyle = this.settings["line_color"];
|
||||||
context.stroke(new Path2D(params.content));
|
context.stroke(new Path2D(params.content));
|
||||||
context.closePath();
|
context.closePath();
|
||||||
|
|
||||||
|
return 1, preview ? "preview" : "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fill = function(params,preview = false)
|
this.fill = function(params,preview = false)
|
||||||
@ -38,6 +40,8 @@ function Path(rune)
|
|||||||
|
|
||||||
context.fillStyle = this.settings["fill_color"];
|
context.fillStyle = this.settings["fill_color"];
|
||||||
context.fill(new Path2D(params.content));
|
context.fill(new Path2D(params.content));
|
||||||
|
|
||||||
|
return 1, preview ? "preview" : "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tools
|
// Tools
|
||||||
@ -87,15 +91,15 @@ function Path(rune)
|
|||||||
|
|
||||||
this.mouse_down = function(position)
|
this.mouse_down = function(position)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
// ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
||||||
ronin.terminal.input_element.value += "M"+position.render();
|
// ronin.terminal.input_element.value += "M"+position.render();
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_move = function(position)
|
this.mouse_move = function(position)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
// ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
||||||
ronin.terminal.input_element.value += "L"+position.render();
|
// ronin.terminal.input_element.value += "L"+position.render();
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,7 +125,7 @@ function Path(rune)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
// ronin.terminal.input_element.value = "path."+ronin.terminal.method_name+" "+this.create_path();
|
||||||
this.last_pos = position;
|
this.last_pos = position;
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
@ -131,7 +135,7 @@ function Path(rune)
|
|||||||
if(this.layer){ this.layer.remove(this); }
|
if(this.layer){ this.layer.remove(this); }
|
||||||
this.coordinates = [];
|
this.coordinates = [];
|
||||||
this.last_pos = null;
|
this.last_pos = null;
|
||||||
ronin.terminal.input_element.value = "";
|
// ronin.terminal.input_element.value = "";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.passive();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9,7 +9,8 @@ function Source(rune)
|
|||||||
|
|
||||||
this.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40
|
this.load = function(params,preview = false) // source.load ../assets/todo.jpg 200x200 40,40
|
||||||
{
|
{
|
||||||
if(!params.filepath() || !params.rect()){ ronin.terminal.log(new Log(this,"Missing image path.","error")); return; }
|
if(!params.filepath()){ return 0, "Path?"; }
|
||||||
|
if(!params.rect()){ return 0,"Rect?"; }
|
||||||
|
|
||||||
this.get_layer(true).clear();
|
this.get_layer(true).clear();
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ function Source(rune)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(!preview){ ronin.overlay.get_layer(true).clear(); }
|
if(!preview){ ronin.overlay.get_layer(true).clear(); }
|
||||||
|
|
||||||
|
return 1,"ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.save = function(params,preview = false)
|
this.save = function(params,preview = false)
|
||||||
|
@ -2,11 +2,12 @@ function Terminal(rune)
|
|||||||
{
|
{
|
||||||
Module.call(this,">");
|
Module.call(this,">");
|
||||||
|
|
||||||
this.element = null;
|
this.element = document.createElement("div");
|
||||||
this.input_element = document.createElement("input");
|
this.textarea = document.createElement("textarea");
|
||||||
this.hint_element = document.createElement("hint");
|
this.hint_element = document.createElement("hint");
|
||||||
this.logs_element = document.createElement("logs");
|
this.logs_element = document.createElement("logs");
|
||||||
this.menu_element = document.createElement("menu");
|
this.menu_element = document.createElement("menu");
|
||||||
|
this.status_element = document.createElement("status");
|
||||||
|
|
||||||
this.history = [];
|
this.history = [];
|
||||||
this.locks = [];
|
this.locks = [];
|
||||||
@ -15,120 +16,68 @@ function Terminal(rune)
|
|||||||
this.add_method(new Method("load",["path"]));
|
this.add_method(new Method("load",["path"]));
|
||||||
this.add_method(new Method("display",["mini/hide/full"]));
|
this.add_method(new Method("display",["mini/hide/full"]));
|
||||||
|
|
||||||
this.load = function readTextFile(params, preview = false)
|
|
||||||
{
|
|
||||||
if(preview){ return; }
|
|
||||||
|
|
||||||
this.locks = [];
|
|
||||||
|
|
||||||
var file = "presets/"+params.content+'?'+new Date().getTime();
|
|
||||||
var rawFile = new XMLHttpRequest();
|
|
||||||
rawFile.open("GET", file, false);
|
|
||||||
rawFile.onreadystatechange = function ()
|
|
||||||
{
|
|
||||||
if(rawFile.readyState === 4)
|
|
||||||
{
|
|
||||||
if(rawFile.status === 200 || rawFile.status == 0)
|
|
||||||
{
|
|
||||||
var allText = rawFile.responseText;
|
|
||||||
ronin.terminal.query(allText);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rawFile.send(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.display = function(params,preview = false)
|
|
||||||
{
|
|
||||||
if(preview){ return; }
|
|
||||||
this.element.setAttribute("class",params.content);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Module
|
// Module
|
||||||
this.install = function(cmd)
|
this.install = function(cmd)
|
||||||
{
|
{
|
||||||
this.element.appendChild(this.input_element);
|
this.element.appendChild(this.textarea);
|
||||||
this.element.appendChild(this.hint_element);
|
this.element.appendChild(this.hint_element);
|
||||||
this.element.appendChild(this.logs_element);
|
this.element.appendChild(this.logs_element);
|
||||||
this.element.appendChild(this.menu_element);
|
this.element.appendChild(this.menu_element);
|
||||||
|
this.element.appendChild(this.status_element);
|
||||||
|
|
||||||
this.hint_element.innerHTML = "_";
|
this.status_element.innerHTML = "Ready.";
|
||||||
|
this.textarea.value = "frame.select background\nframe.resize 400x400\nbrush:color #ff0000\nbrush.add_pointer 1,1\nbrush.add_pointer 2,2\nlayer.fill #A1A1A1\nrender.stencil #72dec2\ntype:size 50\ntype.write 50,150 \"RONIN\"\ntype:size 15\ntype.write 55,180 \"VER 0.1\""
|
||||||
|
this.hint_element.innerHTML = "";
|
||||||
|
|
||||||
this.update_log();
|
this.validation_timer();
|
||||||
|
this.load("default.rin");
|
||||||
|
this.timer = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.active = function(cmd)
|
this.timer = 0;
|
||||||
|
this.history = "";
|
||||||
|
|
||||||
|
this.validation_timer = function()
|
||||||
{
|
{
|
||||||
|
this.timer += 1;
|
||||||
|
setTimeout(function(){ ronin.terminal.validation_timer(); }, 100);
|
||||||
|
this.validate();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cmd = function()
|
this.has_changed = function()
|
||||||
{
|
{
|
||||||
var content = this.input_element.value.trim();
|
return ronin.terminal.history != ronin.terminal.textarea.value ? true : false;
|
||||||
var key = content[0];
|
|
||||||
var cmd = new Command(content.substring(1).trim().split(" "));
|
|
||||||
return cmd;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Locks
|
this.validate = function()
|
||||||
|
|
||||||
this.lock = function(key)
|
|
||||||
{
|
{
|
||||||
console.log("Added lock: ",key);
|
if(this.timer < 10){ return; }
|
||||||
this.locks.push(key);
|
|
||||||
this.element.setAttribute("class","locked");
|
if(ronin.terminal.has_changed() == true){
|
||||||
|
ronin.terminal.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.unlock = function(key)
|
this.update_status();
|
||||||
{
|
|
||||||
console.log("Removed lock: ",key);
|
|
||||||
this.locks.splice(this.locks.indexOf(key), 1);
|
|
||||||
|
|
||||||
if(this.locks.length < 1){
|
this.history = this.textarea.value;
|
||||||
this.element.setAttribute("class","unlocked");
|
this.timer = 0;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Queue
|
|
||||||
|
|
||||||
this.queue = [];
|
|
||||||
|
|
||||||
this.query = function(input_str)
|
|
||||||
{
|
|
||||||
if(input_str.trim() == ""){ return; }
|
|
||||||
if(this.locks.length > 0){ console.warn("Trying: "+input_str+", Locked: ",this.locks); return; }
|
|
||||||
|
|
||||||
this.lock("query");
|
|
||||||
this.input_element.value = "";
|
|
||||||
|
|
||||||
if(input_str.indexOf(";") > 0){
|
|
||||||
var parts = input_str.replace("\n","").split(";");
|
|
||||||
for(id in parts){
|
|
||||||
parts[id] = parts[id].replace("\n","").trim();
|
|
||||||
}
|
|
||||||
this.queue = parts;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.queue = [];
|
|
||||||
this.queue.push(input_str)
|
|
||||||
}
|
|
||||||
this.run();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.run = function()
|
this.run = function()
|
||||||
{
|
{
|
||||||
if(!ronin.terminal.queue[0]){ this.unlock("query"); return; }
|
this.hint_element.innerHTML = "";
|
||||||
|
var queue = ronin.terminal.textarea.value.split("\n")
|
||||||
var entry = ronin.terminal.queue.shift();
|
for(id in queue){
|
||||||
console.info(entry);
|
this.hint_element.innerHTML += "<line><text class='input'>"+this.syntax_highlight(queue[id])+"</text><text class='status'>"+this.run_line(queue.length - id,queue[id])+"</text></line><br />";
|
||||||
active(entry);
|
}
|
||||||
ronin.widget.update();
|
|
||||||
|
|
||||||
setTimeout(function(){ ronin.terminal.run(); }, 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function active(content)
|
this.run_line = function(id,line)
|
||||||
{
|
{
|
||||||
ronin.terminal.log(new Log(ronin.terminal,content,"input"));
|
var content = line;
|
||||||
|
|
||||||
|
if(content.trim() == ""){ return "~"; }
|
||||||
|
if(content.trim()[0] == "~"){ return "~"; }
|
||||||
|
|
||||||
if(content.indexOf(".") > -1){
|
if(content.indexOf(".") > -1){
|
||||||
var module_name = content.split(" ")[0].split(".")[0]
|
var module_name = content.split(" ")[0].split(".")[0]
|
||||||
@ -146,133 +95,90 @@ function Terminal(rune)
|
|||||||
var parameters = content.split(" "); parameters.shift();
|
var parameters = content.split(" "); parameters.shift();
|
||||||
var parameters = new Command(parameters);
|
var parameters = new Command(parameters);
|
||||||
|
|
||||||
|
if(id == 1){ ronin.cursor.set_mode(ronin[module_name]); }
|
||||||
|
|
||||||
if(ronin[module_name] && ronin[module_name][method_name]){
|
if(ronin[module_name] && ronin[module_name][method_name]){
|
||||||
ronin[module_name][method_name](parameters);
|
return ronin[module_name][method_name](parameters,id == 1 ? true : false);
|
||||||
}
|
}
|
||||||
else if(ronin[module_name] && ronin[module_name].settings[setting_name]){
|
else if(ronin[module_name] && ronin[module_name].settings[setting_name]){
|
||||||
ronin[module_name].update_setting(setting_name,parameters);
|
return ronin[module_name].update_setting(setting_name,parameters);
|
||||||
}
|
}
|
||||||
else if(ronin["render"].collection[method_name]){
|
else if(ronin["render"].collection[method_name]){
|
||||||
ronin["render"].collection[method_name].render(parameters);
|
return ronin["render"].collection[method_name].render(parameters);
|
||||||
}
|
}
|
||||||
else if(ronin[module_name]){
|
else if(ronin[module_name]){
|
||||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown method: "+method_name));
|
return 0, "Unknown Method";
|
||||||
}
|
}
|
||||||
else if(module_name == "render"){
|
else if(module_name == "render"){
|
||||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown filter: "+method_name));
|
return 0, "Unknown Filter";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ronin.terminal.log(new Log(ronin.terminal,"Unknown module: "+module_name));
|
return 0, "Unknown Module";
|
||||||
}
|
}
|
||||||
|
return 0, "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.module_name = null;
|
this.syntax_highlight = function(line)
|
||||||
this.method_name = null;
|
|
||||||
this.method_params = null;
|
|
||||||
|
|
||||||
this.passive = function()
|
|
||||||
{
|
{
|
||||||
var content = this.input_element.value;
|
return line;
|
||||||
var parts = content.split(" ");
|
|
||||||
var key = parts.shift();
|
|
||||||
|
|
||||||
this.module_name = key.split(".")[0];
|
|
||||||
this.method_name = key.indexOf(".") > -1 ? key.split(".")[1] : null;
|
|
||||||
this.method_params = new Command(parts);
|
|
||||||
|
|
||||||
if(ronin[this.module_name]){
|
|
||||||
ronin.cursor.set_mode(ronin[this.module_name]);
|
|
||||||
if(ronin[this.module_name][this.method_name]){
|
|
||||||
ronin[this.module_name][this.method_name](this.method_params,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.update_active_line = function(new_line)
|
||||||
|
{
|
||||||
|
var lines = this.textarea.value.split("\n");
|
||||||
|
|
||||||
|
lines[lines.length-1] = new_line;
|
||||||
|
|
||||||
|
this.textarea.value = lines.join("\n");
|
||||||
|
this.timer = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.update_status = function()
|
||||||
|
{
|
||||||
|
if(ronin.terminal.has_changed() == true){
|
||||||
|
this.status_element.innerHTML = "Changes Pending.";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
ronin.cursor.set_mode();
|
this.status_element.innerHTML = "Idle.";
|
||||||
}
|
}
|
||||||
|
|
||||||
this.hint(content);
|
this.status_element.innerHTML += "<span class='details'>"+this.textarea.value.length+"c "+this.textarea.value.split("\n").length+"l</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hint
|
|
||||||
|
|
||||||
this.update_hint = function(content = this.input_element.value)
|
|
||||||
{
|
|
||||||
var module_name = content.indexOf(".") > -1 ? content.split(" ")[0].split(".")[0] : content.split(" ")[0];
|
|
||||||
|
|
||||||
if(ronin[module_name]){
|
|
||||||
this.hint_element.innerHTML = this.pad(content)+ronin[module_name].hint(content.replace(module_name+".",""));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.hint_element.innerHTML = this.pad(content)+ronin["default"].hint(content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.update_menu = function()
|
|
||||||
{
|
|
||||||
this.menu_element.innerHTML = ronin.terminal.history.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.key_escape = function()
|
|
||||||
{
|
|
||||||
this.input_element.value = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
this.key_arrow_up = function()
|
|
||||||
{
|
|
||||||
this.history_index -= 1;
|
|
||||||
|
|
||||||
if(this.history_index < 0){ this.history_index = 0; }
|
|
||||||
|
|
||||||
ronin.terminal.input_element.value = "> "+ronin.terminal.history[this.history_index];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.key_arrow_down = function()
|
|
||||||
{
|
|
||||||
this.history_index += 1;
|
|
||||||
|
|
||||||
if(this.history_index >= this.history.length){ this.history_index = this.history.length-1; }
|
|
||||||
|
|
||||||
ronin.terminal.input_element.value = "> "+ronin.terminal.history[this.history_index];
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pad = function(input)
|
|
||||||
{
|
|
||||||
var s = "";
|
|
||||||
for (i = 0; i < input.length+1; i++){
|
|
||||||
s += "_";
|
|
||||||
}
|
|
||||||
return "<span style='color:#000'>"+s+"</span>";
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
this.logs = [];
|
|
||||||
|
|
||||||
this.log = function(log)
|
this.log = function(log)
|
||||||
{
|
{
|
||||||
this.logs.push(log);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update_log = function()
|
this.load = function readTextFile(name)
|
||||||
{
|
{
|
||||||
if(ronin.terminal.logs[0]){
|
var file = "presets/"+name+'?'+new Date().getTime();
|
||||||
ronin.terminal.logs_element.appendChild(ronin.terminal.logs[0].element);
|
var rawFile = new XMLHttpRequest();
|
||||||
ronin.terminal.logs.shift();
|
rawFile.open("GET", file, false);
|
||||||
|
rawFile.onreadystatechange = function ()
|
||||||
|
{
|
||||||
|
if(rawFile.readyState === 4)
|
||||||
|
{
|
||||||
|
if(rawFile.status === 200 || rawFile.status == 0)
|
||||||
|
{
|
||||||
|
var allText = rawFile.responseText;
|
||||||
|
ronin.terminal.textarea.value = allText;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
setTimeout(function(){ ronin.terminal.update_log(); }, 200);
|
}
|
||||||
|
rawFile.send(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
// Log
|
||||||
|
|
||||||
function Log(host,message,type = "default")
|
function Log(host,message,error = false)
|
||||||
{
|
{
|
||||||
this.host = host;
|
this.host = host;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.type = type;
|
this.error = error;
|
||||||
this.element = document.createElement("log");
|
this.element = document.createElement("log");
|
||||||
this.element.setAttribute("class",type);
|
this.element.setAttribute("class",error ? "error" : "okay");
|
||||||
this.element.innerHTML = "<span class='rune'>"+(host.rune ? host.rune : ">")+"</span> "+message;
|
this.element.innerHTML = "<span class='rune'>"+(host.rune ? host.rune : ">")+"</span> "+message;
|
||||||
console.log(this.host.constructor.name,this.message)
|
console.log(this.host.constructor.name,this.message);
|
||||||
}
|
}
|
@ -7,7 +7,7 @@ function Widget(rune)
|
|||||||
|
|
||||||
this.install = function()
|
this.install = function()
|
||||||
{
|
{
|
||||||
ronin.element.appendChild(this.element);
|
ronin.terminal.element.appendChild(this.element);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.update = function()
|
this.update = function()
|
@ -23,7 +23,7 @@ function Type(rune)
|
|||||||
target_layer.context().fillStyle = color;
|
target_layer.context().fillStyle = color;
|
||||||
target_layer.context().fillText(text,position.x,position.y);
|
target_layer.context().fillText(text,position.x,position.y);
|
||||||
|
|
||||||
console.log(target_layer.context());
|
return 1, preview ? "preview" : "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mouse
|
// Mouse
|
||||||
@ -35,26 +35,26 @@ function Type(rune)
|
|||||||
|
|
||||||
this.mouse_down = function(position)
|
this.mouse_down = function(position)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "type."+ronin.terminal.method_name+" "+position.render();
|
var line = "type.write "+position.render()+" \"Placeholder\"";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.update_active_line(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_move = function(position,rect)
|
this.mouse_move = function(position,rect)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "type."+ronin.terminal.method_name+" "+position.render();
|
var line = "type.write "+position.render()+" \"Placeholder\"";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.update_active_line(line);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.mouse_up = function(position)
|
this.mouse_up = function(position)
|
||||||
{
|
{
|
||||||
ronin.terminal.input_element.value = "type."+ronin.terminal.method_name+" "+position.render();
|
var line = "type.write "+position.render()+" \"Placeholder\"";
|
||||||
ronin.terminal.passive();
|
ronin.terminal.update_active_line(line);
|
||||||
|
ronin.terminal.textarea.value += "\n";
|
||||||
|
ronin.cursor.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.key_escape = function()
|
this.key_escape = function()
|
||||||
{
|
{
|
||||||
if(this.layer){ this.layer.remove(this); }
|
if(this.layer){ this.layer.remove(this); }
|
||||||
ronin.terminal.input_element.value = "";
|
|
||||||
ronin.terminal.passive();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user