Adding config. Goal: Basic hello world with cube template.
This commit is contained in:
parent
b8b17d07ae
commit
9745112ccd
@ -84,15 +84,17 @@ local function setupWindows()
|
|||||||
desktop[0].left = 0
|
desktop[0].left = 0
|
||||||
desktop[0].right = (r-l)/2
|
desktop[0].right = (r-l)/2
|
||||||
browserhwnd = SetupBrowser(desktop)
|
browserhwnd = SetupBrowser(desktop)
|
||||||
|
sleep(100) -- Let things setup (window pos etc)
|
||||||
|
|
||||||
desktop[0].left = (r-l)/2
|
desktop[0].left = (r-l)/2
|
||||||
desktop[0].right = r
|
desktop[0].right = r
|
||||||
sokolhwnd = SetupSokolLuajit(desktop)
|
sokolhwnd = SetupSokolLuajit(desktop)
|
||||||
|
sleep(100) -- Let things setup (window pos etc)
|
||||||
end
|
end
|
||||||
|
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
setupWindows()
|
setupWindows()
|
||||||
sleep(100) -- Let things setup (window pos etc)
|
|
||||||
while true do
|
while true do
|
||||||
if(user32.IsWindow(browserhwnd) == 0) then break end
|
if(user32.IsWindow(browserhwnd) == 0) then break end
|
||||||
if(user32.IsWindow(sokolhwnd) == 0) then break end
|
if(user32.IsWindow(sokolhwnd) == 0) then break end
|
||||||
@ -105,5 +107,5 @@ end
|
|||||||
if(sokolhwnd) then
|
if(sokolhwnd) then
|
||||||
user32.SendMessageA(sokolhwnd, ffi.C.WM_CLOSE, 0, 0)
|
user32.SendMessageA(sokolhwnd, ffi.C.WM_CLOSE, 0, 0)
|
||||||
end
|
end
|
||||||
print("Exited")
|
print("Editor Exited.")
|
||||||
------------------------------------------------------------------------------------------------------------
|
------------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,142 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<title>Sokol-LuaJIT Editor</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.0/dist/jsoneditor.min.css" rel="stylesheet" />
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: sans-serif;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tabs {
|
|
||||||
display: flex;
|
|
||||||
background: #333;
|
|
||||||
color: white;
|
|
||||||
padding: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab {
|
|
||||||
margin-right: 1rem;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab.active {
|
|
||||||
font-weight: bold;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-content {
|
|
||||||
display: none;
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tab-content.active {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
#editor { height: 400px; border: 1px solid #ccc; }
|
|
||||||
#rete { height: 400px; border: 1px solid #ccc; background: #f8f8f8; }
|
|
||||||
#jsoneditor { height: 400px; border: 1px solid #ccc; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div id="tabs">
|
|
||||||
<div class="tab active" data-tab="scripts">Scripts</div>
|
|
||||||
<div class="tab" data-tab="flow">Flow</div>
|
|
||||||
<div class="tab" data-tab="data">Data</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tab-scripts" class="tab-content active">
|
|
||||||
<h2>Lua Script Editor</h2>
|
|
||||||
<div id="editor"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tab-flow" class="tab-content">
|
|
||||||
<h2>State Flow Editor</h2>
|
|
||||||
<div id="rete"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="tab-data" class="tab-content">
|
|
||||||
<h2>Data Manager</h2>
|
|
||||||
<div id="jsoneditor"></div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- JS Dependencies -->
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/mode/lua/lua.js"></script>
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/codemirror@5.65.16/lib/codemirror.css" />
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/rete@1.4.4/build/rete.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jsoneditor@9.10.0/dist/jsoneditor.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/cbor-js@0.1.0/cbor.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Tabs
|
|
||||||
document.querySelectorAll(".tab").forEach(tab => {
|
|
||||||
tab.addEventListener("click", () => {
|
|
||||||
document.querySelectorAll(".tab").forEach(t => t.classList.remove("active"));
|
|
||||||
document.querySelectorAll(".tab-content").forEach(c => c.classList.remove("active"));
|
|
||||||
|
|
||||||
tab.classList.add("active");
|
|
||||||
document.getElementById("tab-" + tab.dataset.tab).classList.add("active");
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// CodeMirror - Lua Editor
|
|
||||||
const editor = CodeMirror(document.getElementById("editor"), {
|
|
||||||
mode: "lua",
|
|
||||||
lineNumbers: true,
|
|
||||||
value: "-- Write Lua code here\nfunction update()\n print(\"Hello from Lua!\")\nend",
|
|
||||||
});
|
|
||||||
|
|
||||||
// Rete.js - Simple Flow Diagram
|
|
||||||
async function setupRete() {
|
|
||||||
const container = document.getElementById('rete');
|
|
||||||
const components = [];
|
|
||||||
|
|
||||||
const editor = new Rete.NodeEditor('demo@0.1.0', container);
|
|
||||||
editor.use(ConnectionPlugin);
|
|
||||||
editor.use(VueRenderPlugin); // Only needed if you use Vue-based components
|
|
||||||
|
|
||||||
editor.view.resize();
|
|
||||||
editor.trigger('process');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: In this simple version, we're skipping complex node setup
|
|
||||||
document.getElementById("tab-flow").addEventListener("click", () => {
|
|
||||||
// Placeholder flow content
|
|
||||||
document.getElementById("rete").innerHTML = "<p>(Flow Editor Placeholder)</p>";
|
|
||||||
});
|
|
||||||
|
|
||||||
// JSONEditor - CBOR Compatible Editor
|
|
||||||
const container = document.getElementById("jsoneditor");
|
|
||||||
const editorData = new JSONEditor(container, {
|
|
||||||
mode: "tree",
|
|
||||||
modes: ["code", "tree"], // allow switching
|
|
||||||
});
|
|
||||||
|
|
||||||
// Sample JS object (could be CBOR-decoded)
|
|
||||||
const sampleData = {
|
|
||||||
name: "Player",
|
|
||||||
health: 100,
|
|
||||||
inventory: ["sword", "potion"],
|
|
||||||
stats: {
|
|
||||||
strength: 10,
|
|
||||||
agility: 8
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
editorData.set(sampleData);
|
|
||||||
|
|
||||||
// Encode/decode CBOR (example usage)
|
|
||||||
const encoded = CBOR.encode(sampleData);
|
|
||||||
const decoded = CBOR.decode(encoded);
|
|
||||||
console.log("CBOR roundtrip:", decoded);
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
65
editor/www/partials/config_project.html
Normal file
65
editor/www/partials/config_project.html
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
{% include "/partials/page_header.html" with { page_title: 'Project' } %}
|
||||||
|
|
||||||
|
<!-- /.row -->
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-12">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading">
|
||||||
|
Project Setup
|
||||||
|
</div>
|
||||||
|
<!-- /.panel-heading -->
|
||||||
|
<div class="panel-body">
|
||||||
|
<!-- Nav tabs -->
|
||||||
|
<ul class="nav nav-tabs">
|
||||||
|
<li class="active"><a href="#info" data-toggle="tab">Info</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#paths" data-toggle="tab">Paths</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#meta" data-toggle="tab">Meta</a>
|
||||||
|
</li>
|
||||||
|
<li><a href="#settings" data-toggle="tab">Settings</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<!-- Tab panes -->
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade in active" id="info">
|
||||||
|
<h4>Home Tab</h4>
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||||
|
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||||
|
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||||
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="paths">
|
||||||
|
<h4>Profile Tab</h4>
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||||
|
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||||
|
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||||
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="meta">
|
||||||
|
<h4>Messages Tab</h4>
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||||
|
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||||
|
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||||
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane fade" id="settings">
|
||||||
|
<h4>Settings Tab</h4>
|
||||||
|
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut
|
||||||
|
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
|
||||||
|
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||||
|
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
||||||
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.panel-body -->
|
||||||
|
</div>
|
||||||
|
<!-- /.panel -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
69
editor/www/partials/config_project_js.html
Normal file
69
editor/www/partials/config_project_js.html
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<!-- DataTables JavaScript -->
|
||||||
|
<script src="../js/dataTables/jquery.dataTables.min.js"></script>
|
||||||
|
<script src="../js/dataTables/dataTables.bootstrap.min.js"></script>
|
||||||
|
|
||||||
|
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function clickElem(elem) {
|
||||||
|
// Thx user1601638 on Stack Overflow (6/6/2018 - https://stackoverflow.com/questions/13405129/javascript-create-and-save-file )
|
||||||
|
var eventMouse = document.createEvent("MouseEvents")
|
||||||
|
eventMouse.initMouseEvent("click", true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
|
||||||
|
elem.dispatchEvent(eventMouse)
|
||||||
|
}
|
||||||
|
|
||||||
|
function openFile(func) {
|
||||||
|
readFile = function(e) {
|
||||||
|
var file = e.target.files[0];
|
||||||
|
if (!file) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileobj = URL.createObjectURL(file);
|
||||||
|
console.log(fileobj);
|
||||||
|
var reader = new FileReader();
|
||||||
|
reader.onload = function(e) {
|
||||||
|
var jdata = { filename: file.name, filesize: file.size, data: e.target.result };
|
||||||
|
fileInput.func(jdata);
|
||||||
|
document.body.removeChild(fileInput)
|
||||||
|
}
|
||||||
|
reader.readAsBinaryString(file)
|
||||||
|
console.log(e.target.files);
|
||||||
|
}
|
||||||
|
fileInput = document.createElement("input")
|
||||||
|
fileInput.type='file'
|
||||||
|
fileInput.style.display='none'
|
||||||
|
fileInput.onchange=readFile
|
||||||
|
fileInput.func=func
|
||||||
|
document.body.appendChild(fileInput)
|
||||||
|
clickElem(fileInput)
|
||||||
|
}
|
||||||
|
|
||||||
|
function postData( url, data )
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: url,
|
||||||
|
data: data,
|
||||||
|
success: function(data) { console.log("Posted data"); },
|
||||||
|
contentType: "application/json",
|
||||||
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$('#openAsset').on("click", function(evt){
|
||||||
|
openFile(function( data ) {
|
||||||
|
var pdata = JSON.stringify(data);
|
||||||
|
console.log(pdata);
|
||||||
|
postData("/world/assets/loaddata", pdata );
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#dataTables-example').DataTable({
|
||||||
|
responsive: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<!-- Navigation -->
|
<!-- Navigation -->
|
||||||
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<a class="navbar-brand" href="index.html">Startmin</a>
|
<a class="navbar-brand" href="index.html">Thunc</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user