12#ifndef TOYMAKERBUILTINS_UIIMAGE_H
13#define TOYMAKERBUILTINS_UIIMAGE_H
17#include "ui_container.hpp"
64 static std::shared_ptr<BaseSimObjectAspect>
create(
const nlohmann::json& jsonAspectProperties);
71 std::shared_ptr<BaseSimObjectAspect>
clone()
const override;
Interface for a single UI element.
Definition ui_container.hpp:18
An object containing closely related methods and data, and exposing object lifecycle and application ...
Definition sim_system.hpp:956
glm::vec2 mAnchor
The point considered the origin of this object, with (0,0) being its top left corner and (1,...
Definition ui_image.hpp:131
static std::shared_ptr< BaseSimObjectAspect > create(const nlohmann::json &jsonAspectProperties)
Creates a new UIImage instance from its description in JSON.
Definition ui_image.cpp:11
bool allowsDescendantControl() const override
Whether the container is permitted to reposition this element's children.
Definition ui_image.hpp:110
void onActivated() override
Loads and displays the image associated with this aspect when it is added to the active scene.
Definition ui_image.cpp:60
glm::vec2 mReferenceCoordinate
The reference coordinate of the parent container, relative to which this element's position is determ...
Definition ui_image.hpp:144
glm::vec3 mOffsets
The offsets, relative to the parent container's reference coordinate, determining the position of thi...
Definition ui_image.hpp:151
glm::vec3 getOffsets() const override
Returns the offsets relative to the container reference coordinates used to position this element's a...
Definition ui_image.hpp:106
std::shared_ptr< BaseSimObjectAspect > clone() const override
Constructs a new UIImage using this object as its blueprint.
Definition ui_image.cpp:50
static std::string getSimObjectAspectTypeName()
Gets the aspect type string associated with this class.
Definition ui_image.hpp:56
UIImage()
Constructs a new UIImage aspect.
Definition ui_image.hpp:49
void updateDimensions(const glm::uvec2 &dimensions)
Changes the dimensions the loaded image should be confined or scaled to (while maintaining its origin...
Definition ui_image.cpp:70
void recomputeTexture()
Recomputes the texture associated with this object's StaticModel.
Definition ui_image.cpp:82
glm::uvec2 mDimensions
The dimensions within which the loaded image will be displayed.
Definition ui_image.hpp:137
void updateAnchor(const glm::vec2 &anchor)
Updates the point considered the origin of this object's StaticModel.
Definition ui_image.cpp:64
void updateImage(const std::string &imageFilepath)
Updates the image associated with this object.
Definition ui_image.cpp:76
glm::vec2 getReferenceCoordinate() const override
Returns the reference coordinate on the container relative to which this element's offsets are define...
Definition ui_image.hpp:102
std::string mImageFilepath
The file from which the image to be displayed was loaded.
Definition ui_image.hpp:125
Namespace containing all class definitions and functions related to the ToyMaker engine.
Definition application.hpp:26
Classes and structs relating to the SimSystem, the system responsible for providing some level of gen...