SuperTuxKart
font_drawer.hpp
1 //
2 // SuperTuxKart - a fun racing game with go-kart
3 // Copyright (C) 2020 SuperTuxKart-Team
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 3
8 // of the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 
19 #ifndef HEADER_FONT_DRAWER_HPP
20 #define HEADER_FONT_DRAWER_HPP
21 
22 #ifndef SERVER_ONLY
23 
24 #include <array>
25 
26 #include <ITexture.h>
27 #include <rect.h>
28 #include <SColor.h>
29 
30 using namespace irr;
31 
32 namespace FontDrawer
33 {
34  // ------------------------------------------------------------------------
35  void startBatching();
36  // ------------------------------------------------------------------------
37  bool isBatching();
38  // ------------------------------------------------------------------------
39  void endBatching();
40  // ------------------------------------------------------------------------
41  void addGlyph(video::ITexture* texture,
42  const core::rect<float>& dest_rect,
43  const core::rect<s32>& source_rect,
44  const core::rect<s32>* clip_rect,
45  const video::SColor* color);
46  // ------------------------------------------------------------------------
47  inline void addGlyph(video::ITexture* texture,
48  const core::rect<float>& dest_rect,
49  const core::rect<s32>& source_rect,
50  const core::rect<s32>* clip_rect,
51  const video::SColor& color)
52  {
53  std::array<video::SColor, 4> colors = {{ color, color, color, color }};
54  addGlyph(texture, dest_rect, source_rect, clip_rect, colors.data());
55  } // addGlyph
56  // ------------------------------------------------------------------------
57  void draw();
58 };
59 
60 #endif
61 
62 #endif