Commit 8d9d7df3 authored by Florian Oetke's avatar Florian Oetke
Browse files

fixed input capture in game_screen

parent 733262b9
Pipeline #3397 passed with stage
in 3 minutes and 29 seconds
......@@ -28,9 +28,7 @@ namespace phase_shifter::ui {
//_circle_texture = _gui.load_texture("tex:circle"_aid);
}
void Hud_system::update(mirrage::util::Time dt) {
_passed += dt.value();
}
void Hud_system::update(mirrage::util::Time dt) { _passed += dt.value(); }
void Hud_system::draw()
{
......@@ -46,7 +44,7 @@ namespace phase_shifter::ui {
if(ImGui::Begin("hud",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground)) {
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoInputs)) {
ImGui::Text("%i", _beat_system.beat_state().beats_left);
......@@ -59,21 +57,21 @@ namespace phase_shifter::ui {
if(ImGui::Begin("beat",
nullptr,
ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize
| ImGuiWindowFlags_NoBackground)) {
| ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoInputs)) {
ImGui::PushStyleColor(ImGuiCol_Border, "#00000000"_imcolor.Value); // Hide Border
ImVec2 cursor = ImGui::GetCursorScreenPos();
cursor.y += hud_height / 2.f - 10;
auto beat_state = _beat_system.beat_state();
auto beats = _beat_system.time_stamps();
auto beat_index = _beat_system.beat_index() + 1;
//auto line_offset = bar_speed * beat_state.avg_beat_time;
//auto beats = std::clamp(beat_state.beats_left, 0, 5);
//auto line_offset = bar_speed * beat_state.avg_beat_time;
//auto beats = std::clamp(beat_state.beats_left, 0, 5);
ImGui::BeginChild("Line", {viewport.z, bar_height}, true);
ImDrawList* drawList = ImGui::GetWindowDrawList();
while (beat_index < static_cast<int>(beats.size())) {
auto x_offset = (beats[beat_index] - _passed) * bar_speed;
auto height = beat_bar_height * (1.f - glm::smoothstep(0.f, beat_bar_length, x_offset));
while(beat_index < static_cast<int>(beats.size())) {
auto x_offset = (beats[beat_index] - _passed) * bar_speed;
auto height = beat_bar_height * (1.f - glm::smoothstep(0.f, beat_bar_length, x_offset));
auto bar_color = beat_index < static_cast<int>(beats.size() * 0.8f) ? 0xFFFFFFFF : 0xFF0000FF;
ImVec2 p(cursor.x + viewport.z / 2 - x_offset, cursor.y - height / 2.f);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment