-
Автор темы
- #1
****:
constexpr auto k_max_hp = 100;
const auto bbox_x = bbox.mins( ).x( ), bbox_y = bbox.mins( ).y( ),
bbox_h = bbox.maxs( ).y( ) - bbox.mins( ).y( );
const auto hp = std::clamp( record.m_hp, 0, csgo::k_max_hp );
constexpr auto bar_w = 2.f, stroke = 1.f, pad = 1.f;
const auto outlined_bar_w = stroke * 2.f + bar_w + pad;
const auto bar_x = bbox_x - outlined_bar_w;
const auto bar_h = static_cast< int >(
std::round( hp * bbox_h / static_cast< float >( csgo::k_max_hp ) ) );
m_draw_buffer->outlined_rect( bar_x, bbox_y,
bar_w, bbox_h, sdk::col_t( 0, 0, 0, 120 * alpha_modifier ) );
m_draw_buffer->filled_rect( bar_x - stroke, bbox_y - stroke,
bar_w + ( stroke * 2.f ), bbox_h + ( stroke * 2.f ), sdk::col_t( 0, 0, 0, 220 * alpha_modifier ) );
const auto hayasaka = ( std::clamp< float >( hp, 25, 75 ) - 25.f ) / 50.f;
auto col = sdk::col_t( 120.f + 135.f * ( 1.f - hayasaka ), 50.f + 175.f * hayasaka, 80 );
if ( dormant )
col = sdk::col_t::from_hsba( col.hue( ), 0.f, col.brightness( ),
static_cast< float >( col.a( ) / sdk::col_t::k_lim ) * alpha_modifier );
m_draw_buffer->filled_rect( bar_x, bbox_y + bbox_h - bar_h, bar_w, bar_h, col );
if ( hp != csgo::k_max_hp )
m_small_fonts_8->draw( bar_x, bbox_y + ( bbox_h - bar_h ) - outlined_bar_w, sdk::col_t( 255, 255, 255, 200 * alpha_modifier ),
std::to_string( hp ), sdk::e_align::center | sdk::e_align::outline );
health bar как в GAMESENSE
демонстрация:
special thanks to: sove idesync enQ_broken lxrdjustice Zodiak esoterik
Последнее редактирование: