#include "UI.h"
#include <DxLib.h>
#include <math.h>
void drawUI(const GameInformation * gi, int is_warning)
{

	if ((double)gi->player.health / gi->player.full_health < 0.2 && is_warning) {
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, 128 * (1.0 + sin(gi->count_timer / 5.0)));
		DrawGraph(0, 0, gi->rs.danger_image, true);
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
	}

	DrawGraph(0, 0, gi->rs.UI, true);
	SetDrawBlendMode(DX_BLENDMODE_ALPHA,128);
	DrawBox(1413, 1008, 1413 + 468 - (int)((double)gi->player.health / (double)gi->player.full_health * 468.0), 1038, GetColor(0, 0, 0), true);	//468
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
	DrawBox(1413, 1008, 1413 + 468 - (int)((double)gi->player.disp_health / (double)gi->player.full_health * 468.0), 1038, GetColor(0, 0, 0), true);	//468
	{
		int health = gi->player.disp_health;
		int health3 = health / 100;
		int health2 = (health % 100) / 10;
		int health1 = health % 10;
		if (health3 != 0) DrawGraph(1632, 871, gi->rs.numeric[health3], true);
		if ((health3 == 0 && health2 != 0) || health3 != 0) DrawGraph(1632 + 80, 871, gi->rs.numeric[health2], true);
		DrawGraph(1632 + 160, 871, gi->rs.numeric[health1], true);

	}
}
