/** Displays the race results for a single kart. * \param n Index of the kart to be displayed. * \param display_points True if GP points should be displayed, too */ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, unsigned int n, bool display_points) { RowInfo *ri = &(m_all_row_infos[n]); video::SColor color = ri->m_is_player_kart ? video::SColor(255,255,0, 0 ) : video::SColor(255,255,255,255); #ifdef USE_PER_LINE_BACKGROUND // Draw the background image core::rect<s32> dest(x-50, y, x+50+m_table_width, (int)(y+m_distance_between_rows)); ri->m_box_params.setTexture(irr_driver->getTexture( (file_manager->getGUIDir() + "skins/glass/glassbutton_focused.png").c_str() ) ); GUIEngine::getSkin()->drawBoxFromStretchableTexture(&(ri->m_widget_container), dest, ri->m_box_params); #endif unsigned int current_x = x; // First draw the icon // ------------------- if(ri->m_kart_icon) { core::recti source_rect(core::vector2di(0,0), ri->m_kart_icon->getSize()); core::recti dest_rect(current_x, y, current_x+m_width_icon, y+m_width_icon); irr_driver->getVideoDriver()->draw2DImage(ri->m_kart_icon, dest_rect, source_rect, NULL, NULL, true); current_x += m_width_icon + m_width_column_space; } // Draw the name // ------------- core::recti pos_name(current_x, y, UserConfigParams::m_width, y+m_distance_between_rows); m_font->draw(ri->m_kart_name, pos_name, color); current_x += m_width_kart_name + m_width_column_space; // Draw the time except in FTL mode // -------------------------------- if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER) { core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); m_font->draw(ri->m_finish_time_string, dest_rect, color); current_x += m_width_finish_time + m_width_column_space; } // Only display points in GP mode and when the GP results are displayed. // ===================================================================== if(race_manager->getMajorMode()!=RaceManager::MAJOR_MODE_GRAND_PRIX || m_animation_state == RR_RACE_RESULT) return; // Draw the new points // ------------------- if(ri->m_new_points>0) { core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); core::stringw point_string = core::stringw("+") + core::stringw((int)ri->m_new_points); // With mono-space digits space has the same width as each digit, so // we can simply fill up the string with spaces to get the right // aligned. while(point_string.size()<3) point_string = core::stringw(" ")+point_string; m_font->draw(point_string, dest_rect, color); } current_x += m_width_new_points +m_width_column_space; // Draw the old_points plus increase value // --------------------------------------- core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); core::stringw point_inc_string = core::stringw((int)(ri->m_current_displayed_points)); while(point_inc_string.size()<3) point_inc_string = core::stringw(" ")+point_inc_string; m_font->draw(point_inc_string, dest_rect, color); } // displayOneEntry
/** Displays the race results for a single kart. * \param n Index of the kart to be displayed. * \param display_points True if GP points should be displayed, too */ void RaceResultGUI::displayOneEntry(unsigned int x, unsigned int y, unsigned int n, bool display_points) { RowInfo *ri = &(m_all_row_infos[n]); video::SColor color = ri->m_is_player_kart ? video::SColor(255,255,0, 0 ) : video::SColor(255,255,255,255); unsigned int current_x = x; // First draw the icon // ------------------- if(ri->m_kart_icon) { core::recti source_rect(core::vector2di(0,0), ri->m_kart_icon->getSize()); core::recti dest_rect(current_x, y, current_x+m_width_icon, y+m_width_icon); draw2DImage(ri->m_kart_icon, dest_rect, source_rect, NULL, NULL, true); } current_x += m_width_icon + m_width_column_space; // Draw the name // ------------- core::recti pos_name(current_x, y, UserConfigParams::m_width, y+m_distance_between_rows); m_font->draw(ri->m_kart_name, pos_name, color, false, false, NULL, true /* ignoreRTL */); current_x += m_width_kart_name + m_width_column_space; // Draw the time except in FTL mode // -------------------------------- if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_FOLLOW_LEADER) { core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); m_font->draw(ri->m_finish_time_string, dest_rect, color, false, false, NULL, true /* ignoreRTL */); current_x += m_width_finish_time + m_width_column_space; } // Only display points in GP mode and when the GP results are displayed. // ===================================================================== if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX && m_animation_state != RR_RACE_RESULT) { // Draw the new points // ------------------- if(ri->m_new_points > 0) { core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); core::stringw point_string = core::stringw("+") + core::stringw((int)ri->m_new_points); // With mono-space digits space has the same width as each digit, // so we can simply fill up the string with spaces to get the // right aligned. while(point_string.size()<3) point_string = core::stringw(" ")+point_string; m_font->draw(point_string, dest_rect, color, false, false, NULL, true /* ignoreRTL */); } current_x += m_width_new_points + m_width_column_space; // Draw the old_points plus increase value // --------------------------------------- core::recti dest_rect = core::recti(current_x, y, current_x+100, y+10); core::stringw point_inc_string = core::stringw((int)(ri->m_current_displayed_points)); while(point_inc_string.size()<3) point_inc_string = core::stringw(" ")+point_inc_string; m_font->draw(point_inc_string, dest_rect, color, false, false, NULL, true /* ignoreRTL */); } } // displayOneEntry