]>
Dogcows Code - chaz/yoink/blob - src/moof/video.hh
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
12 #ifndef _MOOF_VIDEO_HH_
13 #define _MOOF_VIDEO_HH_
17 * Classes for managing a video context.
22 #include <boost/shared_ptr.hpp>
25 #include <moof/backend.hh>
34 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
);
71 static video_ptr
alloc(const attributes
& attribs
)
73 return video_ptr(new video(attribs
));
76 explicit video(const std::string
& caption
= "Moof!!");
77 explicit video(const class attributes
& attribs
);
78 explicit video(const std::string
& caption
,
79 const class attributes
& attribs
);
82 class attributes
attributes() const;
84 void mode(const int mode
[3]);
86 void resize(int width
, int height
);
89 void caption(const std::string
& caption
);
90 std::string
caption() const;
92 void fullscreen(bool full
);
93 bool fullscreen() const;
94 void toggle_fullscreen();
96 void resizable(bool is_resizable
);
97 bool resizable() const;
98 void toggle_resizable();
100 void cursor_visible(bool is_cursor_visible
);
101 bool cursor_visible() const;
102 void toggle_cursor_visible();
104 void cursor_captured(bool is_cursor_captured
);
105 bool cursor_captured() const;
106 void toggle_cursor_captured();
110 * Swap the video buffers if double-buffered.
116 * Make this video context the current context which will be effected
117 * by future draw commands.
119 void make_current() const;
122 * Get the current video context where draw commands are sent.
124 static video
* current()
131 * Get the width of the video display.
132 * \return The pixel width.
137 * Get the height of the video display.
138 * \return The pixel height.
147 void recreate_context();
148 void set_opengl_attributes();
150 // TODO: this implementation is not well hidden
152 SDL_Surface
* context_
;
154 class attributes attributes_
;
156 static video
* current_
;
162 #endif // _MOOF_VIDEO_HH_
This page took 0.04448 seconds and 5 git commands to generate.