]> Dogcows Code - chaz/yoink/blobdiff - src/moof/video.hh
remove some unused stlplus modules
[chaz/yoink] / src / moof / video.hh
index ea331a02bfe2a0f76a068e9dc53df16a27e87bfd..6b4980e519fb48391f5249bb109cf3d979f8f1a5 100644 (file)
@@ -1,13 +1,11 @@
 
-/*]  Copyright (c) 2009-2010, Charles McGarvey  [**************************
+/*]  Copyright (c) 2009-2011, Charles McGarvey  [*****************************
 **]  All rights reserved.
 *
-* vi:ts=4 sw=4 tw=75
-*
 * Distributable under the terms and conditions of the 2-clause BSD license;
 * see the file COPYING for a complete text of the license.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_VIDEO_HH_
 #define _MOOF_VIDEO_HH_
 #include <SDL/SDL.h>
 
 #include <moof/backend.hh>
+#include <moof/math.hh>
+#include <moof/timer.hh>
 
 
 namespace moof {
 
 
+// forward declarations
 class settings;
 
 class video;
 typedef boost::shared_ptr<video> video_ptr;
 
-
 class video
 {
 public:
 
        struct attributes
        {
-               int                     color_buffer[4];                // rgba
-               int                     frame_buffer;
-               bool            is_double_buffer;
-               int                     depth_buffer;
-               int                     stencil_buffer;
-               int                     accumulator_buffer[4];  // rgba
-               bool            is_stereo;
-               int                     multisample_buffers;
-               int                     multisample_samples;
-               bool            is_swap_control;
-               bool            is_hardware_only;
-               int                     mode[3];                                // width, height, bpp
-               bool            is_fullscreen;
-               bool            is_resizable;
-               bool            is_cursor_visible;
-               bool            is_cursor_captured;
+               int     color_buffer[4];        // rgba
+               int     frame_buffer;
+               bool    is_double_buffer;
+               int     depth_buffer;
+               int     stencil_buffer;
+               int     accumulator_buffer[4];  // rgba
+               bool    is_stereo;
+               int     multisample_buffers;
+               int     multisample_samples;
+               bool    is_swap_control;
+               bool    is_hardware_only;
+               int     mode[3];                // width, height, bpp
+               bool    is_fullscreen;
+               bool    is_resizable;
+               bool    is_cursor_visible;
+               bool    is_cursor_captured;
 
                attributes();
                attributes(const settings& settings);
@@ -64,10 +64,9 @@ public:
 
                void init();
 
-               backend         mBackend;
+               backend backend_;
        };
 
-
        static video_ptr alloc(const attributes& attribs)
        {
                return video_ptr(new video(attribs));
@@ -76,7 +75,7 @@ public:
        explicit video(const std::string& caption = "Moof!!");
        explicit video(const class attributes& attribs);
        explicit video(const std::string& caption,
-                                  const class attributes& attribs);
+                       const class attributes& attribs);
        ~video();
 
        class attributes attributes() const;
@@ -87,7 +86,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;
@@ -105,12 +104,10 @@ public:
        bool cursor_captured() const;
        void toggle_cursor_captured();
 
-
        /**
         * Swap the video buffers if double-buffered.
         */
-       void swap();
-
+       void swap(scalar t = timer::ticks());
 
        /**
         * Make this video context the current context which will be effected
@@ -126,7 +123,6 @@ public:
                return current_;
        }
 
-
        /**
         * Get the width of the video display.
         * \return The pixel width.
@@ -139,6 +135,18 @@ 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:
 
@@ -150,8 +158,13 @@ private:
        // TODO: this implementation is not well hidden
 
        SDL_Surface*            context_;
-       int                                     flags_;
+       int                     flags_;
        class attributes        attributes_;
+       bool                    show_fps_;
+       std::string             caption_;
+       scalar                  fps_accumulator_;
+       int                     fps_counter_;
+       scalar                  last_swap_;
 
        static video*           current_;
 };
This page took 0.022186 seconds and 4 git commands to generate.