#pragma once #include #include #include #include #include #include #include #include "defaults/defaults.hpp" #include "audio/audio.hpp" class Game; struct AnimationData { SDL_Texture* texture; SDL_Texture* txt_back; SDL_Surface* surface = nullptr; std::vector frames; size_t current_frame = 0; float frame_time = 0.1f; float timer = 0.0f; bool has_audio = false; std::string audio_name; bool reverse = false; bool restart = false; }; struct CharacterAnimation { std::unordered_map idle; std::unordered_map walk; std::unordered_map run; std::unordered_map collect; std::unordered_map cultivating; std::unordered_map planting; std::unordered_map build; std::unordered_map hit; std::unordered_map attack_sword; std::unordered_map hit_woodaxe_stone; std::unordered_map death; std::unordered_map craft; std::unordered_map block; std::unordered_map drinking_river; std::unordered_map eating; }; namespace Animation { extern float animation_frame_time; extern Audio* audio; AnimationData load(SDL_Renderer* renderer, const std::string& path, float frame_width, float frame_height, std::string audio_name, bool reverse, bool restart); void update(AnimationData& anim, float delta_time); }