#include <video_X.h>
Inheritance diagram for video_X:
Public Methods | |
video_X (void) | |
Default constructor. | |
virtual | ~video_X (void) |
Destructor. | |
virtual bool | init (unsigned int w, unsigned int h, unsigned int bpp, bool fs) |
Initializes the video system. More... | |
virtual bool | init (unsigned int w, unsigned int h, unsigned int bpp, const int attributes[], bool fs) |
Initializes the video system. More... | |
virtual void | set_title (const std::string &title) |
Sets the title of the window. | |
virtual void | resize (unsigned int width, unsigned int height) |
Resizes the window to width by height. | |
virtual void | start_frame (void) |
Starts a video frame. More... | |
virtual void | end_frame (void) |
Ends a video frame. More... | |
virtual void | toggle_fullscreen (void) |
Toggles fullscreen mode. More... | |
virtual void | activate (void) |
Activates the GL context for the window. | |
virtual void | shutdown (void) |
Shuts down the video system. More... | |
Display * | get_display (void) |
Retrieves a pointer to the X windows display. | |
GLXContext | get_context (void) |
Retrieves the GL context of the window. | |
virtual void | set_eventmask (long eventmask) |
Changes the event mask for the window. More... | |
virtual void | move_pointer (int x, int y) |
Moves the pointer to a location in the window. More... | |
virtual bool | get_pointer (int *x, int *y) |
Get the pointer location in the window. 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... | |
Static Public Attributes | |
const int | VISUAL_ATTRIBUTES_8BPP [] |
Default visual attributes for 8bpp. More... | |
const int | VISUAL_ATTRIBUTES_16BPP [] |
Default visual attributes for 16bpp. More... | |
const int | VISUAL_ATTRIBUTES_24BPP [] |
Default visual attributes for 24bpp. More... | |
const int | VISUAL_ATTRIBUTES_32BPP [] |
Default visual attributes for 32bpp. 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 | |
Display * | m_display |
Pointer to X display for the main window. | |
Window | m_window |
Main X window. | |
GLXContext | m_window_context |
Main X window's GL context. | |
XVisualInfo * | m_selected_visual |
The selected X windows visual for the main window. | |
XF86VidModeModeInfo | m_desktop_mode |
The video mode of the X desktop. | |
std::string | m_window_title |
The title of the X window. | |
int * | m_GL_attributes |
OpenGL attributes for the window. | |
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. |
X Windows implementation of video_base.
Definition at line 16 of file video_X.h.
|
Ends a video frame. This method should be called at the end of each frame. Implements video_base. Definition at line 496 of file video_X.cpp. |
|
Returns the current frames per second. This stat is updated every 500ms. Definition at line 131 of file video_base.h. References video_base::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 video_base::m_fps. |
|
Get the pointer location in the window. Find the location of the pointer in a window and stores that information into x and y.
Definition at line 636 of file video_X.cpp. |
|
Initializes the video system. Creates video surface w pixels wide by h pixels in height, using a set of framebuffer attributes passed as attributes.
Definition at line 286 of file video_X.cpp. References gl::init, video_base::m_bpp, video_base::m_clock, m_desktop_mode, m_display, video_base::m_fullscreen, m_GL_attributes, video_base::m_height, m_selected_visual, video_base::m_width, m_window, m_window_context, m_window_title, clocker::reset, and video_base::set_error. |
|
Initializes the video system. Creates a video surface w pixels wide by h pixels in height.
Implements video_base. Definition at line 125 of file video_X.cpp. References gl::init, video_base::m_bpp, video_base::m_clock, m_desktop_mode, m_display, video_base::m_fullscreen, m_GL_attributes, video_base::m_height, m_selected_visual, video_base::m_width, m_window, m_window_context, m_window_title, clocker::reset, video_base::set_error, VISUAL_ATTRIBUTES_16BPP, VISUAL_ATTRIBUTES_24BPP, VISUAL_ATTRIBUTES_32BPP, and VISUAL_ATTRIBUTES_8BPP. |
|
Moves the pointer to a location in the window. Moves the pointer to the pixel location x ,y from the upper left-hand corner of the window. Definition at line 628 of file video_X.cpp. |
|
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 video_base::disable_2d, video_base::enable_2d, video_base::m_2d_enabled, video_base::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 video_base::disable_2d, video_base::enable_2d, video_base::m_2d_enabled, video_base::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 video_base::disable_2d, video_base::enable_2d, video_base::m_2d_enabled, video_base::m_width, real_t, and gl::ttf::render_string. |
|
Changes the event mask for the window.
By default the window only looks for expose events, so the event mask should be enlarged to include events that will be handled by a program using the Definition at line 620 of file video_X.cpp. |
|
Shuts down the video system. This method should be called to release the video system back to the operating system. Implements video_base. Definition at line 602 of file video_X.cpp. References m_desktop_mode, m_display, and m_window_context. |
|
Starts a video frame. This method should be called at the beginning of each frame. Implements video_base. Definition at line 474 of file video_X.cpp. References clocker::elapsed, video_base::m_avg_fps, video_base::m_clock, video_base::m_fps, video_base::m_fps_sum, video_base::m_frame_count, and clocker::update. |
|
Toggles fullscreen mode. Switches a currently initialized window from fullscreen mode to windowed mode and back as necessary. Implements video_base. Definition at line 505 of file video_X.cpp. References m_desktop_mode, m_display, video_base::m_fullscreen, video_base::m_height, video_base::m_width, m_window, m_window_title, and video_base::set_error. |
|
Initial value: { GLX_DOUBLEBUFFER, GL_TRUE, GLX_RED_SIZE, 4, GLX_GREEN_SIZE, 4, GLX_BLUE_SIZE, 4, GLX_ALPHA_SIZE, 4, None }
Definition at line 62 of file video_X.cpp. Referenced by init. |
|
Initial value: { GLX_DOUBLEBUFFER, GL_TRUE, GLX_RED_SIZE, 6, GLX_GREEN_SIZE, 6, GLX_BLUE_SIZE, 6, GLX_ALPHA_SIZE, 6, None }
Definition at line 71 of file video_X.cpp. Referenced by init. |
|
Initial value: { GLX_DOUBLEBUFFER, GL_TRUE, GLX_RED_SIZE, 8, GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_ALPHA_SIZE, 8, None }
Definition at line 80 of file video_X.cpp. Referenced by init. |
|
Initial value: { GLX_DOUBLEBUFFER, GL_TRUE, GLX_RED_SIZE, 2, GLX_GREEN_SIZE, 2, GLX_BLUE_SIZE, 2, GLX_ALPHA_SIZE, 2, None }
Definition at line 53 of file video_X.cpp. Referenced by init. |