#pragma once #include #include #include #include #include #include "Event.h" #include "J3ML/LinearAlgebra/Vector2i.hpp" #pragma once inline int CellToIndex(Vector2i cell, int width) { return cell.y*width + cell.x; } namespace JsonConversions { Color4 parse_color(const json::value& v); json::value deparse_color_to_hex(const Color4& color); std::vector parse_string_list(const json::value& v); json::value deparse_string_list(const std::vector& list); } // namespace JsonConversions template struct Lerped { T goal; T current; float rate; void Step(float elapsed); }; template <> inline void Lerped::Step(float elapsed) { current = Math::Lerp(current, goal, rate*elapsed);} template <> inline void Lerped::Step(float elapsed) { current = Vector2::Lerp(current, goal, rate*elapsed);} std::string read_file_contents(const std::filesystem::path& file_path); bool write_file_contents(const std::filesystem::path& file_path, const std::string& contents); std::vector split (const std::string &s, char delim);