summaryrefslogtreecommitdiff
path: root/2026/games_submissions/just__jane/src/clock.cpp
blob: fbe1dbb28e9e0584e38f54cd63da6c59d2d2d386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "raylib.h"
#include <algorithm>
#include <clock.hpp>

void Clock::Update() { current_frame_ = std::max(0.0f, (float)current_frame_ - 1); }
void Clock::Draw() {

  DrawCircle(center_position_.x, center_position_.y, radius_, {0x3c, 0x3a, 0x3a, 0xFF});
  DrawCircleSector(
      center_position_,
      radius_ - 2,
      -90,
      -90 + (-360 * (current_frame_ / (float)frame_total_)),
      36,
      {0xDE, 0xAD, 0xFF, 0xFF});
}

bool Clock::TimeIsUp() { return current_frame_ <= 0; }
void Clock::Reset() { current_frame_ = frame_total_; }