Changeset 433 for trunk/src/gui


Ignore:
Timestamp:
07/21/15 19:40:00 (10 years ago)
Author:
epyon
Message:
  • string.hh split into separate files
  • string.hh - removed std::string conversions (header still stays though)
Location:
trunk/src/gui
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/gui_environment.cc

    r401 r433  
    3030}
    3131
    32 void nv::gui::environment::load_style( const std::string& filename )
     32void nv::gui::environment::load_style( const string_view& filename )
    3333{
    3434        m_renderer->load_style( filename );
  • trunk/src/gui/gui_gfx_renderer.cc

    r406 r433  
    187187}
    188188
    189 nv::size_t gfx_renderer::load_font( const std::string& filename, nv::size_t size )
    190 {
    191         std::string id_name( filename );
     189nv::size_t gfx_renderer::load_font( const string_view& filename, nv::size_t size )
     190{
     191        std::string id_name( filename.data(), filename.size() );
    192192        char buffer[8]; size_t len = nv::sint32_to_buffer( sint32( size ), buffer );
    193193        id_name.append( std::string( buffer, len ) );
    194         auto i = m_font_names.find( id_name );
     194        string_view id( id_name.c_str(), id_name.size() );
     195        auto i = m_font_names.find( id );
    195196        if ( i != m_font_names.end() )
    196197        {
     
    198199        }
    199200        size_t result = m_fonts.size();
    200         texture_font* f = new texture_font( &m_atlas, filename.c_str(), static_cast<float>( size ) );
     201        texture_font* f = new texture_font( &m_atlas, filename.data(), static_cast<float>( size ) );
    201202        f->load_glyphs( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " );
    202203        m_fonts.push_back( f );
    203204        m_reupload = true;
    204         m_font_names[id_name] = result;
     205        m_font_names[ id ] = result;
    205206        return result;
    206207}
    207208
    208 nv::size_t gfx_renderer::load_image( const std::string& filename )
     209nv::size_t gfx_renderer::load_image( const string_view& filename )
    209210{
    210211        auto i = m_image_names.find( filename );
     
    253254                if ( m_style.get( e, "skin", selector, path ) )
    254255                {
    255                         size_t image_id = load_image( path );
     256                        size_t image_id = load_image( string_view( path.c_str(), path.size() ) );
    256257                        const image_info* image = get_image( image_id );
    257258                        if ( image )
     
    318319                        if ( m_style.get( e, "text_color", selector, color ) && m_style.get( e, "text_font", selector, path ) && m_style.get( e, "text_size", selector, border ) )
    319320                        {
    320                                 size_t font_id = load_font( path, size_t( border ) );
     321                                size_t font_id = load_font( string_view( path.c_str(), path.size() ), size_t( border ) );
    321322                                texture_font* font = get_font( font_id );
    322323                                position p = abs.ul + position( 0, border );
  • trunk/src/gui/gui_renderer.cc

    r395 r433  
    77#include "nv/gui/gui_renderer.hh"
    88
    9 void nv::gui::renderer::load_style( const std::string& filename )
     9void nv::gui::renderer::load_style( const string_view& filename )
    1010{
    1111        m_style.load_style( filename );
  • trunk/src/gui/gui_style.cc

    r406 r433  
    1616}
    1717
    18 void style::load_style( const std::string& filename )
     18void style::load_style( const string_view& filename )
    1919{
    2020        m_lua.do_file( filename );
Note: See TracChangeset for help on using the changeset viewer.