diff --git a/headers/enduro2d/high/_all.hpp b/headers/enduro2d/high/_all.hpp index 8e3cac51..a67813d7 100644 --- a/headers/enduro2d/high/_all.hpp +++ b/headers/enduro2d/high/_all.hpp @@ -24,7 +24,7 @@ #include "assets/text_asset.hpp" #include "assets/texture_asset.hpp" #include "assets/xml_asset.hpp" -#include "assets/bmfont_asset.hpp" +#include "assets/font_asset.hpp" #include "components/actor.hpp" #include "components/camera.hpp" @@ -34,9 +34,11 @@ #include "components/renderer.hpp" #include "components/scene.hpp" #include "components/sprite_renderer.hpp" +#include "components/label.hpp" #include "systems/flipbook_system.hpp" #include "systems/render_system.hpp" +#include "systems/label_system.hpp" #include "address.hpp" #include "asset.hpp" diff --git a/headers/enduro2d/high/_high.hpp b/headers/enduro2d/high/_high.hpp index 81356c1e..35662531 100644 --- a/headers/enduro2d/high/_high.hpp +++ b/headers/enduro2d/high/_high.hpp @@ -36,7 +36,7 @@ namespace e2d class text_asset; class texture_asset; class xml_asset; - class bmfont_asset; + class font_asset; class actor; class camera; @@ -46,9 +46,11 @@ namespace e2d class renderer; class scene; class sprite_renderer; + class label; class flipbook_system; class render_system; + class label_system; template < typename Asset, typename Content > class content_asset; @@ -69,5 +71,4 @@ namespace e2d class sprite; class starter; class world; - class bmfont; } diff --git a/headers/enduro2d/high/assets/bmfont_asset.hpp b/headers/enduro2d/high/assets/font_asset.hpp similarity index 85% rename from headers/enduro2d/high/assets/bmfont_asset.hpp rename to headers/enduro2d/high/assets/font_asset.hpp index 0dc1bff6..b85e895f 100644 --- a/headers/enduro2d/high/assets/bmfont_asset.hpp +++ b/headers/enduro2d/high/assets/font_asset.hpp @@ -9,11 +9,10 @@ #include "../_high.hpp" #include "../library.hpp" -#include "../bmfont.hpp" namespace e2d { - class bmfont_asset final : public content_asset { + class font_asset final : public content_asset { public: static const char* type_name() noexcept { return "bmfont_asset"; } static load_async_result load_async(const library& library, str_view address); diff --git a/headers/enduro2d/high/components/label.hpp b/headers/enduro2d/high/components/label.hpp new file mode 100644 index 00000000..0495292d --- /dev/null +++ b/headers/enduro2d/high/components/label.hpp @@ -0,0 +1,85 @@ +/******************************************************************************* + * This file is part of the "Enduro2D" + * For conditions of distribution and use, see copyright notice in LICENSE.md + * Copyright (C) 2018-2019, by Matvey Cherevko (blackmatov@gmail.com) + ******************************************************************************/ + +#pragma once + +#include "../_high.hpp" + +#include "../factory.hpp" +#include "../assets/font_asset.hpp" + +namespace e2d +{ + class label final { + public: + label() = default; + label(const str_view text); + + label& text(const str_view text) noexcept; + const str& text() const noexcept; + + label& dirty(bool dirty) noexcept; + bool dirty() const noexcept; + + label& font(const font_asset::ptr& font) noexcept; + const font_asset::ptr& font() const noexcept; + private: + bool dirty_ = false; + str text_; + font_asset::ptr font_; + }; + + template <> + class factory_loader