SuperTuxKart
2dutils.hpp
1 // SuperTuxKart - a fun racing game with go-kart
2 // Copyright (C) 2014-2015 SuperTuxKart-Team
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 3
7 // of the License, or (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, write to the Free Software
16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 
18 #ifndef UTILS2D_HPP
19 #define UTILS2D_HPP
20 
21 #include "gl_headers.hpp"
22 
23 #include <EPrimitiveTypes.h>
24 #include <irrTypes.h>
25 #include <ITexture.h>
26 #include <rect.h>
27 #include <S3DVertex.h>
28 #include <SColor.h>
29 #include <SVertexIndex.h>
30 
31 void preloadShaders();
32 
33 void draw2DImageFromRTT(GLuint texture, size_t texture_w, size_t texture_h,
34  const irr::core::rect<irr::s32>& destRect,
35  const irr::core::rect<irr::s32>& sourceRect,
36  const irr::core::rect<irr::s32>* clipRect,
37  const irr::video::SColor &colors,
38  bool useAlphaChannelOfTexture);
39 
40 void draw2DImage(const irr::video::ITexture* texture,
41  const irr::core::rect<irr::s32>& destRect,
42  const irr::core::rect<irr::s32>& sourceRect,
43  const irr::core::rect<irr::s32>* clipRect,
44  const irr::video::SColor &color,
45  bool useAlphaChannelOfTexture);
46 
47 void draw2DImage(const irr::video::ITexture* texture,
48  const irr::core::rect<irr::s32>& destRect,
49  const irr::core::rect<irr::s32>& sourceRect,
50  const irr::core::rect<irr::s32>* clipRect,
51  const irr::video::SColor* const colors,
52  bool useAlphaChannelOfTexture);
53 
54 void draw2DImageRotationColor(irr::video::ITexture* texture,
55  const irr::core::rect<irr::s32>& destRect,
56  const irr::core::rect<irr::s32>& sourceRect,
57  const irr::core::rect<irr::s32>* clipRect,
58  float rotation, const irr::video::SColor& color);
59 
60 void draw2DVertexPrimitiveList(irr::video::ITexture *t, const void* vertices,
61  irr::u32 vertexCount, const void* indexList,
62  irr::u32 primitiveCount,
63  irr::video::E_VERTEX_TYPE vType = irr::video::EVT_STANDARD,
64  irr::scene::E_PRIMITIVE_TYPE pType = irr::scene::EPT_TRIANGLES,
65  irr::video::E_INDEX_TYPE iType = irr::video::EIT_16BIT );
66 
67 void GL32_draw2DRectangle(irr::video::SColor color,
68  const irr::core::rect<irr::s32>& position,
69  const irr::core::rect<irr::s32>* clip = 0);
70 
71 #endif