Пример #1
0
/**
 * Draw one ETS bar to screen
 */
void HudGaugeEts::blitGauge(int index)
{
	int y_start, y_end, clip_h, w, h, x, y;

	clip_h = fl2i( (1 - Energy_levels[index]) * ETS_bar_h );

	bm_get_info(Ets_bar.first_frame,&w,&h);

	if ( index < NUM_ENERGY_LEVELS-1 ) {
		// some portion of dark needs to be drawn

		setGaugeColor();

		// draw the top portion
		x = position[0] + Top_offsets[0];
		y = position[1] + Top_offsets[1];
		
		renderBitmapEx(Ets_bar.first_frame,x,y,w,clip_h,0,0);			

		// draw the bottom portion
		x = position[0] + Bottom_offsets[0];
		y = position[1] + Bottom_offsets[1];

		y_start = y + (ETS_bar_h - clip_h);
		y_end = y + ETS_bar_h;
		
		renderBitmapEx(Ets_bar.first_frame, x, y_start, w, y_end-y_start, 0, ETS_bar_h-clip_h);			
	}

	if ( index > 0 ) {
		if ( maybeFlashSexp() == 1 ) {
			setGaugeColor(HUD_C_DIM);
			// hud_set_dim_color();
		} else {
			setGaugeColor(HUD_C_BRIGHT);
			// hud_set_bright_color();
		}
		// some portion of recharge needs to be drawn

		// draw the top portion
		x = position[0] + Top_offsets[0];
		y = position[1] + Top_offsets[1];

		y_start = y + clip_h;
		y_end = y + ETS_bar_h;
		
		renderBitmapEx(Ets_bar.first_frame+1, x, y_start, w, y_end-y_start, 0, clip_h);			

		// draw the bottom portion
		x = position[0] + Bottom_offsets[0];
		y = position[1] + Bottom_offsets[1];
		
		renderBitmapEx(Ets_bar.first_frame+2, x,y,w,ETS_bar_h-clip_h,0,0);			
	}
}
void HudGaugeThrottle::renderThrottleLine(int y_line)
{
	// hud_set_bright_color();
	//setGaugeColor(HUD_C_BRIGHT);

	renderBitmapEx(throttle_frames.first_frame+3, 
		position[0], y_line, 
		throttle_w, 1, 
		0, 
		y_line-position[1]);
}
void HudGaugeThrottle::renderThrottleBackground(int y_end)
{
	int w,h;

	//setGaugeColor();

	bm_get_info( throttle_frames.first_frame+1,&w,&h);

	if ( y_end > position[1] ) {
		renderBitmapEx(throttle_frames.first_frame+1, position[0], position[1], w, y_end-position[1]+1, 0, 0);		
	}
}
void HudGaugeThrottle::renderThrottleForeground(int y_end)
{
	int w,h;

	//setGaugeColor();

	bm_get_info(throttle_frames.first_frame+1,&w,&h);

	if ( y_end < (position[1] + h - 1) ) {		
		renderBitmapEx(throttle_frames.first_frame + 2, position[0], y_end, w, h - (y_end - position[1]), 0, y_end - position[1]);
	}
}