[Scummvm-git-logs] scummvm master -> 3201ae1923054c1bdf655d033e83a6ccfaa7e00a

sev- noreply at scummvm.org
Tue Feb 17 21:27:51 UTC 2026


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
3201ae1923 SCUMM: EDITOR: Introduce settings


Commit: 3201ae1923054c1bdf655d033e83a6ccfaa7e00a
    https://github.com/scummvm/scummvm/commit/3201ae1923054c1bdf655d033e83a6ccfaa7e00a
Author: Sebastien Ronsse (sronsse at gmail.com)
Date: 2026-02-17T22:27:47+01:00

Commit Message:
SCUMM: EDITOR: Introduce settings

Changed paths:
    engines/scumm/debugger/editor.cpp
    engines/scumm/debugger/editor.h


diff --git a/engines/scumm/debugger/editor.cpp b/engines/scumm/debugger/editor.cpp
index 60d6075e006..afaf2746744 100644
--- a/engines/scumm/debugger/editor.cpp
+++ b/engines/scumm/debugger/editor.cpp
@@ -20,7 +20,6 @@
  */
 
 #include "backends/imgui/IconsMaterialSymbols.h"
-#include "backends/imgui/imgui.h"
 
 #include "common/config-manager.h"
 #include "common/formats/json.h"
@@ -30,13 +29,26 @@
 
 #include "scumm/debugger/editor.h"
 
