Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
ui_image.hpp
Go to the documentation of this file.
1
8
9
#pragma once
10
#include <optional>
11
#include <
toast/assets/core_types.hpp
>
12
#include <
toast/export.hpp
>
13
#include <
toast/ui/tga_decode.hpp
>
14
15
namespace
assets {
16
17
class
TOAST_API UIImage :
public
Asset {
18
public
:
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
39
private
:
40
std::vector<uint8_t> m_data;
41
mutable
std::optional<ui::TgaImage> m_decoded;
42
};
43
44
}
core_types.hpp
Base types for the asset system.
export.hpp
tga_decode.hpp
Minimal TGA decoder for UI images.
engine
src
toast
ui
assets
ui_image.hpp
Generated by
1.17.0