/* This file is part of Zutty. * Copyright (C) 2020 Tom Szilagyi * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * See the file LICENSE for the full license. */ #pragma once #include "charvdev.h" #include "frame.h" #include #include #include #include #include #include namespace zutty { class Renderer { public: Renderer (const std::function & initDisplay, const std::function & swapBuffers, Fontpack* fontpk); ~Renderer (); void update (const Frame& frame); private: std::unique_ptr charVdev; const std::function swapBuffers; Frame nextFrame; uint64_t seqNo = 0; bool done = false; std::condition_variable cond; std::mutex mx; std::thread thr; void renderThread (const std::function & initDisplay, Fontpack* fontpk); }; } // namespace zutty