Changeset 364
- Timestamp:
- 05/15/15 12:52:52 (10 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/handle.hh
r350 r364 67 67 }; 68 68 69 template < typename HANDLE >69 template < typename HANDLE, typename INDEX = sint32 > 70 70 class handle_manager 71 71 { 72 static const sint32 NONE = -1; 73 static const sint32 USED = -2; 72 typedef INDEX index_type; 73 static const index_type NONE = index_type(-1); 74 static const index_type USED = index_type(-2); 74 75 public: 75 76 … … 98 99 if ( m_last_free == NONE ) 99 100 { 100 m_first_free = m_last_free = index;101 m_first_free = m_last_free = (index_type)index; 101 102 return; 102 103 } 103 m_entries[( unsigned)m_last_free].next_free =index;104 m_last_free = index;104 m_entries[(value_type)m_last_free].next_free = (index_type)index; 105 m_last_free = (index_type)index; 105 106 } 106 107 … … 118 119 { 119 120 value_type counter; 120 sint32next_free;121 index_type next_free; 121 122 122 123 index_entry() : counter( 0 ), next_free( NONE ) {} … … 137 138 } 138 139 139 sint32m_first_free;140 sint32m_last_free;140 index_type m_first_free; 141 index_type m_last_free; 141 142 std::vector< index_entry > m_entries; 142 143 }; -
trunk/nv/core/string.hh
r363 r364 328 328 } 329 329 330 inline NV_CONSTEXPR c onst char front() const { return m_data[0]; }331 inline NV_CONSTEXPR c onst char back() const { return m_data[m_size - 1]; }330 inline NV_CONSTEXPR char front() const { return m_data[0]; } 331 inline NV_CONSTEXPR char back() const { return m_data[m_size - 1]; } 332 332 inline NV_CONSTEXPR const char* data() const { return m_data; } 333 333 … … 351 351 { 352 352 if ( pos >= m_size ) return npos; 353 const_iterator it = std::search( this->cbegin() + pos, this->cend(), s.cbegin(), s.cend() );354 return it == this->cend() ? npos : std::distance( this->cbegin(), it );353 const_iterator it = std::search( this->cbegin() + ( difference_type ) pos, this->cend(), s.cbegin(), s.cend() ); 354 return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it ); 355 355 } 356 356 size_type find( char c, size_type pos = 0 ) const 357 357 { 358 358 if ( pos >= m_size ) return npos; 359 const_iterator it = std::find_if( this->cbegin() + pos, this->cend(), [=] ( char val ) { return val == c; } );360 return it == this->cend() ? npos : std::distance( this->cbegin(), it );359 const_iterator it = std::find_if( this->cbegin() + ( difference_type ) pos, this->cend(), [=] ( char val ) { return val == c; } ); 360 return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it ); 361 361 } 362 362 size_type rfind( const string_base& s, size_type pos = 0 ) const 363 363 { 364 364 if ( pos >= m_size ) return npos; 365 const_reverse_iterator it = std::search( this->crbegin() + pos, this->crend(), s.crbegin(), s.crend() );366 return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );365 const_reverse_iterator it = std::search( this->crbegin() + ( difference_type ) pos, this->crend(), s.crbegin(), s.crend() ); 366 return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it ); 367 367 } 368 368 size_type rfind( char c, size_type pos = 0 ) const 369 369 { 370 370 if ( pos >= m_size ) return npos; 371 const_reverse_iterator it = std::find_if( this->crbegin() + pos, this->crend(), [=] ( char val ) { return val == c; } );372 return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );371 const_reverse_iterator it = std::find_if( this->crbegin() + ( difference_type ) pos, this->crend(), [=] ( char val ) { return val == c; } ); 372 return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it ); 373 373 } 374 374 size_type find_first_of( char c ) const { return find( c ); } … … 376 376 { 377 377 const_iterator it = std::find_first_of( this->cbegin(), this->cend(), s.cbegin(), s.cend() ); 378 return it == this->cend() ? npos : std::distance( this->cbegin(), it );378 return it == this->cend() ? npos : ( size_type )std::distance( this->cbegin(), it ); 379 379 } 380 380 size_type find_last_of( char c ) const { return rfind( c ); } … … 382 382 { 383 383 const_reverse_iterator it = std::find_first_of( this->crbegin(), this->crend(), s.cbegin(), s.cend() ); 384 return it == this->crend() ? npos : m_size - 1 - std::distance( this->crbegin(), it );384 return it == this->crend() ? npos : m_size - 1 - ( size_type )std::distance( this->crbegin(), it ); 385 385 } 386 386 size_type find_first_not_of( const string_base& s ) const … … 388 388 for ( const_iterator it = this->cbegin(); it != this->cend(); ++it ) 389 389 if ( 0 == std::memchr( s.m_data, *it, s.m_size ) ) 390 return std::distance( this->cbegin(), it );390 return ( size_type )std::distance( this->cbegin(), it ); 391 391 return npos; 392 392 } … … 395 395 for ( const_iterator it = this->cbegin(); it != this->cend(); ++it ) 396 396 if ( c != *it ) 397 return std::distance( this->cbegin(), it );397 return ( size_type )std::distance( this->cbegin(), it ); 398 398 return npos; 399 399 } … … 402 402 for ( const_reverse_iterator it = this->crbegin(); it != this->crend(); ++it ) 403 403 if ( 0 == std::memchr( s.m_data, *it, s.m_size ) ) 404 return m_size - 1 - std::distance( this->crbegin(), it );;404 return m_size - 1 - ( size_type )std::distance( this->crbegin(), it );; 405 405 return npos; 406 406 } … … 409 409 for ( const_reverse_iterator it = this->crbegin(); it != this->crend(); ++it ) 410 410 if ( c != *it ) 411 return m_size - 1 - std::distance( this->crbegin(), it );411 return m_size - 1 - ( size_type )std::distance( this->crbegin(), it ); 412 412 return npos; 413 413 } … … 618 618 if ( os.good() ) 619 619 { 620 os.write( str.data(), st r.size() );620 os.write( str.data(), static_cast<std::streamsize>( str.size() ) ); 621 621 } 622 622 return os; -
trunk/nv/engine/program_manager.hh
r319 r364 24 24 public: 25 25 program_manager( context* a_context ); 26 virtual const char*get_storage_name() const { return "programs"; }27 virtual const char*get_resource_name() const { return "program"; }26 virtual string_ref get_storage_name() const { return "programs"; } 27 virtual string_ref get_resource_name() const { return "program"; } 28 28 protected: 29 29 virtual resource_id load_resource( lua::table_guard& table ); -
trunk/nv/engine/resource_system.hh
r323 r364 32 32 resource_manager_base() : m_lua( nullptr ) {} 33 33 void initialize( lua::state* state ); 34 virtual const char*get_storage_name() const = 0;35 virtual const char*get_resource_name() const = 0;34 virtual string_ref get_storage_name() const = 0; 35 virtual string_ref get_resource_name() const = 0; 36 36 virtual void clear() { m_names.clear(); } 37 37 void load_all(); -
trunk/nv/gl/gl_window.hh
r343 r364 32 32 virtual string get_title() const { return std::string(); } 33 33 // TODO : implement? 34 virtual void set_swap_control( bool ) {} ;34 virtual void set_swap_control( bool ) {} 35 35 36 36 virtual bool is_event_pending() { return m_input->is_event_pending(); } -
trunk/nv/interface/input.hh
r326 r364 24 24 virtual bool is_event_pending() = 0; 25 25 virtual bool poll_event( io_event& event ) = 0; 26 virtual ~input() {} ;26 virtual ~input() {} 27 27 }; 28 28 -
trunk/nv/interface/window_manager.hh
r326 r364 30 30 virtual void sleep( uint32 ms ) = 0; 31 31 virtual uint32 get_ticks() = 0; 32 virtual ~window_manager() {} 32 33 }; 33 34 -
trunk/nv/lua/lua_handle.hh
r333 r364 68 68 { 69 69 typedef handle_operator<H> hop; 70 detail::handle_struct h = detail::to_handle_impl( L, index, hop::get_index( handle ), hop::get_counter( handle) );70 detail::handle_struct h = detail::to_handle_impl( L, index, hop::get_index( def ), hop::get_counter( def ) ); 71 71 return hop::create( h.index, h.counter ); 72 72 }; -
trunk/src/engine/resource_system.cc
r361 r364 12 12 { 13 13 m_lua = a_lua_state; 14 std::string constructor_name( get_resource_name() ); 15 constructor_name = "register_"+constructor_name; 16 int correct = 0; 17 lua::register_storage( m_lua, get_storage_name(), constructor_name ); 14 lua::register_storage( m_lua, get_storage_name(), "register_" + get_resource_name().to_string() ); 18 15 } 19 16 -
trunk/src/gl/gl_context.cc
r342 r364 734 734 if ( slots[i] > OUTPUT_7 ) buffers[i] = 0; 735 735 } 736 glDrawBuffers( count, buffers );736 glDrawBuffers( (GLsizei)count, buffers ); 737 737 } 738 738 -
trunk/src/gl/gl_device.cc
r361 r364 56 56 { 57 57 load_sdl_image_library(); 58 SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, size ), 1, "tga" );58 SDL_Surface* image = IMG_LoadTyped_RW( SDL_RWFromMem( (void*)data, (int)size ), 1, "png" ); 59 59 if ( !image ) 60 60 { … … 402 402 403 403 const char* pc = shader_code.data(); 404 int l = shader_code.length();404 int l = (int)shader_code.length(); 405 405 406 406 glShaderSource( glid, 1, &pc, &l ); -
trunk/src/gui/gui_ascii_renderer.cc
r356 r364 80 80 for ( int x = 0; x < abs.get_width(); ++x ) 81 81 { 82 m_terminal->print( position( abs.ul.y, abs.ul.x + x ), er->border_color, er->border_chars[0] );83 m_terminal->print( position( abs.lr.y, abs.ul.x + x ), er->border_color, er->border_chars[1] );82 m_terminal->print( position( abs.ul.y, abs.ul.x + x ), er->border_color, (unsigned char)er->border_chars[0] ); 83 m_terminal->print( position( abs.lr.y, abs.ul.x + x ), er->border_color, (unsigned char)er->border_chars[1] ); 84 84 } 85 85 86 86 for ( int y = 0; y < abs.get_height(); ++y ) 87 87 { 88 m_terminal->print( position( abs.ul.y + y, abs.ul.x ), er->border_color, er->border_chars[2] );89 m_terminal->print( position( abs.ul.y + y, abs.lr.x ), er->border_color, er->border_chars[3] );88 m_terminal->print( position( abs.ul.y + y, abs.ul.x ), er->border_color, (unsigned char)er->border_chars[2] ); 89 m_terminal->print( position( abs.ul.y + y, abs.lr.x ), er->border_color, (unsigned char)er->border_chars[3] ); 90 90 } 91 91 92 m_terminal->print( abs.ul, er->border_color, er->border_chars[4] );93 m_terminal->print( abs.ur(), er->border_color, er->border_chars[5] );94 m_terminal->print( abs.ll(), er->border_color, er->border_chars[6] );95 m_terminal->print( abs.lr, er->border_color, er->border_chars[7] );92 m_terminal->print( abs.ul, er->border_color, (unsigned char)er->border_chars[4] ); 93 m_terminal->print( abs.ur(), er->border_color, (unsigned char)er->border_chars[5] ); 94 m_terminal->print( abs.ll(), er->border_color, (unsigned char)er->border_chars[6] ); 95 m_terminal->print( abs.lr, er->border_color, (unsigned char)er->border_chars[7] ); 96 96 } 97 97 if ( !e->m_text.empty() ) … … 100 100 for ( char c : e->m_text ) 101 101 { 102 m_terminal->print( p, er->text_color, c );102 m_terminal->print( p, er->text_color, (unsigned char)c ); 103 103 ++p.x; 104 104 } … … 111 111 } 112 112 113 void nv::gui::ascii_renderer::on_hover_change( element* e, bool hover)113 void nv::gui::ascii_renderer::on_hover_change( element* e, bool /*hover*/ ) 114 114 { 115 115 // TODO: FIX 116 int fix_me; 116 117 NV_LOG( nv::LOG_DEBUG, "on_hover_change" ); 117 118 e->m_flags[DIRTY] = true; 118 119 } 119 120 120 void nv::gui::ascii_renderer::on_select_change( element* e, bool select)121 void nv::gui::ascii_renderer::on_select_change( element* e, bool /*select*/ ) 121 122 { 122 123 // TODO: FIX 124 int fix_me; 123 125 NV_LOG( nv::LOG_DEBUG, "on_select_change" ); 124 126 e->m_flags[DIRTY] = true; -
trunk/src/gui/gui_gfx_renderer.cc
r354 r364 266 266 vec2 tsize32 = ( image->t2 - image->t1 ) * ( 2.0f / 3.0f ); 267 267 vec2 tsizex = vec2( tsize.x, 0.0f ); 268 vec2 tsizey = vec2( 0.0f, tsize.y );268 //vec2 tsizey = vec2( 0.0f, tsize.y ); 269 269 vec2 tsize3x = vec2( tsize3.x, 0.0f ); 270 270 vec2 tsize3y = vec2( 0.0f, tsize3.y ); … … 343 343 } 344 344 345 void gfx_renderer::on_hover_change( element* e, bool hover)345 void gfx_renderer::on_hover_change( element* e, bool /*hover*/ ) 346 346 { 347 347 // TODO: FIX 348 int fix_me; 348 349 NV_LOG( nv::LOG_DEBUG, "on_hover_change" ); 349 350 e->m_flags[DIRTY] = true; 350 351 } 351 352 352 void gfx_renderer::on_select_change( element* e, bool select)353 void gfx_renderer::on_select_change( element* e, bool /*select*/ ) 353 354 { 354 355 // TODO: FIX 356 int fix_me; 355 357 NV_LOG( nv::LOG_DEBUG, "on_select_change" ); 356 358 e->m_flags[DIRTY] = true; -
trunk/src/lua/lua_handle.cc
r335 r364 15 15 NV_LUA_STACK_ASSERT( L, +1 ); 16 16 lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table 17 lua_rawgeti( L, -1, index );// table, entry17 lua_rawgeti( L, -1, (int)index ); // table, entry 18 18 if ( !lua_istable( L, -1 ) ) 19 19 { … … 57 57 lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); 58 58 lua_insert( L, -2 ); 59 lua_rawseti( L, -2, index );59 lua_rawseti( L, -2, (int)index ); 60 60 lua_pop( L, 1 ); 61 61 } … … 66 66 lua_rawgeti( L, LUA_REGISTRYINDEX, pseudoindex ); // table 67 67 lua_pushinteger( L, 0 ); 68 lua_rawseti( L, -2, index );68 lua_rawseti( L, -2, (int)index ); 69 69 lua_pop( L, 1 ); 70 70 }
Note: See TracChangeset
for help on using the changeset viewer.