Toast Engine
Loading...
Searching...
No Matches
ui_image.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <optional>
12#include <toast/export.hpp>
14
15namespace assets {
16
17class TOAST_API UIImage : public Asset {
18public:
19 explicit UIImage(std::vector<uint8_t> data) : m_data(std::move(data)) {
20 // We decode the image on load
21 m_decoded = ui::decodeTga(m_data);
22 }
23
24 [[nodiscard]]
25 auto type() const -> std::string_view override {
26 return "ui_image";
27 }
28
29 [[nodiscard]]
30 auto get() const noexcept -> const std::vector<uint8_t>& {
31 return m_data;
32 }
33
34 [[nodiscard]]
35 auto decoded() const -> const std::optional<ui::TgaImage>& {
36 return m_decoded;
37 }
38
39private:
40 std::vector<uint8_t> m_data;
41 mutable std::optional<ui::TgaImage> m_decoded;
42};
43
44}
Base types for the asset system.
Minimal TGA decoder for UI images.