lxgui
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
lxgui::gui::gl::atlas_page Class Referencefinal

A single texture holding multiple materials for efficient rendering This is an abstract class that must be implemented and created by the corresponding gui::renderer. More...

#include <gui_gl_atlas.hpp>

Inheritance diagram for lxgui::gui::gl::atlas_page:
lxgui::gui::atlas_page

Public Member Functions

 atlas_page (gui::renderer &rdr, material::filter filt)
 Constructor. More...
 
 ~atlas_page () override
 Destructor. More...
 
std::shared_ptr< materialfetch_material (const std::string &file_name) const
 Find a material in this page (nullptr if not found). More...
 
std::shared_ptr< materialadd_material (const std::string &file_name, const material &mat)
 Creates a new material from a texture file. More...
 
std::shared_ptr< fontfetch_font (const std::string &font_name) const
 Find a font in this page (nullptr if not found). More...
 
bool add_font (const std::string &font_name, std::shared_ptr< gui::font > fnt)
 Creates a new font from a texture file. More...
 
bool empty () const
 Checks if this page is empty (contains no materials). More...
 

Protected Member Functions

std::shared_ptr< gui::materialadd_material_ (const gui::material &mat, const bounds2f &location) override
 Adds a new material to this page, at the provided location. More...
 
float get_width_ () const override
 Return the width of this page (in pixels). More...
 
float get_height_ () const override
 Return the height of this page (in pixels). More...
 

Protected Attributes

material::filter filter_ = material::filter::none
 

Detailed Description

A single texture holding multiple materials for efficient rendering This is an abstract class that must be implemented and created by the corresponding gui::renderer.

Definition at line 20 of file gui_gl_atlas.hpp.

Constructor & Destructor Documentation

◆ atlas_page()

lxgui::gui::gl::atlas_page::atlas_page ( gui::renderer rdr,
material::filter  filt 
)
explicit

Constructor.

Parameters
rdrThe renderer with witch to create this atlas
filtUse texture filtering or not (see material::set_filter())

◆ ~atlas_page()

lxgui::gui::gl::atlas_page::~atlas_page ( )
overridevirtual

Destructor.

Reimplemented from lxgui::gui::atlas_page.

Member Function Documentation

◆ add_font()

bool lxgui::gui::atlas_page::add_font ( const std::string &  font_name,
std::shared_ptr< gui::font fnt 
)
inherited

Creates a new font from a texture file.

Parameters
font_nameThe name of the file
fntThe font to add to this page
Returns
The new font (or nullptr if the font could not fit)

Definition at line 51 of file gui_atlas.cpp.

◆ add_material()

std::shared_ptr< gui::material > lxgui::gui::atlas_page::add_material ( const std::string &  file_name,
const material mat 
)
inherited

Creates a new material from a texture file.

Parameters
file_nameThe name of the file
matThe material to add to this page
Returns
The new material (or nullptr if the material could not fit)

Definition at line 25 of file gui_atlas.cpp.

◆ add_material_()

std::shared_ptr<gui::material> lxgui::gui::gl::atlas_page::add_material_ ( const gui::material mat,
const bounds2f location 
)
overrideprotectedvirtual

Adds a new material to this page, at the provided location.

Parameters
matThe material to add
locationThe position at which to insert this material
Returns
A new material pointing to inside this page

Implements lxgui::gui::atlas_page.

◆ empty()

bool lxgui::gui::atlas_page::empty ( ) const
inherited

Checks if this page is empty (contains no materials).

Returns
'true' if the page is empty, 'false' otherwise

Definition at line 72 of file gui_atlas.cpp.

◆ fetch_font()

std::shared_ptr< font > lxgui::gui::atlas_page::fetch_font ( const std::string &  font_name) const
inherited

Find a font in this page (nullptr if not found).

Parameters
font_nameThe name+size of the font
Returns
The font (nullptr if not found)

Definition at line 41 of file gui_atlas.cpp.

◆ fetch_material()

std::shared_ptr< material > lxgui::gui::atlas_page::fetch_material ( const std::string &  file_name) const
inherited

Find a material in this page (nullptr if not found).

Parameters
file_nameThe name of the file
Returns
The material (nullptr if not found)

Definition at line 14 of file gui_atlas.cpp.

◆ get_height_()

float lxgui::gui::gl::atlas_page::get_height_ ( ) const
overrideprotectedvirtual

Return the height of this page (in pixels).

Returns
The height of this page (in pixels)

Implements lxgui::gui::atlas_page.

◆ get_width_()

float lxgui::gui::gl::atlas_page::get_width_ ( ) const
overrideprotectedvirtual

Return the width of this page (in pixels).

Returns
The width of this page (in pixels)

Implements lxgui::gui::atlas_page.

Member Data Documentation

◆ filter_

material::filter lxgui::gui::atlas_page::filter_ = material::filter::none
protectedinherited

Definition at line 106 of file gui_atlas.hpp.


The documentation for this class was generated from the following file: