マニュアルウィンドウ(内容は作成中)

守矢諏訪子 <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 @@
11 #pragma once
22
33 #include <util/types.hh>
4+#include <util/structs.hh>
45
56 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
615 } // 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 @@
4545
4646 bool isRunning = true;
4747 bool isAbout = false;
48+ bool isManual = false;
49+ bool isSettings = false;
4850
4951 std::string version = version::full;
5052
変更 main.cc
@@ -33,25 +33,13 @@
3333 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3434 */
3535 #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>
3841 #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>
5543
5644 #include <imgui.h>
5745 #include <backends/imgui_impl_glfw.h>
@@ -85,7 +73,7 @@
8573 window.MakeContextCurrent();
8674 glfw.SwapInterval(1);
8775
88- GlfwInfo glfwInfo = { &glfw, &window, true, false };
76+ GlfwInfo glfwInfo = { &glfw, &window, true, false, false, false };
8977
9078 #ifndef PRODUCTION_BUILD
9179 bool showDemo = true;
@@ -119,6 +107,9 @@
119107 gui::ViewPort viewport;
120108 viewport.Init();
121109
110+ // マニュアル
111+ gui::Manual manual;
112+
122113 // データベースからシェーダーとLuaコードの受け取り
123114 vector<db::ShaderData> codeMap = db::GetAllShaders(db);
124115 u32 shaderId;
@@ -281,17 +272,27 @@
281272
282273 glfw.PollEvents();
283274
275+ bool isManualKey = window.GetKey(GLFW_KEY_F1);
284276 bool isCompileKey = window.GetKey(GLFW_KEY_F5);
285277 bool ctrlMod = (window.GetKey(GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || window.GetKey(GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS);
286278 bool isSaveKey = (window.GetKey(GLFW_KEY_S) == GLFW_PRESS && ctrlMod);
287279 bool isQuitKey = (window.GetKey(GLFW_KEY_Q) == GLFW_PRESS && ctrlMod);
288280 bool isAboutKey = (window.GetKey(GLFW_KEY_H) == GLFW_PRESS && ctrlMod);
281+ bool isSettingsKey = (window.GetKey(GLFW_KEY_COMMA) == GLFW_PRESS && ctrlMod);
289282
290283 if (!isHold) {
291284 if (isCompileKey) {
292285 glfwInfo.compile();
293286 }
294287
288+ if (isManualKey) {
289+ glfwInfo.isManual = true;
290+ }
291+
292+ if (isSettingsKey) {
293+ glfwInfo.isSettings = true;
294+ }
295+
295296 if (isAboutKey) {
296297 glfwInfo.isAbout = true;
297298 }
@@ -305,7 +306,7 @@
305306 }
306307 }
307308
308- isHold = isSaveKey || isCompileKey || isAboutKey || isQuitKey;
309+ isHold = isSaveKey || isCompileKey || isAboutKey || isQuitKey || isManualKey || isSettingsKey;
309310
310311 if (window.GetAttrib(glfwpp::Attributes::Iconified) != 0) {
311312 ImGui_ImplGlfw_Sleep(10);
@@ -323,6 +324,7 @@
323324 luaEditor.Render();
324325 cmd.Draw();
325326 about.Draw(glfwInfo);
327+ manual.Draw(glfwInfo);
326328
327329 viewport.Draw(glfwInfo);
328330
@@ -1,4 +1,91 @@
11 #include <gui/manual.hh>
2+#include <imgui.h>
23
34 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+ }
491 } // namespace gui
@@ -151,7 +151,9 @@
151151 if (ImGui::MenuItem("貼り付け", "Ctrl+V", false, false)) {}
152152 if (ImGui::MenuItem("行を複製", "Ctrl+D", false, false)) {}
153153 ImGui::Separator();
154- if (ImGui::MenuItem("設定", "Ctrl+,", false, false)) {}
154+ if (ImGui::MenuItem("設定", "Ctrl+,", false, false)) {
155+ glfw.isSettings = true;
156+ }
155157 ImGui::EndMenu();
156158 }
157159
@@ -163,14 +165,16 @@
163165 }
164166
165167 if (ImGui::BeginMenu("ヘルプ")) {
166- if (ImGui::MenuItem("マニュアル", "F1")) {}
168+ if (ImGui::MenuItem("マニュアル", "F1")) {
169+ glfw.isManual = true;
170+ }
167171 if (ImGui::MenuItem("Shader Playgroundについて", "CTRL+H")) {
168172 glfw.isAbout = true;
169173 }
170174 ImGui::EndMenu();
171175 }
172176
173- if (ImGui::BeginMenu("言語")) {
177+ if (ImGui::BeginMenu("言語/Language")) {
174178 if (ImGui::MenuItem("日本語")) {}
175179 if (ImGui::MenuItem("English")) {}
176180 ImGui::EndMenu();