#ifndef RenderThread_H #define RenderThread_H #include #include "Critical.h" #include "Thread.h" namespace Framework { class Screen; //! Screen.h class ZeitMesser; //! ZeitMesser.h class Image; //! Image.h //! A thread that manages a screen. It calls the render() and //! tick() functions automatically class RenderTh : public Thread { private: bool stoppen; Screen* bildschirm; ZeitMesser* zeit; double renderTickZeit; void* renderParameter; void* tickParameter; std::function renderFunktion; std::function tickFunktion; bool pause; Critical cs; int maxFps; bool quiet; public: //! Constructor DLLEXPORT RenderTh(); //! Destructor DLLEXPORT ~RenderTh(); //! This is necessary if multiple threads use the object simultaneously. //! If lock() is called by two threads, the latter waits until the //! first has called unlock(). DLLEXPORT void lock(); //! This is necessary if multiple threads use the object simultaneously. //! If lock() is called by two threads, the latter waits until the //! first has called unlock(). DLLEXPORT void unlock(); //! Sets the screen object to be managed //! \param bildschirm The screen DLLEXPORT void setScreen(Screen* bildschirm); //! The function that is automatically executed in a new thread DLLEXPORT void thread() override; //! Starts the render thread DLLEXPORT void beginn(); //! Stops the render thread DLLEXPORT void beenden(); //! if true, then nothing will be printed to std::cout DLLEXPORT void setQuiet(bool quiet); //! Sets the maximum frames per second //! \param fps Maximum frames per second DLLEXPORT void setMaxFps(int fps); //! Pauses the render thread //! \param p 1 if the thread should be paused DLLEXPORT void setPause(bool p); //! Sets the callback function that is always called before drawing //! \param rF The callback function DLLEXPORT void setRenderFunktion( std::function rF); //! Sets the callback function that is always called before updating //! all objects \param tF The callback function DLLEXPORT void setTickFunktion( std::function tF); //! Sets the parameter of the callback function that is always called //! before drawing \param p The parameter DLLEXPORT void setRenderFunktionParameter(void* p); //! Sets the parameter of the callback function that is always called //! before updating all objects DLLEXPORT void setTickFunktionParameter(void* p); //! Returns the screen managed by this thread DLLEXPORT Screen* getScreen() const; //! Returns the screen without increased reference counter managed //! by this thread DLLEXPORT Screen* zScreen() const; //! Returns the time with which the tick() function of the screen //! was last called DLLEXPORT double getRenderTickZeit() const; }; } // namespace Framework #endif