Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
asset_proxy.hpp
Go to the documentation of this file.
1
7
8
#pragma once
9
10
#include <glm/glm.hpp>
11
#include <string>
12
#include <
toast/assets/core_types.hpp
>
13
#include <
toast/uid.hpp
>
14
15
struct
lua_State;
16
17
namespace
luabridge {
18
class
LuaRef;
19
}
20
21
namespace
assets {
22
class
DataValue
;
23
}
24
25
namespace
scripting {
26
27
class
AssetProxy {
28
public
:
29
AssetProxy() =
default
;
30
explicit
AssetProxy(
toast::UID
uid);
31
explicit
AssetProxy(
assets::HandleBase
handle
);
32
33
[[nodiscard]]
34
auto
path()
const
-> std::string;
35
[[nodiscard]]
36
auto
uid()
const
->
toast::UID
;
37
[[nodiscard]]
38
auto
hasValue()
const
-> bool;
39
[[nodiscard]]
40
auto
type()
const
-> std::string;
41
[[nodiscard]]
42
auto
toString()
const
-> std::string;
43
[[nodiscard]]
44
auto
checkType(std::string_view field_type)
const
-> std::string;
45
46
[[nodiscard]]
47
auto
get(
const
std::string& name, lua_State* l)
const
-> luabridge::LuaRef;
48
50
[[nodiscard]]
51
auto
handle
() const noexcept -> const assets::HandleBase& {
52
return
m_handle;
53
}
54
55
private
:
56
assets::HandleBase
m_handle;
57
};
58
59
// Called AFTER the normal luabridge method fails
60
auto
assetProxyIndex(AssetProxy& proxy,
const
luabridge::LuaRef& key, lua_State* l) -> luabridge::LuaRef;
61
62
// Data assets are read-only from Lua, trying to modify them will just panic, if someone complains about this
63
// im killing them (hi dario)
64
auto
assetProxyNewindex(AssetProxy& proxy,
const
luabridge::LuaRef& key,
const
luabridge::LuaRef& value, lua_State* l)
65
-> luabridge::LuaRef;
66
67
auto
dataValueToLuaRef(lua_State* l,
const
assets::DataValue
& value) -> luabridge::LuaRef;
68
69
}
assets::DataValue
Typed value for TOML files.
Definition
data_value.hpp:50
assets::HandleBase
Base class for type-erased asset handles.
Definition
core_types.hpp:72
scripting::AssetProxy::handle
auto handle() const noexcept -> const assets::HandleBase &
Curve assets: the value at t, a number for a 1D curve, a vec2 for a 2D one and a vec3 for a 3D one.
Definition
asset_proxy.hpp:51
core_types.hpp
Base types for the asset system.
toast::UID
Definition
uid.hpp:20
uid.hpp
Unique identifier for everything that exists in our engine.
engine
src
toast
scripting
asset_proxy.hpp
Generated by
1.17.0