Debian Codegraph @

avogadro/rendering/textlabel2d.cpp

raw
1 /******************************************************************************
2 This source file is part of the Avogadro project.
3 This source code is released under the 3-Clause BSD License, (see "LICENSE").
4 ******************************************************************************/
5
6 #include "textlabel2d.h"
7
8 #include "visitor.h"
9
10 namespace Avogadro::Rendering {
11
12 TextLabel2D::TextLabel2D()
13 {
14 setRenderPass(Rendering::Overlay2DPass);
15 }
16
17 TextLabel2D::~TextLabel2D() {}
18
19 void TextLabel2D::accept(Visitor& visitor)
20 {
21 visitor.visit(*this);
22 }
23
24 void TextLabel2D::setAnchor(const Vector2i& windowCoords)
25 {
26 setAnchorInternal(Vector3f(static_cast<float>(windowCoords.x()),
27 static_cast<float>(windowCoords.y()), 0.f));
28 }
29
30 Vector2i TextLabel2D::anchor() const
31 {
32 return getAnchorInternal().head<2>().cast<int>();
33 }
34
35 } // namespace Avogadro::Rendering