+#define ICON_EDITOR   ICON_MS_CONSTRUCTION
+#define ICON_SETTINGS ICON_MS_SETTINGS
+
 namespace Scumm {
 
 static const char *saveStateFileName = "ImGuiSaveState.json";
 
+static const char *colorNames[] = {"Label", "Property", "Warning", "Error"};
+
 ScummEditor::ScummEditor(ScummEngine *engine)
 	: _engine(engine),
-	  _gameName(ConfMan.get("gameid")) {
+	  _gameName(ConfMan.get("gameid")),
+	  _showSettings(false) {
+	// Specify default colors
+	_colors.resize(Editor::kColorCount);
+	_colors[Editor::kColorLabel] = ImVec4(0.149f, 0.545f, 0.824f, 1.0f);    // SOL_BLUE
+	_colors[Editor::kColorProperty] = ImVec4(0.514f, 0.580f, 0.588f, 1.0f); // SOL_BASE0
+	_colors[Editor::kColorWarning] = ImVec4(0.710f, 0.537f, 0.000f, 1.0f);  // SOL_YELLOW
+	_colors[Editor::kColorError] = ImVec4(0.863f, 0.196f, 0.184f, 1.0f);    // SOL_RED
+
 	loadState();
 }
 
@@ -58,20 +70,77 @@ void ScummEditor::loadState() {
 	if (!state)
 		return;
 
-	// Load state
+	// Load colors
+	if (state->asObject().contains("Colors")) {
+		const Common::JSONObject &colors = state->asObject()["Colors"]->asObject();
+		for (uint i = 0; i < _colors.size(); ++i) {
+			if (colors.contains(colorNames[i])) {
+				const Common::JSONArray &arr = colors[colorNames[i]]->asArray();
+				_colors[i].x = (float)arr[0]->asNumber();
+				_colors[i].y = (float)arr[1]->asNumber();
+				_colors[i].z = (float)arr[2]->asNumber();
+				_colors[i].w = (float)arr[3]->asNumber();
+			}
+		}
+	}
+
+	// Load ImGui layout
 	if (state->asObject().contains("IniSettings")) {
 		const char *iniSettings = state->asObject()["IniSettings"]->asString().c_str();
 		ImGui::LoadIniSettingsFromMemory(iniSettings);
 	}
+
+	// Load ImGui colors
+	if (state->asObject().contains("ImGuiColors")) {
+		const Common::JSONObject &obj = state->asObject()["ImGuiColors"]->asObject();
+		ImGuiStyle &style = ImGui::GetStyle();
+		for (int i = 0; i < ImGuiCol_COUNT; ++i) {
+			const char *name = ImGui::GetStyleColorName(i);
+			if (obj.contains(name)) {
+				const Common::JSONArray &arr = obj[name]->asArray();
+				style.Colors[i].x = (float)arr[0]->asNumber();
+				style.Colors[i].y = (float)arr[1]->asNumber();
+				style.Colors[i].z = (float)arr[2]->asNumber();
+				style.Colors[i].w = (float)arr[3]->asNumber();
+			}
+		}
+	}
+
 	delete state;
 }
 
 void ScummEditor::saveState() {
-	// Save state
 	Common::JSONObject json;
+
+	// Save colors
+	Common::JSONObject colors;
+	for (uint i = 0; i < _colors.size(); ++i) {
+		Common::JSONArray arr;
+		arr.push_back(new Common::JSONValue((double)_colors[i].x));
+		arr.push_back(new Common::JSONValue((double)_colors[i].y));
+		arr.push_back(new Common::JSONValue((double)_colors[i].z));
+		arr.push_back(new Common::JSONValue((double)_colors[i].w));
+		colors[colorNames[i]] = new Common::JSONValue(arr);
+	}
+	json["Colors"] = new Common::JSONValue(colors);
+
+	// Save layout
 	const char *iniSettings = ImGui::SaveIniSettingsToMemory();
 	json["IniSettings"] = new Common::JSONValue(iniSettings);
 
+	// Save ImGui colors
+	ImGuiStyle &style = ImGui::GetStyle();
+	Common::JSONObject imguiColors;
+	for (int i = 0; i < ImGuiCol_COUNT; ++i) {
+		Common::JSONArray arr;
+		arr.push_back(new Common::JSONValue((double)style.Colors[i].x));
+		arr.push_back(new Common::JSONValue((double)style.Colors[i].y));
+		arr.push_back(new Common::JSONValue((double)style.Colors[i].z));
+		arr.push_back(new Common::JSONValue((double)style.Colors[i].w));
+		imguiColors[ImGui::GetStyleColorName(i)] = new Common::JSONValue(arr);
+	}
+	json["ImGuiColors"] = new Common::JSONValue(imguiColors);
+
 	// Write to save file
 	Common::JSONValue state(json);
 	Common::OutSaveFile *stream = g_engine->getSaveFileManager()->openForSaving(saveStateFileName);
@@ -82,10 +151,31 @@ void ScummEditor::saveState() {
 	delete stream;
 }
 
+void ScummEditor::showSettings() {
+	ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_FirstUseEver, ImVec2(0.5f, 0.5f));
+	ImGui::SetNextWindowSize(ImVec2(600, 500), ImGuiCond_FirstUseEver);
+	if (ImGui::Begin(ICON_SETTINGS " Settings", &_showSettings, ImGuiWindowFlags_NoDocking)) {
+		// General settings
+		if (ImGui::CollapsingHeader("General", ImGuiTreeNodeFlags_DefaultOpen))
+			for (uint i = 0; i < _colors.size(); ++i)
+				ImGui::ColorEdit4(colorNames[i], &_colors[i].x);
+
+		// ImGui settings
+		if (ImGui::CollapsingHeader("ImGui", ImGuiTreeNodeFlags_DefaultOpen)) {
+			ImGuiStyle &style = ImGui::GetStyle();
+			for (int i = 0; i < ImGuiCol_COUNT; ++i)
+				ImGui::ColorEdit4(ImGui::GetStyleColorName(i), &style.Colors[i].x);
+		}
+	}
+	ImGui::End();
+}
+
 void ScummEditor::render() {
+	ImGui::DockSpaceOverViewport(0, ImGui::GetMainViewport(), ImGuiDockNodeFlags_PassthruCentralNode);
+
 	// Menu bar
 	if (ImGui::BeginMainMenuBar()) {
-		ImGui::Text(ICON_MS_CONSTRUCTION);
+		ImGui::Text(ICON_EDITOR);
 		ImGui::TextDisabled(_gameName.c_str());
 		ImGui::Separator();
 		if (ImGui::BeginMenu("File")) {
@@ -93,9 +183,17 @@ void ScummEditor::render() {
 				_engine->quitGame();
 			ImGui::EndMenu();
 		}
+		if (ImGui::BeginMenu("View")) {
+			ImGui::MenuItem(ICON_SETTINGS " Settings", nullptr, &_showSettings);
+			ImGui::EndMenu();
+		}
 		ImGui::EndMainMenuBar();
 	}
 
+	// Settings window
+	if (_showSettings)
+		showSettings();
+
 	saveState();
 }
 
diff --git a/engines/scumm/debugger/editor.h b/engines/scumm/debugger/editor.h
index dd5f47cd091..dd91269a192 100644
--- a/engines/scumm/debugger/editor.h
+++ b/engines/scumm/debugger/editor.h
@@ -22,20 +22,40 @@
 #ifndef SCUMM_EDITOR_H
 #define SCUMM_EDITOR_H
 
+#include "backends/imgui/imgui.h"
+
+#include "common/array.h"
 #include "common/str.h"
 
 namespace Scumm {
 
 class ScummEngine;
 
+namespace Editor {
+
+enum {
+	kColorLabel,
+	kColorProperty,
+	kColorWarning,
+	kColorError,
+	kColorCount
+};
+
+} // End of namespace Editor
+
 class ScummEditor {
 private:
 	ScummEngine *_engine;
 	Common::String _gameName;
 
+	Common::Array<ImVec4> _colors;
+	bool _showSettings;
+
 	void loadState();
 	void saveState();
 
+	void showSettings();
+
 public:
 	ScummEditor(ScummEngine *engine);
 




More information about the Scummvm-git-logs mailing list