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

sev- noreply at scummvm.org
Thu Sep 5 18:29:17 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:
dc14edf532 QDENGINE: DT: Implement animation playback


Commit: dc14edf53201766a6f699436e593c723d446485c
    https://github.com/scummvm/scummvm/commit/dc14edf53201766a6f699436e593c723d446485c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-09-05T20:28:48+02:00

Commit Message:
QDENGINE: DT: Implement animation playback

Changed paths:
    engines/qdengine/debugger/debugtools.cpp
    engines/qdengine/debugger/dt-internal.h


diff --git a/engines/qdengine/debugger/debugtools.cpp b/engines/qdengine/debugger/debugtools.cpp
index 14d6d9640e8..e37a6387098 100644
--- a/engines/qdengine/debugger/debugtools.cpp
+++ b/engines/qdengine/debugger/debugtools.cpp
@@ -28,6 +28,7 @@
 #include "common/compression/unzip.h"
 #include "common/debug.h"
 #include "common/path.h"
+#include "common/system.h"
 
 #include "graphics/opengl/shader.h"
 #include "graphics/managed_surface.h"
@@ -195,7 +196,9 @@ void showArchives() {
 				_state->_qdaToDisplayFrame %= totalFrames;
 			}
 			ImGui::SameLine();
-			ImGui::Button("\ue037"); // Play    // play_arrow
+			if (ImGui::Button("\ue037")) // Play    // play_arrow
+				_state->_qdaIsPlaying = !_state->_qdaIsPlaying;
+
 			ImGui::SameLine();
 			if (ImGui::Button("\ue044")) { // Skip Next    // skip_next
 				_state->_qdaToDisplayFrame += 1;
@@ -262,6 +265,13 @@ void onImGuiRender() {
 	if (!_state)
 		return;
 
+	if (_state->_qdaIsPlaying && g_system->getMillis() > _state->_qdaNextFrameTimestamp) {
+		_state->_qdaToDisplayFrame++;
+		_state->_qdaToDisplayFrame %= _state->_qdaToDisplayFrameCount;
+
+		_state->_qdaNextFrameTimestamp = g_system->getMillis() + 50; // 20 fps
+	}
+
 	ImGui::GetIO().ConfigFlags &= ~(ImGuiConfigFlags_NoMouseCursorChange | ImGuiConfigFlags_NoMouse);
 
 	if (ImGui::BeginMainMenuBar()) {
diff --git a/engines/qdengine/debugger/dt-internal.h b/engines/qdengine/debugger/dt-internal.h
index 382e361c6d3..1609c66e22b 100644
--- a/engines/qdengine/debugger/dt-internal.h
+++ b/engines/qdengine/debugger/dt-internal.h
@@ -38,6 +38,8 @@ typedef struct ImGuiState {
 	Common::Path _qdaToDisplay;
 	int _qdaToDisplayFrame = -1;
 	int _qdaToDisplayFrameCount = 0;
+	bool _qdaIsPlaying = false;
+	int _qdaNextFrameTimestamp = 0;
 } ImGuiState;
 
 extern ImGuiState *_state;




More information about the Scummvm-git-logs mailing list