設定ウィンドウの追加
守矢諏訪子 <suwako@076.moe>、2026-06-27 01:31
コミット fb7bf6873f44be6046215c3a3f4c16ff3a284254
・親 bab9c87
・ファイルを見る
15個のファイル、+127 -51
| @@ -43,4 +43,4 @@ | ||
| 43 | 43 | #include <gui/about.hh> |
| 44 | 44 | #include <gui/consolelog.hh> |
| 45 | 45 | #include <gui/manual.hh> |
| 46 | -// #include <gui/settings.hh> | |
| 46 | + #include <gui/settings.hh> |
| @@ -42,6 +42,6 @@ | ||
| 42 | 42 | namespace gui { |
| 43 | 43 | class About { |
| 44 | 44 | public: |
| 45 | - void Draw(GlfwInfo &glfw); | |
| 45 | + void Draw(GlfwInfo &glfw); | |
| 46 | 46 | }; // class About |
| 47 | 47 | } // namespace gui |
| @@ -37,7 +37,11 @@ | ||
| 37 | 37 | #pragma once |
| 38 | 38 | |
| 39 | 39 | #include <util/types.hh> |
| 40 | -#include <util/structs.hh> | |
| 40 | + | |
| 41 | +struct GlfwInfo; | |
| 42 | +namespace db { | |
| 43 | + class Locale; | |
| 44 | +} // namespace db | |
| 41 | 45 | |
| 42 | 46 | namespace gui { |
| 43 | 47 | enum class LogType { |
| @@ -37,6 +37,11 @@ | ||
| 37 | 37 | #pragma once |
| 38 | 38 | |
| 39 | 39 | #include <util/types.hh> |
| 40 | +#include <util/structs.hh> | |
| 40 | 41 | |
| 41 | 42 | namespace gui { |
| 43 | + class Settings { | |
| 44 | + public: | |
| 45 | + void Draw(GlfwInfo &glfw); | |
| 46 | + }; // class Settings | |
| 42 | 47 | } // namespace gui |
| @@ -65,7 +65,7 @@ | ||
| 65 | 65 | |
| 66 | 66 | class LuaEngine { |
| 67 | 67 | public: |
| 68 | - LuaEngine(const string &code, Program *prog, GlfwInfo *glfwInfo, gui::ConsoleLog *cmd = nullptr); | |
| 68 | + LuaEngine(const string &code, Program *prog, GlfwInfo *glfwInfo); | |
| 69 | 69 | ~LuaEngine(); |
| 70 | 70 | |
| 71 | 71 | public: |
| @@ -79,7 +79,6 @@ | ||
| 79 | 79 | |
| 80 | 80 | public: |
| 81 | 81 | void SetProgram(Program *prog) { m_Program = prog; } |
| 82 | - void SetConsole(gui::ConsoleLog *cmd) { m_Console = cmd; } | |
| 83 | 82 | string GetApiVersion() const { return m_ApiVersion; } |
| 84 | 83 | |
| 85 | 84 | private: |
| @@ -97,7 +96,6 @@ | ||
| 97 | 96 | sol::state m_Lua; |
| 98 | 97 | string m_Code; |
| 99 | 98 | Program *m_Program = nullptr; |
| 100 | - gui::ConsoleLog *m_Console = nullptr; | |
| 101 | 99 | GlfwInfo *m_GlfwInfo = {}; |
| 102 | 100 | string m_ApiVersion = "1.0.0"; |
| 103 | 101 | f32 m_LastTime = 0.f; |
| @@ -37,11 +37,18 @@ | ||
| 37 | 37 | #pragma once |
| 38 | 38 | |
| 39 | 39 | #include <util/glfwpp.hh> |
| 40 | -#include <database/locale.hh> | |
| 41 | 40 | #include <version.hh> |
| 42 | 41 | #include <functional> |
| 43 | 42 | #include <string> |
| 44 | 43 | |
| 44 | +namespace gui { | |
| 45 | + class ConsoleLog; | |
| 46 | +} // namespace gui | |
| 47 | + | |
| 48 | +namespace db { | |
| 49 | + class Locale; | |
| 50 | +} // namespace db | |
| 51 | + | |
| 45 | 52 | struct GlfwInfo { |
| 46 | 53 | glfwpp::Instance *instance; |
| 47 | 54 | glfwpp::Window *window; |
| @@ -54,6 +61,7 @@ | ||
| 54 | 61 | |
| 55 | 62 | std::string version = version::full; |
| 56 | 63 | |
| 64 | + gui::ConsoleLog *cmd; | |
| 57 | 65 | db::Locale *i18n; |
| 58 | 66 | |
| 59 | 67 | std::function<void()> compile; |
変更
main.cc
| @@ -108,6 +108,7 @@ | ||
| 108 | 108 | |
| 109 | 109 | // コンソール |
| 110 | 110 | gui::ConsoleLog cmd; |
| 111 | + glfwInfo.cmd = &cmd; | |
| 111 | 112 | |
| 112 | 113 | // ビューポート |
| 113 | 114 | gui::ViewPort viewport; |
| @@ -149,7 +150,7 @@ | ||
| 149 | 150 | Program shaderProgram(vertexShader, fragmentShader); |
| 150 | 151 | |
| 151 | 152 | // 頂点データはLuaから受け取る |
| 152 | - lua::LuaEngine luaEngine(LUA.code, &shaderProgram, &glfwInfo, &cmd); | |
| 153 | + lua::LuaEngine luaEngine(LUA.code, &shaderProgram, &glfwInfo); | |
| 153 | 154 | auto &mesh = luaEngine.GetMesh(); |
| 154 | 155 | |
| 155 | 156 | VertexArrays VAO(1); |
| @@ -170,6 +171,7 @@ | ||
| 170 | 171 | |
| 171 | 172 | bool isHold = false; |
| 172 | 173 | gui::About about; |
| 174 | + gui::Settings settings; | |
| 173 | 175 | |
| 174 | 176 | // メインレンダリングループ |
| 175 | 177 | while (!window.ShouldClose() && glfwInfo.isRunning) { |
| @@ -184,7 +186,7 @@ | ||
| 184 | 186 | gui::LogEntry entry; |
| 185 | 187 | entry.type = gui::LogType::Error; |
| 186 | 188 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidcomp"); |
| 187 | - cmd.Add(entry); | |
| 189 | + glfwInfo.cmd->Add(entry); | |
| 188 | 190 | std::cerr << entry.text << std::endl; |
| 189 | 191 | return; |
| 190 | 192 | } |
| @@ -192,10 +194,10 @@ | ||
| 192 | 194 | gui::LogEntry entry; |
| 193 | 195 | entry.type = gui::LogType::Error; |
| 194 | 196 | entry.text = e.what(); |
| 195 | - cmd.Add(entry); | |
| 197 | + glfwInfo.cmd->Add(entry); | |
| 196 | 198 | std::cerr << entry.text << std::endl; |
| 197 | 199 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidcomp"); |
| 198 | - cmd.Add(entry); | |
| 200 | + glfwInfo.cmd->Add(entry); | |
| 199 | 201 | std::cerr << entry.text << std::endl; |
| 200 | 202 | return; |
| 201 | 203 | } |
| @@ -236,16 +238,16 @@ | ||
| 236 | 238 | gui::LogEntry entry; |
| 237 | 239 | entry.type = gui::LogType::Info; |
| 238 | 240 | entry.text = glfwInfo.i18n->GetWord("consoleloginfocompileok"); |
| 239 | - cmd.Add(entry); | |
| 241 | + glfwInfo.cmd->Add(entry); | |
| 240 | 242 | std::cout << entry.text << std::endl; |
| 241 | 243 | } catch (const std::exception &e) { |
| 242 | 244 | gui::LogEntry entry; |
| 243 | 245 | entry.type = gui::LogType::Error; |
| 244 | 246 | entry.text = e.what(); |
| 245 | - cmd.Add(entry); | |
| 247 | + glfwInfo.cmd->Add(entry); | |
| 246 | 248 | std::cerr << entry.text << std::endl; |
| 247 | 249 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidcomp"); |
| 248 | - cmd.Add(entry); | |
| 250 | + glfwInfo.cmd->Add(entry); | |
| 249 | 251 | std::cerr << entry.text << std::endl; |
| 250 | 252 | } |
| 251 | 253 | }; |
| @@ -261,7 +263,7 @@ | ||
| 261 | 263 | gui::LogEntry entry; |
| 262 | 264 | entry.type = gui::LogType::Error; |
| 263 | 265 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidsave"); |
| 264 | - cmd.Add(entry); | |
| 266 | + glfwInfo.cmd->Add(entry); | |
| 265 | 267 | std::cout << entry.text << std::endl; |
| 266 | 268 | return; |
| 267 | 269 | } |
| @@ -269,10 +271,10 @@ | ||
| 269 | 271 | gui::LogEntry entry; |
| 270 | 272 | entry.type = gui::LogType::Error; |
| 271 | 273 | entry.text = e.what(); |
| 272 | - cmd.Add(entry); | |
| 274 | + glfwInfo.cmd->Add(entry); | |
| 273 | 275 | std::cout << entry.text << std::endl; |
| 274 | 276 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidsave"); |
| 275 | - cmd.Add(entry); | |
| 277 | + glfwInfo.cmd->Add(entry); | |
| 276 | 278 | std::cout << entry.text << std::endl; |
| 277 | 279 | return; |
| 278 | 280 | } |
| @@ -284,16 +286,16 @@ | ||
| 284 | 286 | gui::LogEntry entry; |
| 285 | 287 | entry.type = gui::LogType::Info; |
| 286 | 288 | entry.text = glfwInfo.i18n->GetWord("consoleloginfosaveok"); |
| 287 | - cmd.Add(entry); | |
| 289 | + glfwInfo.cmd->Add(entry); | |
| 288 | 290 | std::cout << entry.text << std::endl; |
| 289 | 291 | } catch (const std::exception &e) { |
| 290 | 292 | gui::LogEntry entry; |
| 291 | 293 | entry.type = gui::LogType::Error; |
| 292 | 294 | entry.text = e.what(); |
| 293 | - cmd.Add(entry); | |
| 295 | + glfwInfo.cmd->Add(entry); | |
| 294 | 296 | std::cout << entry.text << std::endl; |
| 295 | 297 | entry.text = glfwInfo.i18n->GetWord("consolelogerrorluainvalidsave"); |
| 296 | - cmd.Add(entry); | |
| 298 | + glfwInfo.cmd->Add(entry); | |
| 297 | 299 | std::cout << entry.text << std::endl; |
| 298 | 300 | } |
| 299 | 301 | }; |
| @@ -360,8 +362,9 @@ | ||
| 360 | 362 | vertEditor.Render(); |
| 361 | 363 | fragEditor.Render(); |
| 362 | 364 | luaEditor.Render(); |
| 363 | - cmd.Draw(glfwInfo, glfwInfo.i18n->GetWord("editorconsole").c_str()); | |
| 365 | + glfwInfo.cmd->Draw(glfwInfo, glfwInfo.i18n->GetWord("editorconsole").c_str()); | |
| 364 | 366 | about.Draw(glfwInfo); |
| 367 | + settings.Draw(glfwInfo); | |
| 365 | 368 | manual.Draw(glfwInfo); |
| 366 | 369 | |
| 367 | 370 | viewport.Draw(glfwInfo); |
| @@ -234,8 +234,6 @@ | ||
| 234 | 234 | createWord(db, 2, "helpabout", "About Shader Playground"); |
| 235 | 235 | createWord(db, 1, "currentfps", "現在フレームレート"); |
| 236 | 236 | createWord(db, 2, "currentfps", "Current Frame Rate"); |
| 237 | - createWord(db, 1, "dateformat", "%Y年%m月%d日 %H:%M:%S"); | |
| 238 | - createWord(db, 2, "dateformat", "%Y/%m/%d %H:%M:%S"); | |
| 239 | 237 | createWord(db, 1, "consolelogerrorluainvalidcomp", "Luaコードが不正ですので、コンパイル出来ませんでした。"); |
| 240 | 238 | createWord(db, 2, "consolelogerrorluainvalidcomp", "Your Lua code is invalid, so it could not be compiled."); |
| 241 | 239 | createWord(db, 1, "consolelogerrorluainvalidsave", "Luaコードが不正ですので、保存出来ませんでした。"); |
| @@ -244,6 +242,8 @@ | ||
| 244 | 242 | createWord(db, 2, "consoleloginfocompileok", "Shaders got compiled successfully."); |
| 245 | 243 | createWord(db, 1, "consoleloginfosaveok", "シェーダー及びLuaを保存しました。"); |
| 246 | 244 | createWord(db, 2, "consoleloginfosaveok", "Shaders and Lua have been saved."); |
| 245 | + createWord(db, 1, "consoleloginfolangchangeok", "言語を変更しました。"); | |
| 246 | + createWord(db, 2, "consoleloginfolangchangeok", "Language has been changed."); | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | i64 shaderId = 0; |
| @@ -36,6 +36,7 @@ | ||
| 36 | 36 | */ |
| 37 | 37 | #include <gui/about.hh> |
| 38 | 38 | #include <imgui.h> |
| 39 | +#include <database/locale.hh> | |
| 39 | 40 | |
| 40 | 41 | namespace gui { |
| 41 | 42 | void About::Draw(GlfwInfo &glfw) { |
| @@ -35,6 +35,8 @@ | ||
| 35 | 35 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 36 | 36 | */ |
| 37 | 37 | #include <gui/consolelog.hh> |
| 38 | +#include <database/locale.hh> | |
| 39 | +#include <util/structs.hh> | |
| 38 | 40 | #include <imgui.h> |
| 39 | 41 | |
| 40 | 42 | namespace gui { |
| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | */ |
| 37 | 37 | #include <gui/manual.hh> |
| 38 | 38 | #include <imgui.h> |
| 39 | +#include <database/locale.hh> | |
| 39 | 40 | |
| 40 | 41 | namespace gui { |
| 41 | - | |
| 42 | 42 | void Manual::Draw(GlfwInfo &glfw) { |
| 43 | 43 | if (!glfw.isManual) return; |
| 44 | 44 |
| @@ -35,6 +35,60 @@ | ||
| 35 | 35 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 36 | 36 | */ |
| 37 | 37 | #include <gui/settings.hh> |
| 38 | +#include <gui/consolelog.hh> | |
| 39 | +#include <util/structs.hh> | |
| 40 | +#include <database/locale.hh> | |
| 41 | +#include <imgui.h> | |
| 38 | 42 | |
| 39 | 43 | namespace gui { |
| 44 | + void Settings::Draw(GlfwInfo &glfw) { | |
| 45 | + if (!glfw.isSettings) return; | |
| 46 | + | |
| 47 | + ImGuiWindowFlags flags = 0; | |
| 48 | + ImGui::SetNextWindowSize({ 400, 300 }, ImGuiCond_Appearing); | |
| 49 | + ImGui::Begin(glfw.i18n->GetWord("settings").c_str(), &glfw.isSettings, flags); | |
| 50 | + | |
| 51 | + ImGui::Text("言語 / Language"); | |
| 52 | + ImGui::SameLine(); | |
| 53 | + cstr items[] = { "日本語 (ja_JP)", "English (en_US)" }; | |
| 54 | + const i32 itemCount = IM_COUNTOF(items); | |
| 55 | + i32 curId = glfw.i18n->GetCurrentLanguage().id; | |
| 56 | + static i32 sel = (curId >= 1) ? curId - 1 : 0; | |
| 57 | + | |
| 58 | + sel = (curId >= 1 && curId <= itemCount) ? curId - 1 : 0; | |
| 59 | + | |
| 60 | + const char *preview = items[sel]; | |
| 61 | + if (ImGui::BeginCombo("##Language", preview)) { | |
| 62 | + for (int n = 0; n < itemCount; ++n) { | |
| 63 | + const bool isSel = (sel == n); | |
| 64 | + if (ImGui::Selectable(items[n], isSel)) { | |
| 65 | + sel = n; | |
| 66 | + glfw.i18n->SetLanguage(n + 1); | |
| 67 | + gui::LogEntry entry; | |
| 68 | + entry.type = gui::LogType::Info; | |
| 69 | + entry.text = glfw.i18n->GetWord("consoleloginfolangchangeok"); | |
| 70 | + glfw.cmd->Add(entry); | |
| 71 | + } | |
| 72 | + | |
| 73 | + if (isSel) { | |
| 74 | + ImGui::SetItemDefaultFocus(); | |
| 75 | + } | |
| 76 | + } | |
| 77 | + ImGui::EndCombo(); | |
| 78 | + } | |
| 79 | + | |
| 80 | + f32 btnW = 80.f; | |
| 81 | + f32 btnH = 0.f; | |
| 82 | + | |
| 83 | + ImVec2 winSize = ImGui::GetWindowSize(); | |
| 84 | + ImVec2 cursorPos = ImGui::GetCursorPos(); | |
| 85 | + | |
| 86 | + ImGui::SetCursorPos({ | |
| 87 | + (winSize.x - btnW) * .5f, | |
| 88 | + winSize.y - 40.f | |
| 89 | + }); | |
| 90 | + | |
| 91 | + if (ImGui::Button("OK", { btnW, btnH })) glfw.isSettings = false; | |
| 92 | + ImGui::End(); | |
| 93 | + } | |
| 40 | 94 | } // namespace gui |
| @@ -35,12 +35,12 @@ | ||
| 35 | 35 | OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 36 | 36 | */ |
| 37 | 37 | #include <gui/titlebar.hh> |
| 38 | -#include <gui/about.hh> | |
| 39 | 38 | |
| 40 | 39 | #include <imgui.h> |
| 41 | 40 | #include <imgui_internal.h> |
| 42 | 41 | #include <backends/imgui_impl_glfw.h> |
| 43 | 42 | #include <backends/imgui_impl_opengl3.h> |
| 43 | +#include <database/locale.hh> | |
| 44 | 44 | #include <ctime> |
| 45 | 45 | |
| 46 | 46 | namespace gui { |
| @@ -50,6 +50,7 @@ | ||
| 50 | 50 | ImGui::NewFrame(); |
| 51 | 51 | |
| 52 | 52 | ImGuiWindowFlags window_flags = |
| 53 | + ImGuiWindowFlags_NoCollapse | | |
| 53 | 54 | ImGuiWindowFlags_MenuBar | |
| 54 | 55 | ImGuiWindowFlags_NoDocking; |
| 55 | 56 | |
| @@ -68,6 +69,9 @@ | ||
| 68 | 69 | ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); |
| 69 | 70 | ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); |
| 70 | 71 | |
| 72 | + ImGui::GetIO().ConfigDockingWithShift = true; | |
| 73 | + ImGui::GetStyle().WindowMenuButtonPosition = ImGuiDir_None; | |
| 74 | + | |
| 71 | 75 | ImGui::Begin("MainDockSpace", nullptr, window_flags); |
| 72 | 76 | |
| 73 | 77 | ImGui::PopStyleVar(2); |
| @@ -153,7 +157,7 @@ | ||
| 153 | 157 | if (ImGui::MenuItem(glfw.i18n->GetWord("editpaste").c_str(), "Ctrl+V", false, false)) {} |
| 154 | 158 | if (ImGui::MenuItem(glfw.i18n->GetWord("editduplicate").c_str(), "Ctrl+D", false, false)) {} |
| 155 | 159 | ImGui::Separator(); |
| 156 | - if (ImGui::MenuItem(glfw.i18n->GetWord("settings").c_str(), "Ctrl+,", false, false)) { | |
| 160 | + if (ImGui::MenuItem(glfw.i18n->GetWord("settings").c_str(), "Ctrl+,")) { | |
| 157 | 161 | glfw.isSettings = true; |
| 158 | 162 | } |
| 159 | 163 | ImGui::EndMenu(); |
| @@ -176,31 +180,27 @@ | ||
| 176 | 180 | ImGui::EndMenu(); |
| 177 | 181 | } |
| 178 | 182 | |
| 179 | - if (ImGui::BeginMenu("言語/Language")) { | |
| 180 | - if (ImGui::MenuItem("日本語")) { | |
| 181 | - glfw.i18n->SetLanguage(1); | |
| 182 | - glfw.isLangChange = true; | |
| 183 | - } | |
| 184 | - if (ImGui::MenuItem("English")) { | |
| 185 | - glfw.i18n->SetLanguage(2); | |
| 186 | - glfw.isLangChange = true; | |
| 187 | - } | |
| 188 | - ImGui::EndMenu(); | |
| 189 | - } | |
| 190 | - | |
| 191 | 183 | ImGui::SameLine(); |
| 192 | 184 | |
| 193 | - f32 rightW = ImGui::GetContentRegionAvail().x; | |
| 194 | - ImGui::SetCursorPosX(ImGui::GetCursorPosX() + rightW - 400.f); | |
| 185 | + f32 side; | |
| 186 | + if (glfw.i18n->GetCurrentLanguage().code == "ja_JP") side = 379.f; | |
| 187 | + else side = 380.f; | |
| 188 | + | |
| 189 | + ImGui::SetCursorPosX(ImGui::GetWindowWidth() - side); | |
| 190 | + | |
| 195 | 191 | string fmt = glfw.i18n->GetWord("currentfps") + ": %.3f ms/frame (%.1f FPS)"; |
| 196 | 192 | ImGui::Text(fmt.c_str(), 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate); |
| 197 | 193 | |
| 198 | 194 | ImGui::SameLine(); |
| 195 | + ImGui::Text(" | "); | |
| 196 | + ImGui::SameLine(); | |
| 197 | + | |
| 199 | 198 | char timeBuf[64]; |
| 200 | 199 | time_t now = time(nullptr); |
| 201 | 200 | tm *local = localtime(&now); |
| 202 | - strftime(timeBuf, sizeof(timeBuf), glfw.i18n->GetWord("dateformat").c_str(), local); | |
| 203 | - ImGui::Text(" | %s", timeBuf); | |
| 201 | + | |
| 202 | + strftime(timeBuf, sizeof(timeBuf), "%Y/%m/%d %H:%M:%S", local); | |
| 203 | + ImGui::Text("%s", timeBuf); | |
| 204 | 204 | |
| 205 | 205 | ImGui::EndMainMenuBar(); |
| 206 | 206 | } |
| @@ -37,6 +37,7 @@ | ||
| 37 | 37 | #include <glad/glad.h> |
| 38 | 38 | #include <gui/viewport.hh> |
| 39 | 39 | #include <imgui.h> |
| 40 | +#include <database/locale.hh> | |
| 40 | 41 | |
| 41 | 42 | namespace gui { |
| 42 | 43 | void ViewPort::Init() { |
| @@ -39,16 +39,16 @@ | ||
| 39 | 39 | #include <shader/shader.hh> |
| 40 | 40 | #include <glfw/glfw3.h> |
| 41 | 41 | #include <util/glfwpp.hh> |
| 42 | -#include <gui/consolelog.hh> | |
| 43 | 42 | #include <util/vector.hh> |
| 44 | 43 | #include <util/random.hh> |
| 44 | +#include <database/locale.hh> | |
| 45 | +#include <gui/consolelog.hh> | |
| 45 | 46 | |
| 46 | 47 | namespace lua { |
| 47 | - LuaEngine::LuaEngine(const string &code, Program *prog, GlfwInfo *glfwInfo, gui::ConsoleLog *cmd) | |
| 48 | + LuaEngine::LuaEngine(const string &code, Program *prog, GlfwInfo *glfwInfo) | |
| 48 | 49 | : m_Code(code) |
| 49 | 50 | , m_Program(prog) |
| 50 | 51 | , m_GlfwInfo(glfwInfo) |
| 51 | - , m_Console(cmd) | |
| 52 | 52 | { |
| 53 | 53 | m_Lua = MakeAPI(); |
| 54 | 54 | Execute(m_Lua); |
| @@ -105,16 +105,16 @@ | ||
| 105 | 105 | gui::LogEntry entry = {}; |
| 106 | 106 | entry.type = gui::LogType::Error; |
| 107 | 107 | entry.text = err.what(); |
| 108 | - if (m_Console) m_Console->Add(entry); | |
| 109 | - else std::cerr << err.what() << std::endl; | |
| 108 | + m_GlfwInfo->cmd->Add(entry); | |
| 109 | + std::cerr << err.what() << std::endl; | |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | void LuaEngine::LogError(const std::exception &err) { |
| 113 | 113 | gui::LogEntry entry = {}; |
| 114 | 114 | entry.type = gui::LogType::Error; |
| 115 | 115 | entry.text = err.what(); |
| 116 | - if (m_Console) m_Console->Add(entry); | |
| 117 | - else std::cerr << err.what() << std::endl; | |
| 116 | + m_GlfwInfo->cmd->Add(entry); | |
| 117 | + std::cerr << err.what() << std::endl; | |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | sol::state LuaEngine::MakeAPI() { |
| @@ -402,8 +402,8 @@ | ||
| 402 | 402 | gui::LogEntry entry = {}; |
| 403 | 403 | entry.type = gui::LogType::Normal; |
| 404 | 404 | entry.text = out; |
| 405 | - if (m_Console) m_Console->Add(entry); | |
| 406 | - else std::cerr << entry.text << std::endl; | |
| 405 | + m_GlfwInfo->cmd->Add(entry); (entry); | |
| 406 | + std::cerr << entry.text << std::endl; | |
| 407 | 407 | }; |
| 408 | 408 | } |
| 409 | 409 |