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

A class that holds multiple materials for efficient rendering. More...

#include <gui_atlas.hpp>

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

Public Member Functions

 atlas (renderer &rdr, material::filter filt)
 Constructor. More...
 
virtual ~atlas ()=default
 Destructor. More...
 
 atlas (const atlas &)=delete
 Non-copiable. More...
 
 atlas (atlas &&)=delete
 Non-movable. More...
 
atlasoperator= (const atlas &)=delete
 Non-copiable. More...
 
atlasoperator= (atlas &&)=delete
 Non-movable. More...
 
std::shared_ptr< materialfetch_material (const std::string &file_name) const
 Find a material in this atlas (nullptr if not found). More...
 
std::shared_ptr< materialadd_material (const std::string &file_name, const material &mat)
 Add a new material to the atlas. More...
 
std::shared_ptr< fontfetch_font (const std::string &font_name) const
 Find a font in this atlas (nullptr if not found). More...
 
bool add_font (const std::string &font_name, std::shared_ptr< gui::font > fnt)
 Add a new font to the atlas. More...
 
std::size_t get_page_count () const
 Return the number of pages in this atlas. More...
 

Protected Member Functions

virtual std::unique_ptr< atlas_pagecreate_page_ ()=0
 Create a new page in this atlas. More...
 

Protected Attributes

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

Detailed Description

A class that holds multiple materials for efficient rendering.

This is an abstract class that must be implemented and created by the corresponding gui::renderer.

Definition at line 126 of file gui_atlas.hpp.

Constructor & Destructor Documentation

◆ atlas() [1/3]

lxgui::gui::atlas::atlas ( 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())

Definition at line 159 of file gui_atlas.cpp.

◆ ~atlas()

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

Destructor.

◆ atlas() [2/3]

lxgui::gui::atlas::atlas ( const atlas )
delete

Non-copiable.

◆ atlas() [3/3]

lxgui::gui::atlas::atlas ( atlas &&  )
delete

Non-movable.

Member Function Documentation

◆ add_font()

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

Add a new font to the atlas.

Parameters
font_nameThe name of the font+size
fntThe font to add to this atlas
Returns
'true' if the font was added to this atlas, 'false' otherwise

Definition at line 208 of file gui_atlas.cpp.

◆ add_material()

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

Add a new material to the atlas.

Parameters
file_nameThe name of the file
matThe material to add to this atlas
Returns
The new material

Definition at line 172 of file gui_atlas.cpp.

◆ create_page_()

virtual std::unique_ptr<atlas_page> lxgui::gui::atlas::create_page_ ( )
protectedpure virtual

Create a new page in this atlas.

Returns
The new page, added at the back of the page list

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

◆ fetch_font()

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

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

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

Definition at line 198 of file gui_atlas.cpp.

◆ fetch_material()

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

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

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

Definition at line 161 of file gui_atlas.cpp.

◆ get_page_count()

std::size_t lxgui::gui::atlas::get_page_count ( ) const

Return the number of pages in this atlas.

Returns
The number of pages in this atlas

Definition at line 230 of file gui_atlas.cpp.

◆ operator=() [1/2]

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

Non-movable.

◆ operator=() [2/2]

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

Non-copiable.

Member Data Documentation

◆ filter_

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

Definition at line 194 of file gui_atlas.hpp.

◆ renderer_

renderer& lxgui::gui::atlas::renderer_
protected

Definition at line 193 of file gui_atlas.hpp.


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