2025-07-15 17:33:12 -06:00
|
|
|
// gui object classes?
|
|
|
|
|
// Why am I doing this?
|
|
|
|
|
class auxillery_dialog {
|
|
|
|
|
constructor (title) {
|
2025-07-21 15:52:20 -06:00
|
|
|
var me = this;
|
2025-07-15 17:33:12 -06:00
|
|
|
this.root = document.createElement("div");
|
2025-07-21 15:52:20 -06:00
|
|
|
this.root.classList.add("dialog");
|
2025-07-15 17:33:12 -06:00
|
|
|
this.title = "string" == typeof title ? title : "";
|
|
|
|
|
var title_bar = document.createElement("div");
|
2025-08-12 16:08:02 -06:00
|
|
|
title_bar.classList.add("title_bar");
|
|
|
|
|
var titleText = document.createElement("span");
|
|
|
|
|
titleText.innerText = this.title;
|
|
|
|
|
titleText.classList.add("title_text");
|
|
|
|
|
title_bar.appendChild(titleText);
|
2025-07-15 17:33:12 -06:00
|
|
|
this.root.appendChild(title_bar);
|
|
|
|
|
this.body = document.createElement("div");
|
2025-07-21 15:52:20 -06:00
|
|
|
this.root.appendChild(me.body);
|
|
|
|
|
var close = document.createElement("span");
|
|
|
|
|
close.innerText = "<";
|
|
|
|
|
close.classList.add("close");
|
|
|
|
|
title_bar.appendChild(close);
|
|
|
|
|
close.addEventListener("click", ()=>{
|
|
|
|
|
me.root.classList.remove("focused");
|
|
|
|
|
});
|
2025-07-15 17:33:12 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-07 16:09:29 -06:00
|
|
|
// Initialize gui
|
|
|
|
|
|
|
|
|
|
window.app = {};
|
|
|
|
|
app.gui = {};
|
|
|
|
|
app.gui.main = document.createElement("div");
|
|
|
|
|
app.gui.main.id = "root";
|
|
|
|
|
document.body.appendChild(app.gui.main);
|
|
|
|
|
app.gui.menu = document.createElement("nav");
|
|
|
|
|
app.gui.menu.id = "navigation";
|
|
|
|
|
app.gui.main.appendChild(app.gui.menu);
|
|
|
|
|
app.gui.view = document.createElement("div");
|
|
|
|
|
app.gui.view.id = "view";
|
|
|
|
|
app.gui.main.appendChild(app.gui.view);
|
|
|
|
|
// Library popup
|
2025-07-15 17:33:12 -06:00
|
|
|
app.gui.library = new auxillery_dialog("Library");
|
2025-08-12 16:08:02 -06:00
|
|
|
app.gui.library.body.classList.add("library_body");
|
|
|
|
|
app.gui.main.append(app.gui.library.root);
|
2025-07-15 17:33:12 -06:00
|
|
|
// Options popup
|
|
|
|
|
app.gui.options = new auxillery_dialog("Options");
|
2025-07-07 16:09:29 -06:00
|
|
|
// pre-populate grid with emptys
|
|
|
|
|
for (var x = 0; x < 16; x++) {
|
|
|
|
|
var name = "pec"+x;
|
2025-08-12 16:08:02 -06:00
|
|
|
var thisPec = document.createElement("span");
|
|
|
|
|
app.gui[name] = thisPec;
|
|
|
|
|
thisPec.classList.add("pecSlot");
|
|
|
|
|
thisPec.id = name;
|
|
|
|
|
clearPec(x);
|
2025-07-07 16:09:29 -06:00
|
|
|
app.gui.view.appendChild(thisPec);
|
2025-07-21 15:52:20 -06:00
|
|
|
thisPec.addEventListener("click", (p,x)=>{
|
|
|
|
|
app.currentPec = p;
|
|
|
|
|
app.currentPecIndex = x;
|
|
|
|
|
app.gui.library.root.classList.add("focused");
|
|
|
|
|
}, thisPec, x);
|
2025-07-07 16:09:29 -06:00
|
|
|
}
|
|
|
|
|
|