#pragma once #include "src/entity-type.hpp" #include //#include namespace Corrade::Containers { template class BasicStringView; using StringView = BasicStringView; template class ArrayView; } // namespace Corrade::Containers namespace floormat { struct world; struct global_coords; struct entity; struct anim_atlas; struct vobj_info; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wweak-vtables" #endif struct vobj_factory { constexpr vobj_factory() = default; virtual constexpr ~vobj_factory() noexcept = default; virtual const vobj_info& info() const = 0; virtual entity_type type() const = 0; virtual std::shared_ptr make(world& w, object_id id, global_coords pos) const = 0; StringView name() const; StringView descr() const; std::shared_ptr atlas() const; }; #ifdef __clang__ #pragma clang diagnostic pop #endif struct vobj_editor final { vobj_editor(); void select_type(entity_type type); void clear_selection(); [[nodiscard]] static const vobj_factory* get_factory(entity_type type); bool is_type_selected(entity_type type) const; bool is_anything_selected() const; static void place_tile(world& w, global_coords pos, const vobj_factory& factory); static auto cbegin() noexcept { return _types.cbegin(); } static auto cend() noexcept { return _types.cend(); } static auto begin() noexcept { return _types.cbegin(); } static auto end() noexcept { return _types.cend(); } private: static const ArrayView _types; const vobj_factory* _selected = nullptr; }; } // namespace floormat