]>
Dogcows Code - chaz/yoink/blob - src/moof/video.hh
8b42cfddd8b9e181f0f94706f97c6aaf41c67c78
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>
26 #include <moof/math.hh>
27 #include <moof/timer.hh>
36 typedef boost::shared_ptr
<video
> video_ptr
;
45 int color_buffer
[4]; // rgba
47 bool is_double_buffer
;
50 int accumulator_buffer
[4]; // rgba
52 int multisample_buffers
;
53 int multisample_samples
;
55 bool is_hardware_only
;
56 int mode
[3]; // width, height, bpp
59 bool is_cursor_visible
;
60 bool is_cursor_captured
;
63 attributes(const settings
& settings
);
73 static video_ptr
alloc(const attributes
& attribs
)
75 return video_ptr(new video(attribs
));
78 explicit video(const std::string
& caption
= "Moof!!");
79 explicit video(const class attributes
& attribs
);
80 explicit video(const std::string
& caption
,
81 const class attributes
& attribs
);
84 class attributes
attributes() const;
86 void mode(const int mode
[3]);
88 void resize(int width
, int height
);
91 void caption(const std::string
& caption
);
92 const std::string
& caption() const;
94 void fullscreen(bool full
);
95 bool fullscreen() const;
96 void toggle_fullscreen();
98 void resizable(bool is_resizable
);
99 bool resizable() const;
100 void toggle_resizable();
102 void cursor_visible(bool is_cursor_visible
);
103 bool cursor_visible() const;
104 void toggle_cursor_visible();
106 void cursor_captured(bool is_cursor_captured
);
107 bool cursor_captured() const;
108 void toggle_cursor_captured();
112 * Swap the video buffers if double-buffered.
114 void swap(scalar t
= timer::ticks());
118 * Make this video context the current context which will be effected
119 * by future draw commands.
121 void make_current() const;
124 * Get the current video context where draw commands are sent.
126 static video
* current()
133 * Get the width of the video display.
134 * \return The pixel width.
139 * Get the height of the video display.
140 * \return The pixel height.
145 void show_fps(bool show
)
148 fps_accumulator_
= SCALAR(0.0);
150 last_swap_
= SCALAR(0.0);
153 bool show_fps() const
163 void recreate_context();
164 void set_opengl_attributes();
166 // TODO: this implementation is not well hidden
168 SDL_Surface
* context_
;
170 class attributes attributes_
;
172 std::string caption_
;
173 scalar fps_accumulator_
;
177 static video
* current_
;
183 #endif // _MOOF_VIDEO_HH_
This page took 0.039586 seconds and 3 git commands to generate.