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

A single texture holding multiple materials for efficient rendering. More...

#include <gui_atlas.hpp>

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

Public Member Functions

 atlas_page (material::filter filt)
 Constructor. More...
 
virtual ~atlas_page ()=default
 Destructor. More...
 
 atlas_page (const atlas_page &)=delete
 Non-copiable. More...
 
 atlas_page (atlas_page &&)=delete
 Non-movable. More...
 
atlas_pageoperator= (const atlas_page &)=delete
 Non-copiable. More...
 
atlas_pageoperator= (atlas_page &&)=delete
 Non-movable. 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

virtual std::shared_ptr< materialadd_material_ (const material &mat, const bounds2f &location)=0
 Adds a new material to this page, at the provided location. More...
 
virtual float get_width_ () const =0
 Return the width of this page (in pixels). More...
 
virtual float get_height_ () const =0
 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 25 of file gui_atlas.hpp.

Constructor & Destructor Documentation

◆ atlas_page() [1/3]

lxgui::gui::atlas_page::atlas_page ( material::filter  filt)
explicit

Constructor.

Parameters
filtUse texture filtering or not (see material::set_filter())

Definition at line 12 of file gui_atlas.cpp.

◆ ~atlas_page()

virtual lxgui::gui::atlas_page::~atlas_page ( )
virtualdefault

Destructor.

Reimplemented in lxgui::gui::sdl::atlas_page, and lxgui::gui::gl::atlas_page.

◆ atlas_page() [2/3]

lxgui::gui::atlas_page::atlas_page ( const atlas_page )
delete

Non-copiable.

◆ atlas_page() [3/3]

lxgui::gui::atlas_page::atlas_page ( atlas_page &&  )
delete

Non-movable.

Member Function Documentation

◆ add_font()

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

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 
)

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_()

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

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

Implemented in lxgui::gui::sfml::atlas_page, lxgui::gui::sdl::atlas_page, and lxgui::gui::gl::atlas_page.

◆ empty()

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

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

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

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_()

virtual float lxgui::gui::atlas_page::get_height_ ( ) const
protectedpure virtual

Return the height of this page (in pixels).

Returns
The height of this page (in pixels)

Implemented in lxgui::gui::sfml::atlas_page, lxgui::gui::sdl::atlas_page, and lxgui::gui::gl::atlas_page.

◆ get_width_()

virtual float lxgui::gui::atlas_page::get_width_ ( ) const
protectedpure virtual

Return the width of this page (in pixels).

Returns
The width of this page (in pixels)

Implemented in lxgui::gui::sfml::atlas_page, lxgui::gui::sdl::atlas_page, and lxgui::gui::gl::atlas_page.

◆ operator=() [1/2]

atlas_page& lxgui::gui::atlas_page::operator= ( atlas_page &&  )
delete

Non-movable.

◆ operator=() [2/2]

atlas_page& lxgui::gui::atlas_page::operator= ( const atlas_page )
delete

Non-copiable.

Member Data Documentation

◆ filter_

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

Definition at line 106 of file gui_atlas.hpp.


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