From ab983cbcb7a374ccb945bfe81413b804ef03b7ac Mon Sep 17 00:00:00 2001 From: Benno Waldhauer Date: Sat, 9 Nov 2024 10:39:09 +0100 Subject: [PATCH] generate gui from dedicated .html file --- examples/CMakeLists.txt | 8 + examples/gui-html.hpp | 7 +- examples/gui-html.hpp.in | 9 + examples/gui.html | 394 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 415 insertions(+), 3 deletions(-) create mode 100644 examples/gui-html.hpp.in create mode 100644 examples/gui.html diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c899f12..9826dbb 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,11 @@ +message(STATUS "Generate gui-html.hpp using gui.html content") +set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/gui.html) +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/gui.html" GUI_HTML_CONTENT) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/gui-html.hpp.in" + "${CMAKE_CURRENT_SOURCE_DIR}/gui-html.hpp" +) + set(LIBS_FOR_EXAMPLES ${LIBUSOCKETS_STATIC} nlohmann_json::nlohmann_json diff --git a/examples/gui-html.hpp b/examples/gui-html.hpp index dfd1d9e..f35503c 100644 --- a/examples/gui-html.hpp +++ b/examples/gui-html.hpp @@ -2,10 +2,11 @@ // SPDX-FileCopyrightText: 2023-present Benno Waldhauer // SPDX-License-Identifier: MIT +// This is a CMake generated file. DO NOT EDIT. + #pragma once -constexpr char gui_html[] = R"""( - +constexpr char gui_html[] = R"""( Slot Machine GUI @@ -399,4 +400,4 @@ constexpr char gui_html[] = R"""( -)"""; \ No newline at end of file +)"""; diff --git a/examples/gui-html.hpp.in b/examples/gui-html.hpp.in new file mode 100644 index 0000000..6fe0dcf --- /dev/null +++ b/examples/gui-html.hpp.in @@ -0,0 +1,9 @@ +// Webthing-CPP +// SPDX-FileCopyrightText: 2023-present Benno Waldhauer +// SPDX-License-Identifier: MIT + +// This is a CMake generated file. DO NOT EDIT. + +#pragma once + +constexpr char gui_html[] = R"""(@GUI_HTML_CONTENT@)"""; \ No newline at end of file diff --git a/examples/gui.html b/examples/gui.html new file mode 100644 index 0000000..bcc7272 --- /dev/null +++ b/examples/gui.html @@ -0,0 +1,394 @@ + + + + Slot Machine GUI + + + + + + +
+
+

Slot Machine

+
+ + + +
+
+
+

Flush of ... 16€

+

Flush of ... 12€

+

Flush of ♠ .... 8€

+

Flush of ♣ .... 4€

+
+
+ Drop a coin here or hit
'space' to start a game +
+
+
+
+
+ +