X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmoof%2Fvideo.hh;h=0b5cb99a7afff09adb7802547eeff0e9ac93c70d;hb=6c9943707d4f33035830eba0587a61a34eaecbc2;hp=ea331a02bfe2a0f76a068e9dc53df16a27e87bfd;hpb=831f04d4bc19a390415ac0bbac4331c7a65509bc;p=chaz%2Fyoink diff --git a/src/moof/video.hh b/src/moof/video.hh index ea331a0..0b5cb99 100644 --- a/src/moof/video.hh +++ b/src/moof/video.hh @@ -23,6 +23,8 @@ #include #include +#include +#include namespace moof { @@ -75,7 +77,7 @@ public: explicit video(const std::string& caption = "Moof!!"); explicit video(const class attributes& attribs); - explicit video(const std::string& caption, + video(const std::string& caption, const class attributes& attribs); ~video(); @@ -87,7 +89,7 @@ public: bool iconify(); void caption(const std::string& caption); - std::string caption() const; + const std::string& caption() const; void fullscreen(bool full); bool fullscreen() const; @@ -109,7 +111,7 @@ public: /** * Swap the video buffers if double-buffered. */ - void swap(); + void swap(scalar t = timer::ticks()); /** @@ -140,6 +142,20 @@ public: int height() const; + void show_fps(bool show) + { + show_fps_ = show; + fps_accumulator_ = SCALAR(0.0); + fps_counter_ = 0; + last_swap_ = SCALAR(0.0); + } + + bool show_fps() const + { + return show_fps_; + } + + private: void init(); @@ -152,6 +168,11 @@ private: SDL_Surface* context_; int flags_; class attributes attributes_; + bool show_fps_; + std::string caption_; + scalar fps_accumulator_; + int fps_counter_; + scalar last_swap_; static video* current_; };