#pragma once #include #include #include "audio_stream.hpp" #include "canvas.hpp" #include "manager.hpp" #include "resources.hpp" #include "settings.hpp" namespace anm2ed::imgui { class AnimationPreview : public Canvas { MIX_Mixer* mixer = MIX_CreateMixerDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, nullptr); AudioStream audioStream = AudioStream(mixer); bool wasPlaybackPlaying{}; bool isFocused{}; bool isPreviewHovered{}; bool isSizeTrySet{true}; Settings savedSettings{}; float savedZoom{}; glm::vec2 savedPan{}; int savedOverlayIndex{}; uint64_t savedOverlayDocumentId{}; glm::vec2 mousePos{}; glm::vec2 checkerPan{}; glm::vec2 checkerSyncPan{}; float checkerSyncZoom{}; bool isCheckerPanInitialized{}; bool hasPendingZoomPanAdjust{}; bool isMoveDragging{}; glm::vec2 moveOffset{}; glm::vec2 nullRectScaleAnchor{}; std::filesystem::path renderTempDirectory{}; std::vector renderTempFrames{}; std::vector renderFrameSoundIDs{}; int renderFrameIndex{}; int renderFrameCount{}; int renderFrameRate{1}; int renderAnimationFps{1}; int renderFrameSoundTimePrev{-1}; public: AnimationPreview(); bool is_focused_get() const; void tick(Manager&, Settings&, float); void update(Manager&, Settings&, Resources&); }; }