The Battle for Wesnoth  1.17.0-dev
Classes | Protected Member Functions | Private Attributes | List of all members
gui2::rect_bounded_shape Class Reference

Class holding common attribute names (for WML) and common implementation (in C++) for shapes placed with the 4 attributes x, y, w and h. More...

#include <canvas_private.hpp>

Inheritance diagram for gui2::rect_bounded_shape:

Classes

struct  calculated_rects
 Where to draw, calculated from the x,y,w,h formulas but with different reference points used as the origin of the co-ordinate system. More...
 

Protected Member Functions

 rect_bounded_shape (const config &cfg)
 Constructor. More...
 
calculated_rects calculate_rects (const SDL_Rect &view_bounds, wfl::map_formula_callable &variables) const
 

Private Attributes

typed_formula< int > x_
 The x coordinate of the rectangle. More...
 
typed_formula< int > y_
 The y coordinate of the rectangle. More...
 
typed_formula< int > w_
 The width of the rectangle. More...
 
typed_formula< int > h_
 The height of the rectangle. More...
 

Additional Inherited Members

- Public Member Functions inherited from gui2::canvas::shape
 shape (const config &cfg)
 
virtual ~shape ()
 
virtual void draw (surface &canvas, SDL_Renderer *renderer, const SDL_Rect &view_bounds, wfl::map_formula_callable &variables)=0
 Draws the canvas. More...
 
bool immutable () const
 

Detailed Description

Class holding common attribute names (for WML) and common implementation (in C++) for shapes placed with the 4 attributes x, y, w and h.

Keys:

Key Type DefaultDescription
x f_unsigned0 The x coordinate of the top left corner.
y f_unsigned0 The y coordinate of the top left corner.
w f_unsigned0 The width of the rectangle.
h f_unsigned0 The height of the rectangle.

Definition at line 117 of file canvas_private.hpp.

Constructor & Destructor Documentation

◆ rect_bounded_shape()

gui2::rect_bounded_shape::rect_bounded_shape ( const config cfg)
explicitprotected

Constructor.

Parameters
cfgThe config object to define the rectangle.

Definition at line 252 of file canvas.cpp.

Member Function Documentation

◆ calculate_rects()

rect_bounded_shape::calculated_rects gui2::rect_bounded_shape::calculate_rects ( const SDL_Rect &  view_bounds,
wfl::map_formula_callable variables 
) const
protected

Member Data Documentation

◆ h_

typed_formula<int> gui2::rect_bounded_shape::h_
private

The height of the rectangle.

Definition at line 162 of file canvas_private.hpp.

Referenced by calculate_rects().

◆ w_

typed_formula<int> gui2::rect_bounded_shape::w_
private

The width of the rectangle.

Definition at line 161 of file canvas_private.hpp.

Referenced by calculate_rects().

◆ x_

typed_formula<int> gui2::rect_bounded_shape::x_
private

The x coordinate of the rectangle.

Definition at line 159 of file canvas_private.hpp.

Referenced by calculate_rects().

◆ y_

typed_formula<int> gui2::rect_bounded_shape::y_
private

The y coordinate of the rectangle.

Definition at line 160 of file canvas_private.hpp.

Referenced by calculate_rects().


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