MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / DrawLoading

Method DrawLoading

PanzerChasm/menu_drawer_soft.cpp:321–359  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

319}
320
321void MenuDrawerSoft::DrawLoading( const float progress )
322{
323 const float progress_corrected= std::min( std::max( progress, 0.0f ), 1.0f );
324
325 const PaletteTransformed& palette= *rendering_context_.palette_transformed;
326 uint32_t* const dst_pixels= rendering_context_.window_surface_data;
327 const int dst_row_pixels= rendering_context_.row_pixels;
328
329 const Picture& pic= loading_picture_;
330
331 const int start_x= int( ( rendering_context_.viewport_size.Width () - menu_scale_ * pic.size[0] ) / 2u );
332 const int start_y= int( ( rendering_context_.viewport_size.Height() - menu_scale_ * ( pic.size[1] / 2u ) ) / 2u );
333 const int progress_x= int( progress_corrected * float( pic.size[0] ) );
334
335 for( int y= 0; y < int(pic.size[1] / 2u); y++ )
336 {
337 for( int i= 0; i < 2; i++ )
338 {
339 const int span_x_start= i == 0 ? 0 : progress_x;
340 const int span_x_end= i == 0 ? progress_x : int(pic.size[0]);
341 const int v_shift= i == 0 ? int(pic.size[1]/2u) : 0;
342 for( int x= span_x_start; x < span_x_end; x++ )
343 {
344 const uint32_t color= palette[ pic.data[ x + ( y + v_shift ) * int(pic.size[0]) ] ];
345 for( int sy= 0; sy < int(menu_scale_); sy++ )
346 {
347 const int dst_y= start_y + y * int(menu_scale_) + sy;
348 PC_ASSERT( dst_y >= 0 && dst_y < int(rendering_context_.viewport_size.Height()) );
349 for( int sx= 0; sx < int(menu_scale_); sx++ )
350 {
351 const int dst_x= start_x + x * int(menu_scale_) + sx;
352 PC_ASSERT( dst_x >= 0 && dst_x < int(rendering_context_.viewport_size.Width()) );
353 dst_pixels[ dst_y * dst_row_pixels + dst_x ]= color;
354 }
355 }
356 }
357 }
358 }
359}
360
361void MenuDrawerSoft::DrawPaused()
362{

Callers

nothing calls this directly

Calls 2

WidthMethod · 0.80
HeightMethod · 0.80

Tested by

no test coverage detected