sync and delivery (and unused read) states and other smaller refactors

This commit is contained in:
2024-01-12 16:45:52 +01:00
parent 7c576dd4d0
commit 20b4cdc5f1
9 changed files with 147 additions and 25 deletions

View File

@ -6,6 +6,11 @@
#include <imgui/imgui.h>
// fwd
namespace Message {
uint64_t getTimeMS(void);
}
SendImagePopup::SendImagePopup(TextureUploaderI& tu) : _tu(tu) {
_image_loaders.push_back(std::make_unique<ImageLoaderSDLBMP>());
_image_loaders.push_back(std::make_unique<ImageLoaderWebP>());
@ -76,7 +81,7 @@ bool SendImagePopup::load(void) {
}
}
preview_image.timestamp_last_rendered = getNowMS();
preview_image.timestamp_last_rendered = Message::getTimeMS();
preview_image.current_texture = 0;
for (const auto& [ms, data] : original_image.frames) {
const auto n_t = _tu.uploadRGBA(data.data(), original_image.width, original_image.height);
@ -169,7 +174,7 @@ void SendImagePopup::render(float time_delta) {
const auto TEXT_BASE_WIDTH = ImGui::CalcTextSize("A").x;
const auto TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing();
preview_image.doAnimation(getNowMS());
preview_image.doAnimation(Message::getTimeMS());
time += time_delta;
time = fmod(time, 1.f); // fract()