ShishGL  1.0
A simple modular cross-platform graphics library
Bordered.hpp
Go to the documentation of this file.
1 /*============================================================================*/
2 #ifndef SHISHGL_BORDERED_HPP
3 #define SHISHGL_BORDERED_HPP
4 /*============================================================================*/
5 #include "Style.hpp"
6 #include "RenderSystem.hpp"
7 /*============================================================================*/
8 namespace Sh {
9 
10  class Bordered : public Style {
11  public:
12 
13  explicit Bordered(const double& border_width,
14  const Color& border_color)
15  : width(border_width)
16  , color(border_color)
17  { }
18 
19  void apply(Frame& viewport, const Shape2D& shape) override {
20 
21  PLATFORM().setColor(color);
22  shape.draw(viewport);
23 
24  Vector2<double> offset{width, width};
25 
26  viewport.pos += offset;
27  viewport.size -= 2.0 * offset;
28  }
29 
30  ~Bordered() override = default;
31 
32  private:
33 
34  double width;
35  Color color;
36  };
37 
38 
39 }
40 /*============================================================================*/
41 #endif //SHISHGL_BORDERED_HPP
42 /*============================================================================*/
Sh::Bordered::apply
void apply(Frame &viewport, const Shape2D &shape) override
Definition: Bordered.hpp:19
Sh::Shape2D
Definition: Shape2D.hpp:12
Sh::Frame
Definition: Frame.hpp:9
Sh::Bordered::~Bordered
~Bordered() override=default
Sh::Vector2< double >
Style.hpp
Sh::Bordered
Definition: Bordered.hpp:10
Sh::PLATFORM
IPlatform & PLATFORM()
Definition: RenderSystem.cpp:32
Sh::IPlatform::setColor
virtual void setColor(const Color &color)=0
Sh::Style
Definition: Style.hpp:12
Sh
Definition: CoreApplication.hpp:10
Sh::Bordered::Bordered
Bordered(const double &border_width, const Color &border_color)
Definition: Bordered.hpp:13
RenderSystem.hpp
Sh::Color
Definition: Color.hpp:9
Sh::Shape2D::draw
virtual void draw(const Frame &viewport) const =0
Sh::Frame::size
Vector2< double > size
Definition: Frame.hpp:12
Sh::Frame::pos
Vector2< double > pos
Definition: Frame.hpp:11