#include <display.hpp>
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] |
display | ( | const int & | width, | |
const int & | height, | |||
bool | is_console = false | |||
) |
Definition at line 54 of file display.cpp.
References display::center_console_window(), gsgl::platform::init_extensions(), and display::surface.
~display | ( | ) | [virtual] |
void center_console_window | ( | const int & | width, | |
const int & | height | |||
) | [private] |
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 |
Definition at line 109 of file display.cpp.
References display::surface.
Referenced by coord_system::draw(), stellar_db::draw(), star::draw(), sph_qt_node::draw(), large_rocky_body::draw(), celestial_body::draw(), celestial_body::draw_name(), node::draw_scene(), and large_lithosphere::update().
int get_height | ( | ) | const |
Definition at line 103 of file display.cpp.
References display::surface.
Referenced by simulation::draw(), large_rocky_body::draw(), celestial_body::draw(), node::draw_scene(), application::draw_splash_screen(), application::handle_ui_event(), periapsis_app::init(), spherical_quadtree::node_radius(), application::run(), and large_lithosphere::update().
int get_width | ( | ) | const |
Definition at line 98 of file display.cpp.
References display::surface.
Referenced by node::draw_scene(), application::draw_splash_screen(), periapsis_app::init(), and application::run().
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().
config_variable< int > DISPLAY_HEIGHT [static] |
config_variable< int > DISPLAY_WIDTH [static] |
bool is_console [private] |
struct SDL_Surface* surface [read, private] |
Definition at line 59 of file display.hpp.
Referenced by display::display(), display::draw_text_start(), display::get_aspect_ratio(), display::get_height(), display::get_width(), and display::~display().
math::transform text_draw_modelview [private] |
math::transform text_draw_pm [private] |
Definition at line 64 of file display.hpp.
Referenced by display::draw_3d_text(), and display::record_3d_text_info().
math::transform text_draw_projection [private] |
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().