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. More... | |
void | blit (surface &surf, SDL_Rect rect) |
Blits the canvas unto another surface. More... | |
void | set_cfg (const config &cfg) |
Sets the config. More... | |
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_is_dirty (const bool is_dirty) |
void | parse_cfg (const config &cfg) |
Parses a config object. More... | |
Private Attributes | |
std::vector< tshape_ptr > | shapes_ |
Vector with the shapes to draw. More... | |
unsigned | blur_depth_ |
The depth of the blur to use in the pre committing. More... | |
unsigned | w_ |
Width of the canvas. More... | |
unsigned | h_ |
Height of the canvas. More... | |
surface | canvas_ |
The surface we draw all items on. More... | |
game_logic::map_formula_callable | variables_ |
The variables of the canvas. More... | |
bool | is_dirty_ |
The dirty state of the canvas. More... | |
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 75 of file canvas.hpp.
Definition at line 74 of file canvas.hpp.
gui2::tcanvas::tcanvas | ( | ) |
Definition at line 1456 of file canvas.cpp.
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 1497 of file canvas.cpp.
References blur_depth_, blur_surface(), canvas_, draw(), get_surface_portion(), get_video_surface(), 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 1467 of file canvas.cpp.
References game_logic::map_formula_callable::add(), surface::assign(), canvas_, create_neutral_surface(), DBG_GUI_D, gui2::get_screen_size_variables(), h_, is_dirty_, itor, gui2::log_gui_draw, log_scope2, shapes_, variables_, and w_.
Referenced by blit().
|
inline |
Definition at line 127 of file canvas.hpp.
References h_.
|
inline |
Definition at line 117 of file canvas.hpp.
References w_.
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 1521 of file canvas.cpp.
References config::all_children_range(), blur_depth_, DBG_GUI_P, ERR_GUI_P, gui2::log_gui_parse, log_scope2, and shapes_.
Referenced by set_cfg().
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 105 of file canvas.hpp.
References parse_cfg().
Referenced by gui2::tstate_definition::tstate_definition().
|
inline |
Definition at line 122 of file canvas.hpp.
References h_, and set_is_dirty().
|
inlineprivate |
Definition at line 172 of file canvas.hpp.
Referenced by set_height(), set_variable(), and set_width().
|
inline |
Definition at line 137 of file canvas.hpp.
References game_logic::map_formula_callable::add(), set_is_dirty(), and variables_.
|
inline |
Definition at line 112 of file canvas.hpp.
References set_is_dirty(), and w_.
|
inline |
Definition at line 132 of file canvas.hpp.
References canvas_.
|
private |
The depth of the blur to use in the pre committing.
Definition at line 155 of file canvas.hpp.
Referenced by blit(), and parse_cfg().
|
private |
The surface we draw all items on.
Definition at line 164 of file canvas.hpp.
|
private |
Height of the canvas.
Definition at line 161 of file canvas.hpp.
Referenced by draw(), get_height(), and set_height().
|
private |
|
private |
Vector with the shapes to draw.
Definition at line 145 of file canvas.hpp.
Referenced by draw(), and parse_cfg().
|
private |
The variables of the canvas.
Definition at line 167 of file canvas.hpp.
Referenced by draw(), and set_variable().
|
private |
Width of the canvas.
Definition at line 158 of file canvas.hpp.
Referenced by draw(), get_width(), and set_width().