[Scummvm-git-logs] scummvm master -> b4370eac349bb6ff8858c98622d81f244387bf9a
sev-
noreply at scummvm.org
Sat Apr 19 10:43:35 UTC 2025
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:
b4370eac34 DIRECTOR: Make rows selectable in Channels display
Commit: b4370eac349bb6ff8858c98622d81f244387bf9a
https://github.com/scummvm/scummvm/commit/b4370eac349bb6ff8858c98622d81f244387bf9a
Author: unknown (john.presley.27 at gmail.com)
Date: 2025-04-19T12:41:53+02:00
Commit Message:
DIRECTOR: Make rows selectable in Channels display
You can now select a channel in the Dear ImGui channels display. Additionally,
the selected channel is stored in ImGuiState in order to refer to it for debug
drawing.
Changed paths:
engines/director/debugger/debugtools.cpp
engines/director/debugger/debugtools.h
engines/director/debugger/dt-internal.h
engines/director/debugger/dt-score.cpp
engines/director/window.cpp
engines/director/window.h
diff --git a/engines/director/debugger/debugtools.cpp b/engines/director/debugger/debugtools.cpp
index d4f724fad82..57837d8eeeb 100644
--- a/engines/director/debugger/debugtools.cpp
+++ b/engines/director/debugger/debugtools.cpp
@@ -404,5 +404,9 @@ void onImGuiCleanup() {
_state = nullptr;
}
+int getSelectedChannel(){
+ return _state ? _state->_selectedChannel : -1;
+}
+
} // namespace DT
} // namespace Director
diff --git a/engines/director/debugger/debugtools.h b/engines/director/debugger/debugtools.h
index a46eb2806d0..68e18857d8e 100644
--- a/engines/director/debugger/debugtools.h
+++ b/engines/director/debugger/debugtools.h
@@ -27,6 +27,7 @@ namespace DT {
void onImGuiInit();
void onImGuiRender();
void onImGuiCleanup();
+int getSelectedChannel();
} // namespace DT
} // namespace Director
diff --git a/engines/director/debugger/dt-internal.h b/engines/director/debugger/dt-internal.h
index eeaa7e12946..9996ed0f998 100644
--- a/engines/director/debugger/dt-internal.h
+++ b/engines/director/debugger/dt-internal.h
@@ -164,6 +164,8 @@ typedef struct ImGuiState {
int _scoreMode = 0;
int _scoreFrameOffset = 1;
+ int _selectedChannel = -1;
+
ImFont *_tinyFont = nullptr;
struct {
diff --git a/engines/director/debugger/dt-score.cpp b/engines/director/debugger/dt-score.cpp
index 7ee269e82fc..9fab7a5edca 100644
--- a/engines/director/debugger/dt-score.cpp
+++ b/engines/director/debugger/dt-score.cpp
@@ -29,6 +29,7 @@
#include "director/movie.h"
#include "director/score.h"
#include "director/sprite.h"
+#include "director/window.h"
namespace Director {
namespace DT {
@@ -587,7 +588,17 @@ void showChannels() {
ImGui::TableNextRow();
ImGui::TableNextColumn();
- ImGui::Text("%-3d", i + 1);
+
+ bool isSelected = (_state->_selectedChannel == i + 1);
+ if (ImGui::Selectable(Common::String::format("%-3d", i + 1).c_str(), isSelected, ImGuiSelectableFlags_SpanAllColumns)) {
+ if (isSelected) {
+ _state->_selectedChannel = -1;
+ g_director->getCurrentWindow()->setDirty(true);
+ } else {
+ _state->_selectedChannel = i + 1;
+ }
+ }
+
ImGui::TableNextColumn();
if (sprite._castId.member) {
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 94d57168ae3..66396cac7cb 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -38,6 +38,7 @@
#include "director/sound.h"
#include "director/sprite.h"
#include "director/castmember/castmember.h"
+#include "director/debugger/debugtools.h"
namespace Director {
@@ -134,6 +135,19 @@ void Window::drawFrameCounter(Graphics::ManagedSurface *blitTo) {
font->drawString(blitTo, msg, blitTo->w - 2 - width, 2, width, _wm->_colorWhite);
}
+void Window::drawChannelBox(Director::Movie *currentMovie, Graphics::ManagedSurface *blitTo, int selectedChannel) {
+ const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
+ Channel *channel = currentMovie->getScore()->_channels[selectedChannel];
+
+ if (!channel->isEmpty()) {
+ Common::Rect bbox = channel->getBbox();
+ blitTo->frameRect(bbox, g_director->_wm->_colorWhite);
+
+ font->drawString(blitTo, Common::String::format("m: %d, ch: %d, fr: %d", channel->_sprite->_castId.member, selectedChannel, channel->_filmLoopFrame ? channel->_filmLoopFrame : channel->_movieTime), bbox.left + 3, bbox.top + 3, 128, g_director->_wm->_colorBlack);
+ font->drawString(blitTo, Common::String::format("m: %d, ch: %d, fr: %d", channel->_sprite->_castId.member, selectedChannel, channel->_filmLoopFrame ? channel->_filmLoopFrame : channel->_movieTime), bbox.left + 2, bbox.top + 2, 128, g_director->_wm->_colorWhite);
+ }
+}
+
bool Window::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
if (!_currentMovie)
return false;
@@ -218,6 +232,10 @@ bool Window::render(bool forceRedraw, Graphics::ManagedSurface *blitTo) {
}
}
+ int selectedChannel = DT::getSelectedChannel();
+ if (selectedChannel > 0)
+ Window::drawChannelBox(_currentMovie, blitTo, selectedChannel);
+
if (g_director->_debugDraw & kDebugDrawCast) {
const Graphics::Font *font = FontMan.getFontByUsage(Graphics::FontManager::kConsoleFont);
diff --git a/engines/director/window.h b/engines/director/window.h
index 7a3ccad6fc3..cc9bf44da54 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -225,6 +225,7 @@ private:
private:
void inkBlitFrom(Channel *channel, Common::Rect destRect, Graphics::ManagedSurface *blitTo = nullptr);
+ static void drawChannelBox(Director::Movie *currentMovie, Graphics::ManagedSurface *blitTo, int selectedChannel);
void drawFrameCounter(Graphics::ManagedSurface *blitTo);
More information about the Scummvm-git-logs
mailing list