マニュアルウィンドウ(内容は作成中)
守矢諏訪子 <suwako@076.moe>、2026-06-26 06:00
コミット ee9e101ca9f31163912150fdb00a3d26e2d80e66
・親 726e4bf
・ファイルを見る
10個のファイル、+157 -23
| @@ -0,0 +1,4 @@ | ||
| 1 | +#pragma once | |
| 2 | + | |
| 3 | +#include <database/setup.hh> | |
| 4 | +#include <database/shaderdata.hh> |
| @@ -0,0 +1,10 @@ | ||
| 1 | +#pragma once | |
| 2 | + | |
| 3 | +#include <gui/guiengine.hh> | |
| 4 | +#include <gui/titlebar.hh> | |
| 5 | +#include <gui/editor.hh> | |
| 6 | +#include <gui/viewport.hh> | |
| 7 | +#include <gui/about.hh> | |
| 8 | +#include <gui/consolelog.hh> | |
| 9 | +#include <gui/manual.hh> | |
| 10 | +// #include <gui/settings.hh> |
| @@ -1,6 +1,15 @@ | ||
| 1 | 1 | #pragma once |
| 2 | 2 | |
| 3 | 3 | #include <util/types.hh> |
| 4 | +#include <util/structs.hh> | |
| 4 | 5 | |
| 5 | 6 | namespace gui { |
| 7 | + class Manual { | |
| 8 | + public: | |
| 9 | + void Draw(GlfwInfo &glfw); | |
| 10 | + | |
| 11 | + private: | |
| 12 | + void renderMarkdown(cstr text); | |
| 13 | + string m_CurPage = "index"; | |
| 14 | + }; // class Manual | |
| 6 | 15 | } // namespace gui |
| @@ -0,0 +1,3 @@ | ||
| 1 | +#pragma once | |
| 2 | + | |
| 3 | +#include <lua/luaengine.hh> |
| @@ -0,0 +1,4 @@ | ||
| 1 | +#pragma once | |
| 2 | + | |
| 3 | +#include <shader/shader.hh> | |
| 4 | +#include <shader/buffers.hh> |
| @@ -0,0 +1,9 @@ | ||
| 1 | +#pragma once | |
| 2 | + | |
| 3 | +#include <util/glfwpp.hh> | |
| 4 | +#include <util/types.hh> | |
| 5 | +#include <util/vector.hh> | |
| 6 | +#include <util/sqlite.hh> | |
| 7 | +#include <util/structs.hh> | |
| 8 | +#include <util/random.hh> | |
| 9 | +// #include <util/file.hh> |
| @@ -45,6 +45,8 @@ | ||
| 45 | 45 | |
| 46 | 46 | bool isRunning = true; |
| 47 | 47 | bool isAbout = false; |
| 48 | + bool isManual = false; | |
| 49 | + bool isSettings = false; | |
| 48 | 50 | |
| 49 | 51 | std::string version = version::full; |
| 50 | 52 |
変更
main.cc
| @@ -33,25 +33,13 @@ | ||
| 33 | 33 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 34 | 34 | */ |
| 35 | 35 | #include <glad/glad.h> |
| 36 | -#include <util/glfwpp.hh> | |
| 37 | -#include <iostream> | |
| 36 | +#include <util.hh> | |
| 37 | +#include <shader.hh> | |
| 38 | +#include <database.hh> | |
| 39 | +#include <lua.hh> | |
| 40 | +#include <gui.hh> | |
| 38 | 41 | #include <version.hh> |
| 39 | -#include <util/types.hh> | |
| 40 | -#include <util/vector.hh> | |
| 41 | -#include <util/sqlite.hh> | |
| 42 | -#include <util/structs.hh> | |
| 43 | -#include <util/random.hh> | |
| 44 | -#include <shader/shader.hh> | |
| 45 | -#include <shader/buffers.hh> | |
| 46 | -#include <database/setup.hh> | |
| 47 | -#include <database/shaderdata.hh> | |
| 48 | -#include <lua/luaengine.hh> | |
| 49 | -#include <gui/guiengine.hh> | |
| 50 | -#include <gui/titlebar.hh> | |
| 51 | -#include <gui/editor.hh> | |
| 52 | -#include <gui/viewport.hh> | |
| 53 | -#include <gui/about.hh> | |
| 54 | -#include <gui/consolelog.hh> | |
| 42 | +#include <iostream> | |
| 55 | 43 | |
| 56 | 44 | #include <imgui.h> |
| 57 | 45 | #include <backends/imgui_impl_glfw.h> |
| @@ -85,7 +73,7 @@ | ||
| 85 | 73 | window.MakeContextCurrent(); |
| 86 | 74 | glfw.SwapInterval(1); |
| 87 | 75 | |
| 88 | - GlfwInfo glfwInfo = { &glfw, &window, true, false }; | |
| 76 | + GlfwInfo glfwInfo = { &glfw, &window, true, false, false, false }; | |
| 89 | 77 | |
| 90 | 78 | #ifndef PRODUCTION_BUILD |
| 91 | 79 | bool showDemo = true; |
| @@ -119,6 +107,9 @@ | ||
| 119 | 107 | gui::ViewPort viewport; |
| 120 | 108 | viewport.Init(); |
| 121 | 109 | |
| 110 | + // マニュアル | |
| 111 | + gui::Manual manual; | |
| 112 | + | |
| 122 | 113 | // データベースからシェーダーとLuaコードの受け取り |
| 123 | 114 | vector<db::ShaderData> codeMap = db::GetAllShaders(db); |
| 124 | 115 | u32 shaderId; |
| @@ -281,17 +272,27 @@ | ||
| 281 | 272 | |
| 282 | 273 | glfw.PollEvents(); |
| 283 | 274 | |
| 275 | + bool isManualKey = window.GetKey(GLFW_KEY_F1); | |
| 284 | 276 | bool isCompileKey = window.GetKey(GLFW_KEY_F5); |
| 285 | 277 | bool ctrlMod = (window.GetKey(GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || window.GetKey(GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS); |
| 286 | 278 | bool isSaveKey = (window.GetKey(GLFW_KEY_S) == GLFW_PRESS && ctrlMod); |
| 287 | 279 | bool isQuitKey = (window.GetKey(GLFW_KEY_Q) == GLFW_PRESS && ctrlMod); |
| 288 | 280 | bool isAboutKey = (window.GetKey(GLFW_KEY_H) == GLFW_PRESS && ctrlMod); |
| 281 | + bool isSettingsKey = (window.GetKey(GLFW_KEY_COMMA) == GLFW_PRESS && ctrlMod); | |
| 289 | 282 | |
| 290 | 283 | if (!isHold) { |
| 291 | 284 | if (isCompileKey) { |
| 292 | 285 | glfwInfo.compile(); |
| 293 | 286 | } |
| 294 | 287 | |
| 288 | + if (isManualKey) { | |
| 289 | + glfwInfo.isManual = true; | |
| 290 | + } | |
| 291 | + | |
| 292 | + if (isSettingsKey) { | |
| 293 | + glfwInfo.isSettings = true; | |
| 294 | + } | |
| 295 | + | |
| 295 | 296 | if (isAboutKey) { |
| 296 | 297 | glfwInfo.isAbout = true; |
| 297 | 298 | } |
| @@ -305,7 +306,7 @@ | ||
| 305 | 306 | } |
| 306 | 307 | } |
| 307 | 308 | |
| 308 | - isHold = isSaveKey || isCompileKey || isAboutKey || isQuitKey; | |
| 309 | + isHold = isSaveKey || isCompileKey || isAboutKey || isQuitKey || isManualKey || isSettingsKey; | |
| 309 | 310 | |
| 310 | 311 | if (window.GetAttrib(glfwpp::Attributes::Iconified) != 0) { |
| 311 | 312 | ImGui_ImplGlfw_Sleep(10); |
| @@ -323,6 +324,7 @@ | ||
| 323 | 324 | luaEditor.Render(); |
| 324 | 325 | cmd.Draw(); |
| 325 | 326 | about.Draw(glfwInfo); |
| 327 | + manual.Draw(glfwInfo); | |
| 326 | 328 | |
| 327 | 329 | viewport.Draw(glfwInfo); |
| 328 | 330 |
| @@ -1,4 +1,91 @@ | ||
| 1 | 1 | #include <gui/manual.hh> |
| 2 | +#include <imgui.h> | |
| 2 | 3 | |
| 3 | 4 | namespace gui { |
| 5 | + | |
| 6 | + void Manual::Draw(GlfwInfo &glfw) { | |
| 7 | + if (!glfw.isManual) return; | |
| 8 | + | |
| 9 | + ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse; | |
| 10 | + | |
| 11 | + ImGui::SetNextWindowSize({ 600, 700 }, ImGuiCond_Appearing); | |
| 12 | + ImGui::Begin("マニュアル", &glfw.isManual, flags); | |
| 13 | + | |
| 14 | + if (ImGui::BeginTabBar("ManualTabs")) { | |
| 15 | + if (ImGui::BeginTabItem("概要")) { | |
| 16 | + m_CurPage = "index"; | |
| 17 | + ImGui::EndTabItem(); | |
| 18 | + } | |
| 19 | + | |
| 20 | + if (ImGui::BeginTabItem("シューだー")) { | |
| 21 | + m_CurPage = "shader"; | |
| 22 | + ImGui::EndTabItem(); | |
| 23 | + } | |
| 24 | + | |
| 25 | + if (ImGui::BeginTabItem("Luaエンジン")) { | |
| 26 | + m_CurPage = "lua"; | |
| 27 | + ImGui::EndTabItem(); | |
| 28 | + } | |
| 29 | + | |
| 30 | + if (ImGui::BeginTabItem("ホットキー")) { | |
| 31 | + m_CurPage = "hotkeys"; | |
| 32 | + ImGui::EndTabItem(); | |
| 33 | + } | |
| 34 | + | |
| 35 | + ImGui::EndTabBar(); | |
| 36 | + } | |
| 37 | + | |
| 38 | + ImGui::Separator(); | |
| 39 | + | |
| 40 | + ImGui::BeginChild("ManualContent", ImVec2(0, 0), 0, ImGuiWindowFlags_HorizontalScrollbar); | |
| 41 | + | |
| 42 | + if (m_CurPage == "index") { | |
| 43 | + ImGui::TextWrapped("Shader Playgroundへようこそ!"); | |
| 44 | + ImGui::Dummy(ImVec2(0, 10)); | |
| 45 | + renderMarkdown(R"(# 基本操作 | |
| 46 | + | |
| 47 | +- **コンパイル**: F5 又は「ビルド→コンパイル」 | |
| 48 | +- **保存**: Ctrl+s 又は「ファイル→保存」 | |
| 49 | +- 右側のパネルでシェーダーコードを編集出来ます | |
| 50 | +)"); | |
| 51 | + } else if (m_CurPage == "shader") { | |
| 52 | + ImGui::TextWrapped("Shader Playgroundへようこそ!"); | |
| 53 | + ImGui::Dummy(ImVec2(0, 10)); | |
| 54 | + renderMarkdown(R"(# 基本操作 | |
| 55 | + | |
| 56 | +- **コンパイル**: F5 又は「ビルド→コンパイル」 | |
| 57 | +- **保存**: Ctrl+s 又は「ファイル→保存」 | |
| 58 | +- 右側のパネルでシェーダーコードを編集出来ます | |
| 59 | +)"); | |
| 60 | + } else if (m_CurPage == "lua") { | |
| 61 | + ImGui::TextWrapped("Lua"); | |
| 62 | + ImGui::Dummy(ImVec2(0, 10)); | |
| 63 | + renderMarkdown(R"(# Luaエンジン | |
| 64 | + | |
| 65 | +- **コンパイル**: F5 又は「ビルド→コンパイル」 | |
| 66 | +- **保存**: Ctrl+s 又は「ファイル→保存」 | |
| 67 | +- 右側のパネルでシェーダーコードを編集出来ます | |
| 68 | +)"); | |
| 69 | + } else if (m_CurPage == "hotkeys") { | |
| 70 | + ImGui::TextWrapped("Shader Playgroundへようこそ!"); | |
| 71 | + ImGui::Dummy(ImVec2(0, 10)); | |
| 72 | + renderMarkdown(R"(# 基本操作 | |
| 73 | + | |
| 74 | +- **コンパイル**: F5 又は「ビルド→コンパイル」 | |
| 75 | +- **保存**: Ctrl+s 又は「ファイル→保存」 | |
| 76 | +- 右側のパネルでシェーダーコードを編集出来ます | |
| 77 | +)"); | |
| 78 | + } | |
| 79 | + | |
| 80 | + ImGui::EndChild(); | |
| 81 | + ImGui::End(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + ///////// | |
| 85 | + | |
| 86 | + void Manual::renderMarkdown(cstr text) { | |
| 87 | + ImGui::PushTextWrapPos(ImGui::GetContentRegionAvail().x); | |
| 88 | + ImGui::TextUnformatted(text); | |
| 89 | + ImGui::PopTextWrapPos(); | |
| 90 | + } | |
| 4 | 91 | } // namespace gui |
| @@ -151,7 +151,9 @@ | ||
| 151 | 151 | if (ImGui::MenuItem("貼り付け", "Ctrl+V", false, false)) {} |
| 152 | 152 | if (ImGui::MenuItem("行を複製", "Ctrl+D", false, false)) {} |
| 153 | 153 | ImGui::Separator(); |
| 154 | - if (ImGui::MenuItem("設定", "Ctrl+,", false, false)) {} | |
| 154 | + if (ImGui::MenuItem("設定", "Ctrl+,", false, false)) { | |
| 155 | + glfw.isSettings = true; | |
| 156 | + } | |
| 155 | 157 | ImGui::EndMenu(); |
| 156 | 158 | } |
| 157 | 159 | |
| @@ -163,14 +165,16 @@ | ||
| 163 | 165 | } |
| 164 | 166 | |
| 165 | 167 | if (ImGui::BeginMenu("ヘルプ")) { |
| 166 | - if (ImGui::MenuItem("マニュアル", "F1")) {} | |
| 168 | + if (ImGui::MenuItem("マニュアル", "F1")) { | |
| 169 | + glfw.isManual = true; | |
| 170 | + } | |
| 167 | 171 | if (ImGui::MenuItem("Shader Playgroundについて", "CTRL+H")) { |
| 168 | 172 | glfw.isAbout = true; |
| 169 | 173 | } |
| 170 | 174 | ImGui::EndMenu(); |
| 171 | 175 | } |
| 172 | 176 | |
| 173 | - if (ImGui::BeginMenu("言語")) { | |
| 177 | + if (ImGui::BeginMenu("言語/Language")) { | |
| 174 | 178 | if (ImGui::MenuItem("日本語")) {} |
| 175 | 179 | if (ImGui::MenuItem("English")) {} |
| 176 | 180 | ImGui::EndMenu(); |