From 5d7ddd8c2d714439ad07b54622600b11a9e980a0 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 31 Oct 2020 13:00:48 +0100 Subject: Remove pugl::Clock This is nice, but it bloats the header quite a bit for something that may not be used and requires the C++ standard library. --- bindings/cxx/include/pugl/pugl.hpp | 46 -------------------------------------- 1 file changed, 46 deletions(-) diff --git a/bindings/cxx/include/pugl/pugl.hpp b/bindings/cxx/include/pugl/pugl.hpp index d5a91fb..19cf3fe 100644 --- a/bindings/cxx/include/pugl/pugl.hpp +++ b/bindings/cxx/include/pugl/pugl.hpp @@ -25,7 +25,6 @@ #include "pugl/pugl.h" #include -#include #include #include #include @@ -220,8 +219,6 @@ strerror(const Status status) noexcept @{ */ -class World; - /// @copydoc PuglWorldType enum class WorldType { program, ///< @copydoc PUGL_PROGRAM @@ -239,36 +236,6 @@ static_assert(WorldFlag(PUGL_WORLD_THREADS) == WorldFlag::threads, ""); using WorldFlags = PuglWorldFlags; ///< @copydoc PuglWorldFlags -/** - A `std::chrono` compatible clock that uses Pugl time. -*/ -class Clock -{ -public: - using rep = double; ///< Time representation - using duration = std::chrono::duration; ///< Duration in seconds - using time_point = std::chrono::time_point; ///< A Pugl time point - - static constexpr bool is_steady = true; ///< Steady clock flag, always true - - /// Construct a clock that uses time from puglGetTime() - explicit Clock(World& world) - : _world{world} - {} - - Clock(const Clock&) = delete; - Clock& operator=(const Clock&) = delete; - - Clock(Clock&&) = delete; - Clock& operator=(Clock&&) = delete; - - /// Return the current time - time_point now() const; - -private: - const World& _world; -}; - /// @copydoc PuglWorld class World : public detail::Wrapper { @@ -281,7 +248,6 @@ public: explicit World(WorldType type, WorldFlags flags) : Wrapper{puglNewWorld(static_cast(type), flags)} - , _clock(*this) { if (!cobj()) { throw std::runtime_error("Failed to create pugl::World"); @@ -313,20 +279,8 @@ public: { return static_cast(puglUpdate(cobj(), timeout)); } - - /// Return a clock that uses Pugl time - const Clock& clock() { return _clock; } - -private: - Clock _clock; }; -inline Clock::time_point -Clock::now() const -{ - return time_point{duration{_world.time()}}; -} - /** @} @name View -- cgit v1.2.1