#pragma once #include #include #include #include "drawtypes/icon.hpp" namespace drawtypes { class Animation { std::vector> frames; int num_frames = 0; int current_frame= 0; int framerate_ms = 1000; std::chrono::system_clock::time_point updated_at; void tick(); public: Animation(std::vector> &&frames, int framerate_ms = 1); explicit Animation(int framerate_ms) : framerate_ms(framerate_ms){} void add(std::unique_ptr &&frame); std::unique_ptr &get(); int get_framerate(); operator bool() { return !this->frames.empty(); } }; std::unique_ptr get_config_animation(std::string config_path, std::string animation_name = "animation", bool required = true); }