1 #ifndef LXGUI_GUI_TEXTURE_HPP
2 #define LXGUI_GUI_TEXTURE_HPP
4 #include "lxgui/gui_gradient.hpp"
5 #include "lxgui/gui_layered_region.hpp"
6 #include "lxgui/gui_quad.hpp"
7 #include "lxgui/lxgui.hpp"
8 #include "lxgui/utils.hpp"
37 std::string
serialize(
const std::string& tab)
const override;
40 void render()
const override;
163 void set_tex_rect(
const std::array<float, 4>& texture_rect);
174 void set_tex_coord(
const std::array<float, 8>& texture_coords);
197 void set_texture(std::shared_ptr<render_target> target);
238 void parse_attributes_(
const layout_node& node)
override;
239 void parse_tex_coords_node_(
const layout_node& node);
240 void parse_gradient_node_(
const layout_node& node);
242 const std::vector<std::string>& get_type_list_()
const override;
244 void update_dimensions_from_tex_coord_();
245 void update_borders_()
override;
247 using content = std::variant<color, std::string, gradient>;
252 bool is_desaturated_ =
false;
253 bool is_texture_stretching_enabled_ =
true;
Holds a single color (float RGBA, 128 bits)
A region that can be rendered in a layer.
layered_region(utils::control_block &block, manager &mgr, const region_core_attributes &attr)
Constructor.
An node in a layout file.
Manages the user interface.
The base class of all elements in the GUI.
Abstract type for implementation specific management.
A layered_region that can draw images and colored rectangles.
bool get_texture_stretching() const
Checks if this texture can stretch to match the region dimensions.
std::string serialize(const std::string &tab) const override
Prints all relevant information about this region in a string.
void set_gradient(const gradient &g)
Adds a gradient effect to this texture.
void set_blend_mode(blend_mode mode)
Sets this texture's blending mode.
void copy_from(const region &obj) override
Copies a region's parameters into this texture (inheritance).
void set_tex_rect(const std::array< float, 4 > &texture_rect)
Sets this texture's texture coordinates.
static constexpr const char * class_name
const gradient & get_gradient() const
Returns this texture's gradient.
material::filter get_filter_mode() const
Returns this texture's filtering algorithm.
void set_solid_color(const color &c)
Sets this texture's color.
const color & get_solid_color() const
Returns this texture's color.
void set_desaturated(bool is_desaturated)
Makes this texture appear without any color.
void set_tex_coord(const std::array< float, 8 > &texture_coords)
Sets this texture's texture coordinates.
void set_texture_stretching(bool texture_stretching)
Sets whether this texture can stretch to match the region dimensions.
texture(utils::control_block &block, manager &mgr, const region_core_attributes &attr)
Constructor.
bool has_solid_color() const
Checks if this texture is defined as solid color.
color get_vertex_color(std::size_t index) const
Returns this texture's vertex color.
void set_filter_mode(material::filter filt)
Sets this texture's filtering mode.
blend_mode get_blend_mode() const
Returns this texture's blending mode.
const std::string & get_texture_file() const
Returns this texture's texture file.
void set_quad(const quad &q)
Directly sets this texture's underlying quad (vertices and material).
static void register_on_lua(sol::state &lua)
Registers this region class to the provided Lua state.
bool is_desaturated() const
Checks if this texture is desaturated.
void set_vertex_color(const color &c, std::size_t index=std::numeric_limits< std::size_t >::max())
Sets this texture's vertex color.
void parse_layout(const layout_node &node) override
Parses data from a layout_node.
std::array< float, 8 > get_tex_coord() const
Returns this texture's texture coordinates.
bool has_texture_file() const
Checks if this texture is defined as a texture file.
void render() const override
Renders this region on the current render target.
bool has_gradient() const
Checks if this texture is defined as a gradient.
void set_texture(const std::string &file_name)
Sets this texture's texture file.
blend_mode
Specifies the rendering mode of a quad.
Represents color gradients.
Simple structure holding four vertices and a material.
Struct holding all the core information about a region necessary for its creation.