diff --git a/presets/a6000.rin b/archives/presets/a6000.rin similarity index 100% rename from presets/a6000.rin rename to archives/presets/a6000.rin diff --git a/presets/album.rin b/archives/presets/album.rin similarity index 100% rename from presets/album.rin rename to archives/presets/album.rin diff --git a/presets/album_demo.rin b/archives/presets/album_demo.rin similarity index 100% rename from presets/album_demo.rin rename to archives/presets/album_demo.rin diff --git a/presets/album_duomic.rin b/archives/presets/album_duomic.rin similarity index 100% rename from presets/album_duomic.rin rename to archives/presets/album_duomic.rin diff --git a/presets/album_extra.rin b/archives/presets/album_extra.rin similarity index 100% rename from presets/album_extra.rin rename to archives/presets/album_extra.rin diff --git a/presets/album_laeisthic.rin b/archives/presets/album_laeisthic.rin similarity index 100% rename from presets/album_laeisthic.rin rename to archives/presets/album_laeisthic.rin diff --git a/presets/album_malice.rin b/archives/presets/album_malice.rin similarity index 100% rename from presets/album_malice.rin rename to archives/presets/album_malice.rin diff --git a/presets/album_soundtrack.rin b/archives/presets/album_soundtrack.rin similarity index 100% rename from presets/album_soundtrack.rin rename to archives/presets/album_soundtrack.rin diff --git a/presets/blank.rin b/archives/presets/blank.rin similarity index 100% rename from presets/blank.rin rename to archives/presets/blank.rin diff --git a/presets/camilare.rin b/archives/presets/camilare.rin similarity index 100% rename from presets/camilare.rin rename to archives/presets/camilare.rin diff --git a/presets/default.rin b/archives/presets/default.rin similarity index 100% rename from presets/default.rin rename to archives/presets/default.rin diff --git a/presets/dictionarism.rin b/archives/presets/dictionarism.rin similarity index 100% rename from presets/dictionarism.rin rename to archives/presets/dictionarism.rin diff --git a/presets/flower.rin b/archives/presets/flower.rin similarity index 100% rename from presets/flower.rin rename to archives/presets/flower.rin diff --git a/presets/glyph.rin b/archives/presets/glyph.rin similarity index 100% rename from presets/glyph.rin rename to archives/presets/glyph.rin diff --git a/presets/icon.rin b/archives/presets/icon.rin similarity index 100% rename from presets/icon.rin rename to archives/presets/icon.rin diff --git a/presets/itch.rin b/archives/presets/itch.rin similarity index 100% rename from presets/itch.rin rename to archives/presets/itch.rin diff --git a/presets/logo.rin b/archives/presets/logo.rin similarity index 100% rename from presets/logo.rin rename to archives/presets/logo.rin diff --git a/presets/logo_nataniev.rin b/archives/presets/logo_nataniev.rin similarity index 100% rename from presets/logo_nataniev.rin rename to archives/presets/logo_nataniev.rin diff --git a/presets/logo_ronin.rin b/archives/presets/logo_ronin.rin similarity index 100% rename from presets/logo_ronin.rin rename to archives/presets/logo_ronin.rin diff --git a/presets/marabu.rin b/archives/presets/marabu.rin similarity index 100% rename from presets/marabu.rin rename to archives/presets/marabu.rin diff --git a/presets/neauoire.rin b/archives/presets/neauoire.rin similarity index 100% rename from presets/neauoire.rin rename to archives/presets/neauoire.rin diff --git a/presets/rabbits.rin b/archives/presets/rabbits.rin similarity index 100% rename from presets/rabbits.rin rename to archives/presets/rabbits.rin diff --git a/presets/radial.rin b/archives/presets/radial.rin similarity index 100% rename from presets/radial.rin rename to archives/presets/radial.rin diff --git a/presets/ronin_splash.rin b/archives/presets/ronin_splash.rin similarity index 100% rename from presets/ronin_splash.rin rename to archives/presets/ronin_splash.rin diff --git a/presets/rune.rin b/archives/presets/rune.rin similarity index 100% rename from presets/rune.rin rename to archives/presets/rune.rin diff --git a/presets/symmetry.rin b/archives/presets/symmetry.rin similarity index 100% rename from presets/symmetry.rin rename to archives/presets/symmetry.rin diff --git a/sources/scripts/core/command.js b/archives/scripts/core/command.js similarity index 100% rename from sources/scripts/core/command.js rename to archives/scripts/core/command.js diff --git a/sources/scripts/core/keyboard.js b/archives/scripts/core/keyboard.js similarity index 93% rename from sources/scripts/core/keyboard.js rename to archives/scripts/core/keyboard.js index 0f96cb6..40247f3 100644 --- a/sources/scripts/core/keyboard.js +++ b/archives/scripts/core/keyboard.js @@ -3,9 +3,6 @@ function Keyboard() this.shift_held = false; this.alt_held = false; - document.onkeyup = function myFunction(){ keyboard.listen_onkeyup(event); }; - document.onkeydown = function myFunction(){ keyboard.listen_onkeydown(event); }; - this.listen_onkeydown = function(event) { if(event.shiftKey == true){ diff --git a/sources/scripts/core/ronin.js b/archives/scripts/core/ronin.js similarity index 99% rename from sources/scripts/core/ronin.js rename to archives/scripts/core/ronin.js index 33b0116..f14bc4d 100644 --- a/sources/scripts/core/ronin.js +++ b/archives/scripts/core/ronin.js @@ -60,7 +60,7 @@ function Ronin() ronin.terminal.update(); ronin.widget.update(); ronin.terminal.input.focus(); - ronin.load(target_file); + // ronin.load(target_file); } this.hint = function(method) diff --git a/sources/scripts/filters/balance.js b/archives/scripts/filters/balance.js similarity index 100% rename from sources/scripts/filters/balance.js rename to archives/scripts/filters/balance.js diff --git a/sources/scripts/filters/chromatic.js b/archives/scripts/filters/chromatic.js similarity index 100% rename from sources/scripts/filters/chromatic.js rename to archives/scripts/filters/chromatic.js diff --git a/sources/scripts/filters/contrast.js b/archives/scripts/filters/contrast.js similarity index 100% rename from sources/scripts/filters/contrast.js rename to archives/scripts/filters/contrast.js diff --git a/sources/scripts/filters/filter.js b/archives/scripts/filters/filter.js similarity index 100% rename from sources/scripts/filters/filter.js rename to archives/scripts/filters/filter.js diff --git a/sources/scripts/filters/grey.js b/archives/scripts/filters/grey.js similarity index 100% rename from sources/scripts/filters/grey.js rename to archives/scripts/filters/grey.js diff --git a/sources/scripts/filters/invert.js b/archives/scripts/filters/invert.js similarity index 100% rename from sources/scripts/filters/invert.js rename to archives/scripts/filters/invert.js diff --git a/sources/scripts/filters/saturate.js b/archives/scripts/filters/saturate.js similarity index 100% rename from sources/scripts/filters/saturate.js rename to archives/scripts/filters/saturate.js diff --git a/sources/scripts/filters/sharpen.js b/archives/scripts/filters/sharpen.js similarity index 100% rename from sources/scripts/filters/sharpen.js rename to archives/scripts/filters/sharpen.js diff --git a/sources/scripts/filters/stencil.js b/archives/scripts/filters/stencil.js similarity index 100% rename from sources/scripts/filters/stencil.js rename to archives/scripts/filters/stencil.js diff --git a/sources/scripts/modules/brush.js b/archives/scripts/modules/brush.js similarity index 100% rename from sources/scripts/modules/brush.js rename to archives/scripts/modules/brush.js diff --git a/sources/scripts/modules/brush.pointer.js b/archives/scripts/modules/brush.pointer.js similarity index 100% rename from sources/scripts/modules/brush.pointer.js rename to archives/scripts/modules/brush.pointer.js diff --git a/sources/scripts/modules/cursor.js b/archives/scripts/modules/cursor.js similarity index 100% rename from sources/scripts/modules/cursor.js rename to archives/scripts/modules/cursor.js diff --git a/sources/scripts/modules/default.js b/archives/scripts/modules/default.js similarity index 100% rename from sources/scripts/modules/default.js rename to archives/scripts/modules/default.js diff --git a/sources/scripts/modules/eye.js b/archives/scripts/modules/eye.js similarity index 100% rename from sources/scripts/modules/eye.js rename to archives/scripts/modules/eye.js diff --git a/sources/scripts/modules/frame.js b/archives/scripts/modules/frame.js similarity index 100% rename from sources/scripts/modules/frame.js rename to archives/scripts/modules/frame.js diff --git a/sources/scripts/modules/layer.js b/archives/scripts/modules/layer.js similarity index 100% rename from sources/scripts/modules/layer.js rename to archives/scripts/modules/layer.js diff --git a/sources/scripts/modules/magnet.js b/archives/scripts/modules/magnet.js similarity index 100% rename from sources/scripts/modules/magnet.js rename to archives/scripts/modules/magnet.js diff --git a/sources/scripts/modules/module.js b/archives/scripts/modules/module.js similarity index 100% rename from sources/scripts/modules/module.js rename to archives/scripts/modules/module.js diff --git a/sources/scripts/modules/overlay.js b/archives/scripts/modules/overlay.js similarity index 100% rename from sources/scripts/modules/overlay.js rename to archives/scripts/modules/overlay.js diff --git a/sources/scripts/modules/path.js b/archives/scripts/modules/path.js similarity index 100% rename from sources/scripts/modules/path.js rename to archives/scripts/modules/path.js diff --git a/sources/scripts/modules/render.js b/archives/scripts/modules/render.js similarity index 100% rename from sources/scripts/modules/render.js rename to archives/scripts/modules/render.js diff --git a/sources/scripts/modules/source.js b/archives/scripts/modules/source.js similarity index 100% rename from sources/scripts/modules/source.js rename to archives/scripts/modules/source.js diff --git a/sources/scripts/modules/terminal.js b/archives/scripts/modules/terminal.js similarity index 100% rename from sources/scripts/modules/terminal.js rename to archives/scripts/modules/terminal.js diff --git a/sources/scripts/modules/terminal.widget.js b/archives/scripts/modules/terminal.widget.js similarity index 100% rename from sources/scripts/modules/terminal.widget.js rename to archives/scripts/modules/terminal.widget.js diff --git a/sources/scripts/modules/type.js b/archives/scripts/modules/type.js similarity index 100% rename from sources/scripts/modules/type.js rename to archives/scripts/modules/type.js diff --git a/sources/scripts/units/angle.js b/archives/scripts/units/angle.js similarity index 100% rename from sources/scripts/units/angle.js rename to archives/scripts/units/angle.js diff --git a/sources/scripts/units/any.js b/archives/scripts/units/any.js similarity index 100% rename from sources/scripts/units/any.js rename to archives/scripts/units/any.js diff --git a/sources/scripts/units/bang.js b/archives/scripts/units/bang.js similarity index 100% rename from sources/scripts/units/bang.js rename to archives/scripts/units/bang.js diff --git a/sources/scripts/units/color.js b/archives/scripts/units/color.js similarity index 100% rename from sources/scripts/units/color.js rename to archives/scripts/units/color.js diff --git a/sources/scripts/units/filepath.js b/archives/scripts/units/filepath.js similarity index 100% rename from sources/scripts/units/filepath.js rename to archives/scripts/units/filepath.js diff --git a/sources/scripts/units/method.js b/archives/scripts/units/method.js similarity index 100% rename from sources/scripts/units/method.js rename to archives/scripts/units/method.js diff --git a/sources/scripts/units/mode.js b/archives/scripts/units/mode.js similarity index 100% rename from sources/scripts/units/mode.js rename to archives/scripts/units/mode.js diff --git a/sources/scripts/units/option.js b/archives/scripts/units/option.js similarity index 100% rename from sources/scripts/units/option.js rename to archives/scripts/units/option.js diff --git a/sources/scripts/units/position.js b/archives/scripts/units/position.js similarity index 100% rename from sources/scripts/units/position.js rename to archives/scripts/units/position.js diff --git a/sources/scripts/units/range.js b/archives/scripts/units/range.js similarity index 100% rename from sources/scripts/units/range.js rename to archives/scripts/units/range.js diff --git a/sources/scripts/units/rect.js b/archives/scripts/units/rect.js similarity index 100% rename from sources/scripts/units/rect.js rename to archives/scripts/units/rect.js diff --git a/sources/scripts/units/setting.js b/archives/scripts/units/setting.js similarity index 100% rename from sources/scripts/units/setting.js rename to archives/scripts/units/setting.js diff --git a/sources/scripts/units/unit.js b/archives/scripts/units/unit.js similarity index 100% rename from sources/scripts/units/unit.js rename to archives/scripts/units/unit.js diff --git a/sources/scripts/units/value.js b/archives/scripts/units/value.js similarity index 100% rename from sources/scripts/units/value.js rename to archives/scripts/units/value.js diff --git a/sources/index.html b/sources/index.html index 1dd3d17..5f14b02 100644 --- a/sources/index.html +++ b/sources/index.html @@ -1,52 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + @@ -54,16 +14,9 @@ Ronin -
-
-
-
-
diff --git a/sources/links/main.css b/sources/links/main.css index 997b8f9..4e15a59 100644 --- a/sources/links/main.css +++ b/sources/links/main.css @@ -1,42 +1,8 @@ body { margin:0px; padding:0px; overflow:hidden; font-family:"input_mono_medium",courier,monospace;} *:focus {outline: none; } -#ronin { background:#ddd; width:100%; height:100%; overflow:hidden; background-image:url(../media/graphics/grid.svg); background-position: 0px 0px;} -#frame { width:50vw; height:50vh; overflow:hidden; position:fixed; left: calc(40vw + 15px); top:100px; background-image:url(../media/graphics/void.svg); background-position:0px 0px; } -#frame > .layer { position:absolute; top:0px; left:0px; width:100%; height:100%;} +yu { display:block; } -@keyframes blink { 0% {opacity: 1;} 50% {opacity: 0;} 100% {opacity: 1;} } - -#frame > .layer.blink { animation: blink 0.1s; animation-iteration-count: infinite; } -#overlay { position:absolute; z-index:1000;} -#frame { cursor:none;} - -#terminal { position: fixed;bottom: 0px;left: 0px;background: #111;width: 100vw;height: 60px;overflow: hidden; color:#999;} - -#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 { z-index: 9000; color:#999; font-family: 'input_mono_regular'} -#terminal input:focus { color:#fff; } - -#terminal #logs { position:fixed; bottom:30px; border-bottom:1px solid #222; } -#terminal #logs .module { font-family: 'input_mono_regular'; color:#ccc; } - -#terminal #widget { text-align: right; bottom:30px} -#terminal #widget .mouse { color:white; } - -span.autocomplete { background:white; color:black; } - -span.module { display: inline-block; color:#999; } -span.method { display: inline-block; color:#999; } -span.method .name { color:#fff; } -span.method .options { color:#555; } -span.params { display: inline-block; color:#999; } -span.setting { display: inline-block; color:#fff; } -span.setting .value { color:#999; } -span.mode { color:#999; } -span.mode .name { text-decoration: underline; color:white; } - -#modal { position: fixed; bottom:80px; right:20px; height:100px; border-radius:3px; overflow:hidden; display: block} -#modal.text { display: block;background: #000;width: calc(100vw - 100px);height: calc(100vh - 160px);padding: 30px;font-size: 12px;white-space: pre;column-count: 3;line-height: 20px;color:white} -#modal.image img { display: block; max-height: 100%; width:inherit;} -#modal.hidden { display: none } \ No newline at end of file +#ronin { background:#444; height: 100vh; width:100vw; } +#commander { position: fixed; bottom:0px; left:0px; width:100vw; height:30px; line-height: 30px; -webkit-user-select: none;-webkit-app-region: drag; } +#commander input { background: transparent;width: calc(100vw - 30px);padding: 0px 15px;display: block;line-height: 30px;font-size: 11px;color: white; margin-left:30px; } diff --git a/sources/scripts/commander.js b/sources/scripts/commander.js new file mode 100644 index 0000000..7b9cad2 --- /dev/null +++ b/sources/scripts/commander.js @@ -0,0 +1,20 @@ +function Commander() +{ + this.el = document.createElement('yu'); + this.el.id = "commander"; + this.input_el = document.createElement('input'); + this.input_el.value = "rescale s:0.5 rect:300x300"; + + this.install = function() + { + this.el.appendChild(this.input_el); + ronin.el.appendChild(this.el); + this.input_el.focus(); + } + + this.validate = function(query_str = ronin.commander.input_el.value) + { + var q = new Query(query_str); + console.log(q); + } +} \ No newline at end of file diff --git a/sources/scripts/cursor.js b/sources/scripts/cursor.js new file mode 100644 index 0000000..440c484 --- /dev/null +++ b/sources/scripts/cursor.js @@ -0,0 +1,37 @@ +function Cursor(rune) +{ + this.is_down = false; + + this.mouse_down = function(e) + { + e.preventDefault(); + + ronin.cursor.is_down = true; + + var ctx = ronin.render.context(); + ctx.beginPath(); + ctx.rect(e.clientX * 2, e.clientY * 2, 5, 5); + ctx.fillStyle = "red"; + ctx.fill(); + } + + this.mouse_move = function(e) + { + e.preventDefault(); + + if(!ronin.cursor.is_down){ return; } + + var ctx = ronin.render.context(); + ctx.beginPath(); + ctx.rect(e.clientX * 2, e.clientY * 2, 5, 5); + ctx.fillStyle = "red"; + ctx.fill(); + } + + this.mouse_up = function(e) + { + e.preventDefault(); + + ronin.cursor.is_down = false; + } +} \ No newline at end of file diff --git a/sources/scripts/io.js b/sources/scripts/io.js new file mode 100644 index 0000000..d9b4330 --- /dev/null +++ b/sources/scripts/io.js @@ -0,0 +1,34 @@ +function IO() +{ + this.drag_over = function(e) + { + e.stopPropagation(); + e.preventDefault(); + e.dataTransfer.dropEffect = 'copy'; + } + + this.drop = function(e) + { + e.stopPropagation(); + e.preventDefault(); + var files = e.dataTransfer.files; + var file = files[0]; + + if (!file.type.match(/image.*/)) { console.log("Not image"); return false; } + + var reader = new FileReader(); + + reader.onload = function(event) + { + base_image = new Image(); + base_image.src = event.target.result; + + var width = base_image.naturalWidth; + var height = base_image.naturalHeight; + + ronin.resize_to({width:width * 0.5,height:height * 0.5}); + ronin.render.context().drawImage(base_image, 0,0,width,height); + } + reader.readAsDataURL(file); + } +} \ No newline at end of file diff --git a/sources/scripts/keyboard.js b/sources/scripts/keyboard.js new file mode 100644 index 0000000..48eb866 --- /dev/null +++ b/sources/scripts/keyboard.js @@ -0,0 +1,14 @@ +function Keyboard() +{ + this.key_up = function() + { + + } + + this.key_down = function(e) + { + if(e.key == "Enter"){ + ronin.commander.validate(); + } + } +} \ No newline at end of file diff --git a/sources/scripts/query.js b/sources/scripts/query.js new file mode 100644 index 0000000..e7c7e06 --- /dev/null +++ b/sources/scripts/query.js @@ -0,0 +1,12 @@ +function Query(query_str) +{ + this.method_name = query_str.split(" ")[0]; + var parts = query_str.split(" ").splice(1); + this.parameters = {}; + for(part_id in parts){ + var part = parts[part_id]; + var key = part.indexOf(":") > -1 ? part.split(":")[0] : "any"; + var value = part.indexOf(":") > -1 ? part.split(":")[1] : part; + this.parameters[key] = value; + } +} \ No newline at end of file diff --git a/sources/scripts/render.js b/sources/scripts/render.js new file mode 100644 index 0000000..69f8591 --- /dev/null +++ b/sources/scripts/render.js @@ -0,0 +1,30 @@ +function Render() +{ + this.el = document.createElement('canvas'); + + this.install = function() + { + ronin.el.appendChild(this.el); + } + + this.update = function() + { + this.el.width = window.innerWidth * 2; + this.el.height = window.innerHeight * 2; + this.el.style.width = (window.innerWidth)+"px"; + this.el.style.height = (window.innerHeight)+"px"; + } + + this.context = function() + { + return this.el.getContext('2d'); + } + + this.resize_to = function(size) + { + this.el.width = size.width * 2; + this.el.height = size.height * 2; + this.el.style.width = size.width+"px"; + this.el.style.height = size.height+"px"; + } +} \ No newline at end of file diff --git a/sources/scripts/ronin.js b/sources/scripts/ronin.js new file mode 100644 index 0000000..2d8caba --- /dev/null +++ b/sources/scripts/ronin.js @@ -0,0 +1,43 @@ +function Ronin() +{ + this.el = document.createElement('yu'); + this.el.id = "ronin"; + + this.io = new IO(); + this.keyboard = new Keyboard(); + this.commander = new Commander(); + this.cursor = new Cursor(); + this.render = new Render(); + + this.install = function() + { + document.body.appendChild(this.el); + + this.render.install(); + this.commander.install(); + + this.start(); + } + + this.start = function() + { + window.addEventListener('dragover', ronin.io.drag_over); + window.addEventListener('drop', ronin.io.drop); + ronin.render.el.addEventListener('mousedown', ronin.cursor.mouse_down); + ronin.render.el.addEventListener('mousemove', ronin.cursor.mouse_move); + ronin.render.el.addEventListener('mouseup', ronin.cursor.mouse_up); + + window.addEventListener('keydown', ronin.keyboard.key_down); + + console.log("Ronin","Started"); + this.render.update(); + } + + this.resize_to = function(size) + { + const {dialog,app} = require('electron').remote; + var win = require('electron').remote.getCurrentWindow(); + win.setSize(size.width,size.height); + this.render.resize_to(size); + } +} \ No newline at end of file