display Class Reference

#include <display.hpp>

Collaboration diagram for display:

Collaboration graph
[legend]

List of all members.


Detailed Description

This class represents a screen on which to draw.

Definition at line 57 of file display.hpp.


Public Member Functions

 display (const int &width, const int &height, bool is_console=false)
void draw_2d_text (const gsgl::real_t x, const gsgl::real_t y, font *f, const gsgl::string &str)
 Draws text at the given screen coordinates.
void draw_3d_text (const math::vector &p, font *f, const gsgl::string &str, const gsgl::real_t x_offset=0, const gsgl::real_t y_offset=0)
 Draws text at the given world coordinates.
void draw_text_start ()
 Sets up an orthogonal view frustum for drawing text.
void draw_text_stop ()
 Tears down the orthogonal view frustum for drawing text.
gsgl::real_t get_aspect_ratio () const
int get_height () const
int get_width () const
void record_3d_text_info ()
 Records the 3D modelview, projection and viewport information for subsequent calls to draw_3d_text().
virtual ~display ()

Static Public Member Functions

static void draw_rectangle (float x1, float y1, float x2, float y2, float s1=0, float t1=0, float s2=1, float t2=1)
 Draws a possibly textured rectangle (a suitable projection must already be set up).

Static Public Attributes

static data::config_variable< int > DISPLAY_HEIGHT
static data::config_variable< int > DISPLAY_WIDTH

Private Member Functions

void center_console_window (const int &width, const int &height)

Private Attributes

bool is_console
struct SDL_Surface * surface
math::transform text_draw_modelview
math::transform text_draw_pm
math::transform text_draw_projection
int text_draw_viewport [4]

Constructor & Destructor Documentation

display ( const int &  width,
const int &  height,
bool  is_console = false 
)

~display (  )  [virtual]

Definition at line 92 of file display.cpp.

References display::is_console, and display::surface.


Member Function Documentation

void center_console_window ( const int &  width,
const int &  height 
) [private]

Definition at line 205 of file display.cpp.

Referenced by display::display().

void draw_2d_text ( const gsgl::real_t  x,
const gsgl::real_t  y,
font f,
const gsgl::string str 
)

Draws text at the given screen coordinates.

Definition at line 168 of file display.cpp.

References CHECK_GL_ERRORS, and font::draw().

Referenced by display::draw_3d_text(), and application::draw_budget().

void draw_3d_text ( const math::vector p,
font f,
const gsgl::string str,
const gsgl::real_t  x_offset = 0,
const gsgl::real_t  y_offset = 0 
)

Draws text at the given world coordinates.

Definition at line 177 of file display.cpp.

References display::draw_2d_text(), vector::get_x(), vector::get_y(), vector::get_z(), display::text_draw_pm, and display::text_draw_viewport.

Referenced by stellar_db::draw(), and celestial_body::draw_name().

void draw_rectangle ( float  x1,
float  y1,
float  x2,
float  y2,
float  s1 = 0,
float  t1 = 0,
float  s2 = 1,
float  t2 = 1 
) [static]

Draws a possibly textured rectangle (a suitable projection must already be set up).

Operates in the current OpenGL context, not in any particular display.

Definition at line 115 of file display.cpp.

References CHECK_GL_ERRORS.

Referenced by widget::draw(), widget::draw_box(), and application::draw_splash_screen().

void draw_text_start (  ) 

Sets up an orthogonal view frustum for drawing text.

Definition at line 153 of file display.cpp.

References CHECK_GL_ERRORS, and display::surface.

Referenced by stellar_db::draw(), simulation::draw(), application::draw_budget(), and celestial_body::draw_name().

void draw_text_stop (  ) 

Tears down the orthogonal view frustum for drawing text.

Definition at line 193 of file display.cpp.

References CHECK_GL_ERRORS.

Referenced by stellar_db::draw(), simulation::draw(), application::draw_budget(), and celestial_body::draw_name().

gsgl::real_t get_aspect_ratio (  )  const

int get_height (  )  const

int get_width (  )  const

void record_3d_text_info (  ) 

Records the 3D modelview, projection and viewport information for subsequent calls to draw_3d_text().

Definition at line 144 of file display.cpp.

References CHECK_GL_ERRORS, matrix::ptr(), display::text_draw_modelview, display::text_draw_pm, display::text_draw_projection, and display::text_draw_viewport.

Referenced by stellar_db::draw(), and celestial_body::draw_name().


Member Data Documentation

Definition at line 72 of file display.hpp.

Referenced by application::application().

config_variable< int > DISPLAY_WIDTH [static]

Definition at line 71 of file display.hpp.

Referenced by application::application().

bool is_console [private]

Definition at line 60 of file display.hpp.

Referenced by display::~display().

struct SDL_Surface* surface [read, private]

Definition at line 62 of file display.hpp.

Referenced by display::record_3d_text_info().

Definition at line 64 of file display.hpp.

Referenced by display::draw_3d_text(), and display::record_3d_text_info().

Definition at line 63 of file display.hpp.

Referenced by display::record_3d_text_info().

int text_draw_viewport[4] [private]

Definition at line 65 of file display.hpp.

Referenced by display::draw_3d_text(), and display::record_3d_text_info().


The documentation for this class was generated from the following files:

Generated on Sat Mar 1 13:50:07 2008 for Periapsis Project by  doxygen 1.5.5