Objects¶
-
namespace
tnt
-
namespace
doo
Variables
-
struct tnt::doo::objects_sys
objects
¶
-
struct
object_data
¶ - #include <Objects.hpp>
A struct that holds the basic data of an object.
Public Functions
-
constexpr
object_data
(float angle_, Vector const &pos_, Vector const &scale_, object const &parent_ = null) noexcept¶ Create a new object data handle from the given params.
- Parameters
angle_
: The initial angle of the object.scale_
: The initial scale of the object.pos_
: The initial position of the object.parent_
: The parent of the new object. Leave it as is if you don’t want the object to have a parent.
-
constexpr
-
struct
objects_sys
¶ - #include <Objects.hpp>
A struct that handles objects data.
Public Functions
-
object
add_object
(object_data const &data_) noexcept¶ Create a new object in place and add it to the system. Return the id of the newly created
object
.- Return
tnt::doo::object
-
object_data
get_data
(object const &id) const noexcept¶ Get the data of the object with the given id.
- Return
- Parameters
id
: The id of the object.
-
object
from_json
(nlohmann::json const &j)¶ Load objects data from a json chunk.
- Return
The id of the created object.
- Parameters
j
: The json chunk that contains the objects data.
-
void
to_json
(object const &id, nlohmann::json &j)¶ Store general data of a specific object to a json chunk.
- Parameters
id
: The id of the object to serialize to json.j
: The json chunk where the data will be saved.
-
void
draw_imgui
(object const &id, Window const &win) noexcept¶ Draw widgets on the given window to modify the datas of the system.
- Parameters
id
: The id of the active object.win
: The window where to draw the widgets.
-
float
gAngle
(object const &id) const noexcept¶ Get the angle of the object in global context.
- Return
float
- Note
The function returns angle[id] if the object has no parent (aka. parent[id] == -1).
- Parameters
id
: The id of the object.
-
Vector
gScale
(object const &id) const noexcept¶ Get the scale of the object in global context.
- Return
- Note
The function returns scale[id] if the object has no parent (aka. parent[id] == -1).
- Parameters
id
: The id of the object.
-
Vector
gPos
(object const &id) const noexcept¶ Get the position of the object in global context.
- Return
- Note
The function returns pos[id] if the object has no parent (aka. parent[id] == -1).
- Parameters
id
: The id of the object.
-
void
set_parent
(object const &id, object const &parent_) noexcept¶ Change the parent of the given object and apply all the necessary changes.
- Parameters
id
: The id of the child object.parent_
: The id of the new parent.
-
object
-
struct tnt::doo::objects_sys
-
namespace