A simple canvas which can be drawn upon. More...
#include <canvas.hpp>

Classes | |
| class | tshape |
| Abstract base class for all other shapes. More... | |
Public Types | |
| typedef boost::intrusive_ptr < tshape > | tshape_ptr |
| typedef boost::intrusive_ptr < const tshape > | const_tshape_ptr |
Public Member Functions | |
| tcanvas () | |
| void | draw (const bool force=false) |
| Draws the canvas. | |
| void | blit (surface &surf, SDL_Rect rect) |
| Blits the canvas unto another surface. | |
| void | set_cfg (const config &cfg) |
| Sets the config. | |
| void | set_width (const unsigned width) |
| unsigned | get_width () const |
| void | set_height (const unsigned height) |
| unsigned | get_height () const |
| surface & | surf () |
| void | set_variable (const std::string &key, const variant &value) |
Private Member Functions | |
| void | set_dirty (const bool dirty=true) |
| void | parse_cfg (const config &cfg) |
| Parses a config object. | |
Private Attributes | |
| std::vector< tshape_ptr > | shapes_ |
| Vector with the shapes to draw. | |
| unsigned | blur_depth_ |
| The depth of the blur to use in the pre committing. | |
| unsigned | w_ |
| Width of the canvas. | |
| unsigned | h_ |
| Height of the canvas. | |
| surface | canvas_ |
| The surface we draw all items on. | |
| game_logic::map_formula_callable | variables_ |
| The variables of the canvas. | |
| bool | dirty_ |
| The dirty state of the canvas. | |
A simple canvas which can be drawn upon.
The class has a config which contains what to draw.
NOTE we might add some caching in a later state, for now every draw cycle does a full redraw.
The copy constructor does a shallow copy of the shapes to draw. a clone() will be implemented if really needed.
Definition at line 44 of file canvas.hpp.
| typedef boost::intrusive_ptr<const tshape> gui2::tcanvas::const_tshape_ptr |
Definition at line 73 of file canvas.hpp.
| typedef boost::intrusive_ptr<tshape> gui2::tcanvas::tshape_ptr |
Definition at line 72 of file canvas.hpp.
| gui2::tcanvas::tcanvas | ( | ) |
Definition at line 1397 of file canvas.cpp.
| void gui2::tcanvas::blit | ( | surface & | surf, | |
| SDL_Rect | rect | |||
| ) |
Blits the canvas unto another surface.
It makes sure the image on the canvas is up to date. Also executes the pre-blitting functions.
| surf | The surface to blit upon. | |
| rect | The place to blit to. |
Definition at line 1437 of file canvas.cpp.
References blur_depth_, blur_surface(), canvas_, draw(), get_surface_portion(), is_neutral(), and sdl_blit().

| void gui2::tcanvas::draw | ( | const bool | force = false |
) |
Draws the canvas.
| force | If the canvas isn't dirty it isn't redrawn unless force is set to true. |
Definition at line 1408 of file canvas.cpp.
References game_logic::map_formula_callable::add(), surface::assign(), canvas_, create_neutral_surface(), DBG_GUI_D, dirty_, gui2::get_screen_size_variables(), h_, gui2::log_gui_draw, log_scope2, shapes_, variables_, and w_.
Referenced by blit().


| unsigned gui2::tcanvas::get_height | ( | ) | const [inline] |
Definition at line 111 of file canvas.hpp.
References h_.
| unsigned gui2::tcanvas::get_width | ( | ) | const [inline] |
Definition at line 108 of file canvas.hpp.
References w_.
| void gui2::tcanvas::parse_cfg | ( | const config & | cfg | ) | [private] |
Parses a config object.
The config object is parsed and serialized by this function after which the config object is no longer required and thus not stored in the object.
| cfg | The config object with the data to draw, see http://www.wesnoth.org/wiki/GUICanvasWML |
Definition at line 1458 of file canvas.cpp.
References config::all_children_range(), blur_depth_, config::any_child::cfg, DBG_GUI_P, ERR_GUI_P, config::any_child::key, gui2::log_gui_parse, log_scope2, shapes_, and type.
Referenced by set_cfg().


| void gui2::tcanvas::set_cfg | ( | const config & | cfg | ) | [inline] |
Sets the config.
| cfg | The config object with the data to draw, see http://www.wesnoth.org/wiki/GUICanvasWML for more information. |
Definition at line 103 of file canvas.hpp.
References parse_cfg().

| void gui2::tcanvas::set_dirty | ( | const bool | dirty = true |
) | [inline, private] |
Definition at line 150 of file canvas.hpp.
References dirty_.
Referenced by set_height(), set_variable(), and set_width().

| void gui2::tcanvas::set_height | ( | const unsigned | height | ) | [inline] |
Definition at line 110 of file canvas.hpp.
References h_, and set_dirty().
Referenced by gui2::tcontrol::place().


| void gui2::tcanvas::set_variable | ( | const std::string & | key, | |
| const variant & | value | |||
| ) | [inline] |
Definition at line 115 of file canvas.hpp.
References game_logic::map_formula_callable::add(), set_dirty(), and variables_.
Referenced by gui2::tscrollbar_::load_config_extra(), gui2::tprogress_bar::set_percentage(), gui2::tdebug_clock::ttime::ttime(), gui2::tscrollbar_::update_canvas(), gui2::tcontrol::update_canvas(), gui2::ttoggle_button::update_canvas(), gui2::ttext_box::update_canvas(), gui2::tslider::update_canvas(), and gui2::ttext_box::update_offsets().


| void gui2::tcanvas::set_width | ( | const unsigned | width | ) | [inline] |
Definition at line 107 of file canvas.hpp.
References set_dirty(), and w_.
Referenced by gui2::tcontrol::place().


| surface& gui2::tcanvas::surf | ( | ) | [inline] |
Definition at line 113 of file canvas.hpp.
References canvas_.
unsigned gui2::tcanvas::blur_depth_ [private] |
The depth of the blur to use in the pre committing.
Definition at line 133 of file canvas.hpp.
Referenced by blit(), and parse_cfg().
surface gui2::tcanvas::canvas_ [private] |
The surface we draw all items on.
Definition at line 142 of file canvas.hpp.
bool gui2::tcanvas::dirty_ [private] |
The dirty state of the canvas.
Definition at line 148 of file canvas.hpp.
Referenced by draw(), and set_dirty().
unsigned gui2::tcanvas::h_ [private] |
Height of the canvas.
Definition at line 139 of file canvas.hpp.
Referenced by draw(), get_height(), and set_height().
std::vector<tshape_ptr> gui2::tcanvas::shapes_ [private] |
Vector with the shapes to draw.
Definition at line 123 of file canvas.hpp.
Referenced by draw(), and parse_cfg().
The variables of the canvas.
Definition at line 145 of file canvas.hpp.
Referenced by draw(), and set_variable().
unsigned gui2::tcanvas::w_ [private] |
Width of the canvas.
Definition at line 136 of file canvas.hpp.
Referenced by draw(), get_width(), and set_width().
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:21:49 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |