]>
Dogcows Code - chaz/yoink/blob - src/moof/video.hh
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
10 #ifndef _MOOF_VIDEO_HH_
11 #define _MOOF_VIDEO_HH_
15 * Classes for managing a video context.
20 #include <boost/shared_ptr.hpp>
23 #include <moof/backend.hh>
24 #include <moof/math.hh>
25 #include <moof/timer.hh>
31 // forward declarations
35 typedef boost::shared_ptr
<video
> video_ptr
;
43 int color_buffer
[4]; // rgba
45 bool is_double_buffer
;
48 int accumulator_buffer
[4]; // rgba
50 int multisample_buffers
;
51 int multisample_samples
;
53 bool is_hardware_only
;
54 int mode
[3]; // width, height, bpp
57 bool is_cursor_visible
;
58 bool is_cursor_captured
;
61 attributes(const settings
& settings
);
70 static video_ptr
alloc(const attributes
& attribs
)
72 return video_ptr(new video(attribs
));
75 explicit video(const std::string
& caption
= "Moof!!");
76 explicit video(const class attributes
& attribs
);
77 explicit video(const std::string
& caption
,
78 const class attributes
& attribs
);
81 class attributes
attributes() const;
83 void mode(const int mode
[3]);
85 void resize(int width
, int height
);
88 void caption(const std::string
& caption
);
89 const std::string
& caption() const;
91 void fullscreen(bool full
);
92 bool fullscreen() const;
93 void toggle_fullscreen();
95 void resizable(bool is_resizable
);
96 bool resizable() const;
97 void toggle_resizable();
99 void cursor_visible(bool is_cursor_visible
);
100 bool cursor_visible() const;
101 void toggle_cursor_visible();
103 void cursor_captured(bool is_cursor_captured
);
104 bool cursor_captured() const;
105 void toggle_cursor_captured();
108 * Swap the video buffers if double-buffered.
110 void swap(scalar t
= timer::ticks());
113 * Make this video context the current context which will be effected
114 * by future draw commands.
116 void make_current() const;
119 * Get the current video context where draw commands are sent.
121 static video
* current()
127 * Get the width of the video display.
128 * \return The pixel width.
133 * Get the height of the video display.
134 * \return The pixel height.
138 void show_fps(bool show
)
141 fps_accumulator_
= SCALAR(0.0);
143 last_swap_
= SCALAR(0.0);
146 bool show_fps() const
155 void recreate_context();
156 void set_opengl_attributes();
158 // TODO: this implementation is not well hidden
160 SDL_Surface
* context_
;
162 class attributes attributes_
;
164 std::string caption_
;
165 scalar fps_accumulator_
;
169 static video
* current_
;
175 #endif // _MOOF_VIDEO_HH_
This page took 0.046965 seconds and 5 git commands to generate.