Advertisement
Tkap1

Untitled

Dec 14th, 2022
791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. constexpr int count = 5;
  2. static float times[count] = zero;
  3.  
  4. for(int i = 0; i < count; i++)
  5. {
  6.     s_v2 size = v2(200, 64);
  7.     size.x += times[i] * 20;
  8.     s_v2 pos = v2(c_world_size.x - size.x, 400 + i * 100);
  9.     pos.x -= times[i] * 10;
  10.     if(mouse_collides_rect_tl(input->mouse, pos, size))
  11.     {
  12.         times[i] = clamp(times[i] + delta * 10, 0.0f, 1.0f);
  13.     }
  14.     else
  15.     {
  16.         times[i] = clamp(times[i] - delta * 2, 0.0f, 1.0f);
  17.     }
  18.     s_v4 col = lerp_v4(WHITE, GREEN, times[i]);
  19.     ui_rect(pos, size, col);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement