|
|
|
@ -88,6 +88,7 @@ static sg_image image_mystery;
|
|
|
|
|
static sg_image image_explosion;
|
|
|
|
|
static sg_image image_low_health;
|
|
|
|
|
static sg_image image_mic_muted;
|
|
|
|
|
static sg_image image_mic_unmuted;
|
|
|
|
|
static sg_image image_flag_available;
|
|
|
|
|
static sg_image image_flag_taken;
|
|
|
|
|
static sg_image image_squad_invite;
|
|
|
|
@ -403,6 +404,7 @@ init(void)
|
|
|
|
|
image_explosion = load_image("loaded/explosion.png");
|
|
|
|
|
image_low_health = load_image("loaded/low_health.png");
|
|
|
|
|
image_mic_muted = load_image("loaded/mic_muted.png");
|
|
|
|
|
image_mic_unmuted = load_image("loaded/mic_unmuted.png");
|
|
|
|
|
image_flag_available = load_image("loaded/flag_available.png");
|
|
|
|
|
image_flag_taken = load_image("loaded/flag_ripped.png");
|
|
|
|
|
image_squad_invite = load_image("loaded/squad_invite.png");
|
|
|
|
@ -564,7 +566,7 @@ static void
|
|
|
|
|
ui(bool draw, float dt, float width, float height)
|
|
|
|
|
{
|
|
|
|
|
static float cur_opacity = 1.0f;
|
|
|
|
|
cur_opacity = lerp(cur_opacity, myentity() != NULL ? 1.0f : 0.0f, dt * 5.0f);
|
|
|
|
|
cur_opacity = lerp(cur_opacity, myentity() != NULL ? 1.0f : 0.0f, dt * 4.0f);
|
|
|
|
|
if (cur_opacity <= 0.01f)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
@ -823,21 +825,32 @@ ui(bool draw, float dt, float width, float height)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// draw muted
|
|
|
|
|
static float muted_opacity = 0.0f;
|
|
|
|
|
static float toggle_mute_opacity = 0.2f;
|
|
|
|
|
const float size = 150.0f;
|
|
|
|
|
AABB button = (AABB){
|
|
|
|
|
.x = width - size - 40.0f,
|
|
|
|
|
.y = height - size - 40.0f,
|
|
|
|
|
.width = size,
|
|
|
|
|
.height = size,
|
|
|
|
|
};
|
|
|
|
|
bool hovered = has_point(button, mouse_pos);
|
|
|
|
|
if (build_pressed && hovered)
|
|
|
|
|
{
|
|
|
|
|
muted = !muted;
|
|
|
|
|
build_pressed = false;
|
|
|
|
|
}
|
|
|
|
|
if (draw)
|
|
|
|
|
{
|
|
|
|
|
muted_opacity = lerp(muted_opacity, muted ? 1.0f : 0.0f, 8.0f * dt);
|
|
|
|
|
sgp_set_color(1.0f, 1.0f, 1.0f, muted_opacity);
|
|
|
|
|
float size_x = 150.0f;
|
|
|
|
|
float size_y = 150.0f;
|
|
|
|
|
toggle_mute_opacity = lerp(toggle_mute_opacity, hovered ? 1.0f : 0.2f, 6.0f * dt);
|
|
|
|
|
sgp_set_color(1.0f, 1.0f, 1.0f, toggle_mute_opacity);
|
|
|
|
|
if (muted)
|
|
|
|
|
sgp_set_image(0, image_mic_muted);
|
|
|
|
|
|
|
|
|
|
float x = width - size_x - 40.0f;
|
|
|
|
|
float y = height - size_y - 40.0f;
|
|
|
|
|
else
|
|
|
|
|
sgp_set_image(0, image_mic_unmuted);
|
|
|
|
|
transform_scope
|
|
|
|
|
{
|
|
|
|
|
sgp_scale_at(1.0f, -1.0f, x + size_x / 2.0f, y + size_y / 2.0f);
|
|
|
|
|
sgp_draw_textured_rect(x, y, size_x, size_y);
|
|
|
|
|
sgp_scale_at(1.0f, -1.0f, button.x + button.width / 2.0f, button.y + button.height / 2.0f);
|
|
|
|
|
sgp_draw_textured_rect(button.x, button.y, button.width, button.height);
|
|
|
|
|
sgp_reset_image(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1541,10 +1554,6 @@ void event(const sapp_event* e)
|
|
|
|
|
cur_editing_rotation += 1;
|
|
|
|
|
cur_editing_rotation %= RotationLast;
|
|
|
|
|
}
|
|
|
|
|
if (e->key_code == SAPP_KEYCODE_M)
|
|
|
|
|
{
|
|
|
|
|
muted = !muted;
|
|
|
|
|
}
|
|
|
|
|
if (e->key_code == SAPP_KEYCODE_F11)
|
|
|
|
|
{
|
|
|
|
|
fullscreened = !fullscreened;
|
|
|
|
|