From 624c58efc31ed81b250738588218532249e04b82 Mon Sep 17 00:00:00 2001 From: tovjemam Date: Sat, 14 Mar 2026 22:07:40 +0100 Subject: [PATCH] Make web login form functional --- CMakeLists.txt | 2 ++ shell.html | 58 ++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 54 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b82dd48..10e1d28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -219,6 +219,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL Emscripten) "-sUSE_WEBGL2=1" "-sNO_DISABLE_EXCEPTION_CATCHING=1" "-sALLOW_MEMORY_GROWTH=1" + "-sEXPORTED_FUNCTIONS=_RunMain,_SetName,_SetUrl" + "-sEXPORTED_RUNTIME_METHODS=ccall,cwrap" "--shell-file" "${CMAKE_SOURCE_DIR}/shell.html" "--preload-file" "${CMAKE_SOURCE_DIR}/assets/@/" ) diff --git a/shell.html b/shell.html index 810e936..4ce807e 100644 --- a/shell.html +++ b/shell.html @@ -15,6 +15,8 @@ height: 100%; background: black; color: aqua; + font-family: Verdana, Geneva, Tahoma, sans-serif; + text-align: center; } canvas { @@ -22,6 +24,28 @@ width: 100vw; height: 100vh; } + + #vyplnitmeno{ + font-size: 100pt; + color: red; + font-weight: bold; + margin: 0; + margin-bottom: 100px; + } + + #okbut + { + font-size: 20pt; + font-weight: bold; + padding: 10pt; + margin: 10pt; + } + + #name, #url + { + font-size: 150%; + margin: 10pt; + } @@ -32,9 +56,11 @@

fekální gtačko

- kdo
- kam
- + kdo
+ + + kam
+
@@ -76,14 +102,34 @@ const name = document.getElementById("name").value; const url = document.getElementById("url").value; - Module.ccall("SetName", name); - Module.ccall("SetUrl", url); + if (name == "") { + document.getElementById("vyplnitmeno").style = ""; + return; + } + + localStorage.setItem("fg_name", name); + localStorage.setItem("fg_url", url); + + Module.ccall("SetName", null, ["string"], [name]); + Module.ccall("SetUrl", null, ["string"], [url]); document.getElementById("loginform").style = "display:none"; document.getElementById("canvas").style = ""; - Module.ccall("RunMain"); + Module.ccall("RunMain", null, [], []); } + + function loadConfig() + { + const saved_name = localStorage.getItem("fg_name"); + const saved_url = localStorage.getItem("fg_url"); + if (saved_name != null) + document.getElementById("name").value = saved_name; + if (saved_url != null) + document.getElementById("url").value = saved_url; + } + + loadConfig(); {{{ SCRIPT }}}