#include <xrb_widgetbackground.hpp>
Public Member Functions | |
WidgetBackgroundStylized (std::string const &corner_texture_name, std::string const &top_texture_name, std::string const &left_texture_name, std::string const ¢er_texture_name) | |
Constructs the background using the specified textures. | |
WidgetBackgroundStylized (Resource< GLTexture > const &corner_texture, Resource< GLTexture > const &top_texture, Resource< GLTexture > const &left_texture, Resource< GLTexture > const ¢er_texture) | |
Constructs the background using the specified textures. | |
virtual | ~WidgetBackgroundStylized () |
Destructor. | |
virtual WidgetBackground * | CreateClone () const |
WidgetBackgroundStylized implementation of CreateClone. | |
virtual void | Draw (RenderContext const &render_context, ScreenCoordRect const &widget_screen_rect, ScreenCoordVector2 const &frame_margins) const |
Draws this widget background. |
Four texture resources are necessary for this background.
A widget is divided up into 9 regions by its frame margins (assuming its frame margins have non-zero size). The widget looks like
+----+--------------------------+----+ | 1 | 2 | 3 | | | | | +----+--------------------------+----+ | | | | | 4 | 5 | 6 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | +----+--------------------------+----+ | 7 | 8 | 9 | | | | | +----+--------------------------+----+
There are four textures specified; corner, top, left, and center.
Definition at line 179 of file xrb_widgetbackground.hpp.
Xrb::WidgetBackgroundStylized::WidgetBackgroundStylized | ( | std::string const & | corner_texture_name, | |
std::string const & | top_texture_name, | |||
std::string const & | left_texture_name, | |||
std::string const & | center_texture_name | |||
) |
Constructs the background using the specified textures.
corner_texture_name | The path of the corner texture to use. | |
top_texture_name | The path of the top texture to use. | |
left_texture_name | The path of the left texture to use. | |
center_texture_name | The path of the center texture to use. |
Definition at line 91 of file xrb_widgetbackground.cpp.
References Xrb::GLTexture::Create(), Xrb::Resource< T >::IsValid(), Xrb::ResourceLibrary::LoadPath(), and Xrb::Singleton::ResourceLibrary().
Referenced by CreateClone().
Xrb::WidgetBackgroundStylized::WidgetBackgroundStylized | ( | Resource< GLTexture > const & | corner_texture, | |
Resource< GLTexture > const & | top_texture, | |||
Resource< GLTexture > const & | left_texture, | |||
Resource< GLTexture > const & | center_texture | |||
) |
Constructs the background using the specified textures.
corner_texture | Directly specifies the GLTexture object to use for the corner texture. | |
top_texture | Directly specifies the GLTexture object to use for the top texture. | |
left_texture | Directly specifies the GLTexture object to use for the left texture. | |
center_texture | Directly specifies the GLTexture object to use for the center texture. |
Definition at line 124 of file xrb_widgetbackground.cpp.
References Xrb::Resource< T >::IsValid().
Xrb::WidgetBackgroundStylized::~WidgetBackgroundStylized | ( | ) | [virtual] |
Destructor.
m_corner_texture, m_top_texture, m_left_texture, and m_center_texture are automatically deleted because they go out of scope here.
Definition at line 143 of file xrb_widgetbackground.cpp.
WidgetBackground * Xrb::WidgetBackgroundStylized::CreateClone | ( | ) | const [virtual] |
WidgetBackgroundStylized implementation of CreateClone.
See Xrb::WidgetBackground::CreateClone for more details.
Implements Xrb::WidgetBackground.
Definition at line 147 of file xrb_widgetbackground.cpp.
References WidgetBackgroundStylized().
void Xrb::WidgetBackgroundStylized::Draw | ( | RenderContext const & | render_context, | |
ScreenCoordRect const & | widget_screen_rect, | |||
ScreenCoordVector2 const & | frame_margins | |||
) | const [virtual] |
Draws this widget background.
Draws the corner texture on the frame margin corners of the widget, the top and left textures on the top/bottom and left/right frame margin sides of the widget, and the center texture on the remaining area enclosed inside the frame margins.
See Xrb::WidgetBackground::Draw for more info.
Implements Xrb::WidgetBackground.
Definition at line 156 of file xrb_widgetbackground.cpp.
References Xrb::Rect< T >::Bottom(), Xrb::Render::DrawScreenRectTexture(), Xrb::Resource< T >::IsValid(), Xrb::Rect< T >::Left(), Xrb::Rect< T >::Right(), Xrb::Rect< T >::Top(), Xrb::Dim::X, and Xrb::Dim::Y.