コード例 #1
0
ファイル: awesome_boss.c プロジェクト: carriercomm/edgar
static int energyBarDraw()
{
    int width;
    float percentage;

    if (!(self->head->flags & NO_DRAW))
    {
        drawLoopingAnimationToMap();

        percentage = self->health;
        percentage /= self->head->maxHealth;

        width = self->w - 2;

        width *= percentage;

        if (percentage >= 0.5)
        {
            drawBoxToMap(self->x + 1, self->y + 1, width, self->h - 2, 0, 220, 0);
        }

        else if (percentage >= 0.25)
        {
            drawBoxToMap(self->x + 1, self->y + 1, width, self->h - 2, 220, 220, 0);
        }

        else if (percentage > 0)
        {
            drawBoxToMap(self->x + 1, self->y + 1, width, self->h - 2, 220, 0, 0);
        }
    }

    return TRUE;
}
コード例 #2
0
ファイル: light_beam.c プロジェクト: polluks/edgar
static int draw()
{
	if (self->dirX > 0)
	{
		drawBoxToMap(self->x, self->y, self->box.w, 4, 220, 220, 220);
	}

	else if (self->dirX < 0)
	{
		drawBoxToMap(self->x, self->y, self->box.w, 4, 220, 220, 220);
	}

	else if (self->dirY > 0)
	{
		drawBoxToMap(self->x, self->y, 4, self->box.h, 220, 220, 220);
	}

	else if (self->dirY < 0)
	{
		drawBoxToMap(self->x, self->y, 4, self->box.h, 220, 220, 220);
	}

	return TRUE;
}
コード例 #3
0
static int energyBarDraw()
{
	int width;
	float percentage;

	if (self->head->thinkTime != 0)
	{
		drawLoopingAnimationToMap();

		percentage = self->health;
		percentage /= self->head->maxHealth;

		width = self->w - 2;

		width *= percentage;

		drawBoxToMap(self->x + 1, self->y + 1, width, self->h - 2, 0, 220, 0);
	}

	return TRUE;
}