[Scummvm-git-logs] scummvm master -> d3cd29d0c1c79d610b89ffebce0490c8d12de593

sev- noreply at scummvm.org
Tue May 21 09:07:19 UTC 2024


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

Summary:
d3cd29d0c1 DIRECTOR: DEBUGGER: Render Score window with smaller font


Commit: d3cd29d0c1c79d610b89ffebce0490c8d12de593
    https://github.com/scummvm/scummvm/commit/d3cd29d0c1c79d610b89ffebce0490c8d12de593
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-21T11:06:49+02:00

Commit Message:
DIRECTOR: DEBUGGER: Render Score window with smaller font

Changed paths:
    backends/imgui/imgui_fonts.cpp
    engines/director/debugtools.cpp


diff --git a/backends/imgui/imgui_fonts.cpp b/backends/imgui/imgui_fonts.cpp
index 34a7f2446d5..5f3c6bf4cf1 100644
--- a/backends/imgui/imgui_fonts.cpp
+++ b/backends/imgui/imgui_fonts.cpp
@@ -89,6 +89,7 @@ ImFont *addTTFFontFromArchive(const char *filename, float size_pixels, const ImF
 	}
 
 	uint size = f.size();
+
 	uint8 *ttfFile = new uint8[size];
 	f.read(ttfFile, size);
 	ImGuiIO &io = ImGui::GetIO();
diff --git a/engines/director/debugtools.cpp b/engines/director/debugtools.cpp
index 72b3aaba61d..271d65656cf 100644
--- a/engines/director/debugtools.cpp
+++ b/engines/director/debugtools.cpp
@@ -121,6 +121,8 @@ typedef struct ImGuiState {
 	} _selectedScoreCast;
 
 	int _scoreMode = 0;
+
+	ImFont *_tinyFont = nullptr;
 } ImGuiState;
 
 ImGuiState *_state = nullptr;
@@ -1708,6 +1710,8 @@ static void displayScoreChannel(int ch, int mode, int modeSel) {
 
 	ImGui::TableNextRow();
 
+	ImGui::PushFont(_state->_tinyFont);
+
 	if (modeSel == kModeExtended && mode == kModeExtended)
 		ImGui::TableSetBgColor(ImGuiTableBgTarget_RowBg0, ImGui::GetColorU32(ImGuiCol_TableRowBgAlt));
 
@@ -1776,6 +1780,8 @@ static void displayScoreChannel(int ch, int mode, int modeSel) {
 			_state->_selectedScoreCast.channel = ch;
 		}
 	}
+
+	ImGui::PopFont();
 }
 
 static void showScore() {
@@ -1960,6 +1966,8 @@ static void showScore() {
 
 			ImGui::TableSetupScrollFreeze(1, 1);
 
+			ImGui::PushFont(_state->_tinyFont);
+
 			ImGui::TableSetupColumn("##", flags);
 			for (uint i = 0; i < tableColumns; i++)
 				ImGui::TableSetupColumn(((i + 1) % 5 ? " " : Common::String::format("%-2d", i + 1).c_str()), flags);
@@ -1992,13 +2000,14 @@ static void showScore() {
 			for (uint i = 0; i < tableColumns; i++) {
 				ImGui::TableSetColumnIndex(i + 1);
 				const char *column_name = ImGui::TableGetColumnName(i + 1);
-				ImGui::PushID(i + 1);
 
 				ImGui::SetNextItemWidth(20);
 				ImGui::TableHeader(column_name);
-				ImGui::PopID();
 			}
 
+			ImGui::PopFont();
+
+
 			int mode = _state->_scoreMode;
 
 			for (int ch = 0; ch < (int)numChannels - 1; ch++) {
@@ -2041,6 +2050,8 @@ void onImGuiInit() {
 	ImGui::addTTFFontFromArchive("OpenFontIcons.ttf", 13.f, &icons_config, icons_ranges);
 
 	_state = new ImGuiState();
+
+	_state->_tinyFont = ImGui::addTTFFontFromArchive("FreeSans.ttf", 10.0f, nullptr, nullptr);
 }
 
 void onImGuiRender() {
@@ -2110,6 +2121,9 @@ void onImGuiRender() {
 }
 
 void onImGuiCleanup() {
+	if (_state)
+		delete _state->_tinyFont;
+
 	delete _state;
 	_state = nullptr;
 }




More information about the Scummvm-git-logs mailing list