#include <video_base.h>
Inheritance diagram for video_base:
Public Methods | |
video_base (void) | |
Default Constructor. | |
virtual | ~video_base (void) |
Destructor. | |
virtual bool | init (unsigned int w, unsigned int h, unsigned int bpp, bool fs)=0 |
Initalizes the video system. More... | |
virtual void | set_title (const std::string &title)=0 |
Sets the title of the window. | |
virtual void | resize (unsigned int width, unsigned int height)=0 |
Resizes the window to width by height. | |
virtual void | start_frame (void)=0 |
Starts a video frame. More... | |
virtual void | end_frame (void)=0 |
Ends a video frame. More... | |
virtual void | toggle_fullscreen (void)=0 |
Toggles fullscreen mode. | |
virtual void | shutdown (void)=0 |
Shuts down the video system. More... | |
unsigned int | get_width (void) const |
Returns the width of the video surface. | |
unsigned int | get_height (void) const |
Returns the height of the video surface. | |
bool | error (void) const |
Returns true if an error has occurred. | |
std::string | get_error (void) |
Returns the error message. | |
double | get_fps (void) const |
Returns the current frames per second. More... | |
double | get_average_fps (void) const |
Returns the current frames per second. More... | |
double | get_elapsed (void) const |
Returns how much time (in seconds) elapsed since the last frame. | |
bool | get_2d (void) const |
Returns true if we are in 2d mode. | |
void | enable_2d (void) |
Enables 2d mode. | |
void | disable_2d (void) |
Disables 2d mode. | |
void | render_string (real_t &x, real_t &y, const gl::ttf *font, real_t size, const std::string &text) |
Renders the string text to the screen. More... | |
void | render_shadowed_string (real_t &x, real_t &y, const gl::ttf *font, real_t size, real_t shadow_offset, const std::string &text) |
Renders the string text to the screen with a shadow. More... | |
void | render_image (const rectf &rect, const gl::texture &texture) |
Render a texture to screen. More... | |
Protected Methods | |
void | clear_error (void) |
Clears the internal error state. | |
void | set_error (const std::string &msg) |
Sets the internal error state. | |
Protected Attributes | |
unsigned int | m_width |
Video surface width. | |
unsigned int | m_height |
Video surface height. | |
bool | m_fullscreen |
true if in fullscreen mode. | |
unsigned int | m_bpp |
Bits per pixel. | |
bool | m_error |
If an error has occurred. | |
std::string | m_error_msg |
clocker | m_clock |
Video system clock. | |
int | m_2d_enabled |
How many time enable_2d( ) has been called without calling disable_2d( ). | |
double | m_fps |
Instantanious frames per second. | |
double | m_avg_fps |
Frames per second averaged over the last 500 ms. | |
double | m_fps_sum |
Sum of fps over last 500ms. | |
unsigned int | m_frame_count |
Elapsed frames since last avg fps calculation. |
Video abstract base class.
Definition at line 15 of file video_base.h.
|
Ends a video frame. This method should be called at the end of each frame. Implemented in video_sdl. |
|
Returns the current frames per second. This stat is updated every 500ms. Definition at line 131 of file video_base.h. References m_avg_fps. |
|
Returns the current frames per second. This stat is updated every frame. Definition at line 123 of file video_base.h. References m_fps. |
|
Initalizes the video system.
Creates a video surface w pixels wide by h pixels in height. If fs is set to
Implemented in video_sdl. |
|
Render a texture to screen. rect is expressed in a 1024x768 virtual window. If the current resolution is not 1024x768, the image will be scaled appropriately. (0,0) is located at the bottom left hand corner of the screen. (1024,768) is located at the top right hand corner of the screen.
Definition at line 102 of file video_base.cpp. References disable_2d, enable_2d, m_2d_enabled, m_width, real_t, gl::render_image, and rectangle::scale. |
|
Renders the string text to the screen with a shadow. x and y are expressed in a 1024x768 virtual window. If the current resolution is not 1024x768, the font text will be scaled appropriately. (0,0) is located at the bottom left hand corner of the screen. (1024,768) is located at the top right hand corner of the screen. Both x and y will be updated with the last pixel drawn to the screen. This pixel is the upper right hand corner of the last character in the string and is expressed in the 1024x768 virtual window coordinate system.
Definition at line 44 of file video_base.cpp. References disable_2d, enable_2d, m_2d_enabled, m_width, real_t, and gl::ttf::render_string. |
|
Renders the string text to the screen. x and y are expressed in a 1024x768 virtual window. If the current resolution is not 1024x768, the font text will be scaled appropriately. (0,0) is located at the bottom left hand corner of the screen. (1024,768) is located at the top right hand corner of the screen. Both x and y will be updated with the last pixel drawn to the screen. This pixel is the upper right hand corner of the last character in the string and is expressed in the 1024x768 virtual window coordinate system.
Definition at line 9 of file video_base.cpp. References disable_2d, enable_2d, m_2d_enabled, m_width, real_t, and gl::ttf::render_string. |
|
Shuts down the video system. This method should be called to release the video system back to the operating system. Implemented in video_sdl. |
|
Starts a video frame. This method should be called at the beginning of each frame. Implemented in video_sdl. |