LCOV - code coverage report
Current view: top level - engine/input/contexts - glfw.hpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 9 9
Test Date: 2026-03-11 04:45:14 Functions: 100.0 % 5 5

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : #include <jage/engine/input/event.hpp>
       4              : #include <jage/engine/time/durations.hpp>
       5              : 
       6              : #include <jage/engine/input/internal/concepts/event_sink.hpp>
       7              : #include <jage/engine/time/internal/concepts/real_number_duration.hpp>
       8              : 
       9              : #include <functional>
      10              : #include <utility>
      11              : 
      12              : namespace jage::engine::input::contexts {
      13              : template <time::internal::concepts::real_number_duration TTimeDuration,
      14              :           class TEventSink>
      15              :   requires internal::concepts::event_sink<TEventSink, event<TTimeDuration>>
      16              : class glfw {
      17              :   using duration_type_ = TTimeDuration;
      18              :   using event_type_ = event<duration_type_>;
      19              :   using cursor_position_type_ = std::pair<double, double>;
      20              : 
      21              :   cursor_position_type_ cursor_position_{};
      22              :   std::reference_wrapper<TEventSink> event_sink_{};
      23              : 
      24              : public:
      25              :   using duration_type = duration_type_;
      26              :   using event_type = event_type_;
      27              : 
      28           10 :   explicit glfw(TEventSink &event_sink) : event_sink_{event_sink} {}
      29              : 
      30            6 :   auto push(event_type &&event) -> void {
      31            6 :     event_sink_.get().push(std::move(event));
      32            6 :   }
      33              : 
      34            3 :   auto push(const event_type &event) -> void { event_sink_.get().push(event); }
      35              : 
      36              :   [[nodiscard]] auto
      37            2 :   last_known_cursor_position() const -> const cursor_position_type_ & {
      38            2 :     return cursor_position_;
      39              :   }
      40              : 
      41            5 :   [[nodiscard]] auto last_known_cursor_position() -> cursor_position_type_ & {
      42            5 :     return cursor_position_;
      43              :   }
      44              : };
      45              : 
      46              : } // namespace jage::engine::input::contexts
        

Generated by: LCOV version 2.0-1