1// SuperTux
2// Copyright (C) 2018 Ingo Ruhnke <grumbel@gmail.com>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17#ifndef HEADER_SUPERTUX_VIDEO_TTF_SURFACE_HPP
18#define HEADER_SUPERTUX_VIDEO_TTF_SURFACE_HPP
19
20#include <memory>
21#include <string>
22
23#include "math/vector.hpp"
24#include "video/surface_ptr.hpp"
25
26class TTFFont;
27class TTFSurface;
28
29typedef std::shared_ptr<TTFSurface> TTFSurfacePtr;
30
31/** TTFSurface class holds a rendered string */
32class TTFSurface final
33{
34public:
35 static TTFSurfacePtr create(const TTFFont& font, const std::string& text);
36
37public:
38 TTFSurface(const SurfacePtr& surface, const Vector& offset);
39
40 SurfacePtr get_surface() { return m_surface; }
41 Vector get_offset() const { return m_offset; }
42
43 int get_width() const;
44 int get_height() const;
45
46private:
47 SurfacePtr m_surface;
48 Vector m_offset;
49
50private:
51 TTFSurface(const TTFSurface&) = delete;
52 TTFSurface& operator=(const TTFSurface&) = delete;
53};
54
55#endif
56
57/* EOF */
58