git repos / blockattack-game

blame: source/code/Libs/NFont.h

normal view · raw

078900fe sago007 2015-12-05 15:31 1
/*
078900fe sago007 2015-12-05 15:31 2
NFont v4.0.0: A font class for SDL and SDL_Renderer
078900fe sago007 2015-12-05 15:31 3
by Jonathan Dearborn
078900fe sago007 2015-12-05 15:31 4
Dedicated to the memory of Florian Hufsky
078900fe sago007 2015-12-05 15:31 5
078900fe sago007 2015-12-05 15:31 6
License:
078900fe sago007 2015-12-05 15:31 7
    The short:
078900fe sago007 2015-12-05 15:31 8
    Use it however you'd like, but keep the copyright and license notice 
078900fe sago007 2015-12-05 15:31 9
    whenever these files or parts of them are distributed in uncompiled form.
078900fe sago007 2015-12-05 15:31 10
    
078900fe sago007 2015-12-05 15:31 11
    The long:
078900fe sago007 2015-12-05 15:31 12
Copyright (c) 2014 Jonathan Dearborn
078900fe sago007 2015-12-05 15:31 13
078900fe sago007 2015-12-05 15:31 14
Permission is hereby granted, free of charge, to any person obtaining a copy
078900fe sago007 2015-12-05 15:31 15
of this software and associated documentation files (the "Software"), to deal
078900fe sago007 2015-12-05 15:31 16
in the Software without restriction, including without limitation the rights
078900fe sago007 2015-12-05 15:31 17
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
078900fe sago007 2015-12-05 15:31 18
copies of the Software, and to permit persons to whom the Software is
078900fe sago007 2015-12-05 15:31 19
furnished to do so, subject to the following conditions:
078900fe sago007 2015-12-05 15:31 20
078900fe sago007 2015-12-05 15:31 21
The above copyright notice and this permission notice shall be included in
078900fe sago007 2015-12-05 15:31 22
all copies or substantial portions of the Software.
078900fe sago007 2015-12-05 15:31 23
078900fe sago007 2015-12-05 15:31 24
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
078900fe sago007 2015-12-05 15:31 25
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
078900fe sago007 2015-12-05 15:31 26
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
078900fe sago007 2015-12-05 15:31 27
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
078900fe sago007 2015-12-05 15:31 28
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
078900fe sago007 2015-12-05 15:31 29
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
078900fe sago007 2015-12-05 15:31 30
THE SOFTWARE.
078900fe sago007 2015-12-05 15:31 31
*/
078900fe sago007 2015-12-05 15:31 32
078900fe sago007 2015-12-05 15:31 33
#ifndef _NFONT_H__
078900fe sago007 2015-12-05 15:31 34
#define _NFONT_H__
078900fe sago007 2015-12-05 15:31 35
078900fe sago007 2015-12-05 15:31 36
#include "SDL.h"
078900fe sago007 2015-12-05 15:31 37
078900fe sago007 2015-12-05 15:31 38
#if defined(FC_USE_SDL_GPU) && !defined(NFONT_USE_SDL_GPU)
078900fe sago007 2015-12-05 15:31 39
#define NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 40
#endif
078900fe sago007 2015-12-05 15:31 41
078900fe sago007 2015-12-05 15:31 42
#ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 43
    #include "SDL_gpu.h"
078900fe sago007 2015-12-05 15:31 44
#endif
078900fe sago007 2015-12-05 15:31 45
5e876385 sago007 2016-01-29 22:43 46
#ifndef NFONT_FORMAT
5e876385 sago007 2016-01-29 22:43 47
5e876385 sago007 2016-01-29 22:43 48
#if ( (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) )
5e876385 sago007 2016-01-29 22:43 49
#define NFONT_FORMAT(X) __attribute__ ((format (printf, X, X+1)))
5e876385 sago007 2016-01-29 22:43 50
#else
5e876385 sago007 2016-01-29 22:43 51
#define NFONT_FORMAT(X)
5e876385 sago007 2016-01-29 22:43 52
#endif
5e876385 sago007 2016-01-29 22:43 53
5e876385 sago007 2016-01-29 22:43 54
#endif 
5e876385 sago007 2016-01-29 22:43 55
078900fe sago007 2015-12-05 15:31 56
#include "stdarg.h"
078900fe sago007 2015-12-05 15:31 57
078900fe sago007 2015-12-05 15:31 58
// Let's pretend this exists...
078900fe sago007 2015-12-05 15:31 59
#ifndef TTF_STYLE_OUTLINE
078900fe sago007 2015-12-05 15:31 60
    #define TTF_STYLE_OUTLINE	16
078900fe sago007 2015-12-05 15:31 61
#endif
078900fe sago007 2015-12-05 15:31 62
078900fe sago007 2015-12-05 15:31 63
struct FC_Font;
078900fe sago007 2015-12-05 15:31 64
078900fe sago007 2015-12-05 15:31 65
typedef struct _TTF_Font TTF_Font;
078900fe sago007 2015-12-05 15:31 66
078900fe sago007 2015-12-05 15:31 67
#if defined(NFONT_DLL) || defined(NFONT_DLL_EXPORT)
078900fe sago007 2015-12-05 15:31 68
	#ifdef NFONT_DLL_EXPORT
078900fe sago007 2015-12-05 15:31 69
	#define NFONT_EXPORT __declspec(dllexport)
078900fe sago007 2015-12-05 15:31 70
	#else
078900fe sago007 2015-12-05 15:31 71
	#define NFONT_EXPORT __declspec(dllimport)
078900fe sago007 2015-12-05 15:31 72
	#endif
078900fe sago007 2015-12-05 15:31 73
#else
078900fe sago007 2015-12-05 15:31 74
	#define NFONT_EXPORT
078900fe sago007 2015-12-05 15:31 75
#endif
078900fe sago007 2015-12-05 15:31 76
078900fe sago007 2015-12-05 15:31 77
class NFONT_EXPORT NFont
078900fe sago007 2015-12-05 15:31 78
{
078900fe sago007 2015-12-05 15:31 79
  public:
078900fe sago007 2015-12-05 15:31 80
078900fe sago007 2015-12-05 15:31 81
	class NFONT_EXPORT Color
078900fe sago007 2015-12-05 15:31 82
    {
078900fe sago007 2015-12-05 15:31 83
        public:
078900fe sago007 2015-12-05 15:31 84
        
078900fe sago007 2015-12-05 15:31 85
        Uint8 r, g, b, a;
078900fe sago007 2015-12-05 15:31 86
        
078900fe sago007 2015-12-05 15:31 87
        Color();
078900fe sago007 2015-12-05 15:31 88
        Color(Uint8 r, Uint8 g, Uint8 b);
078900fe sago007 2015-12-05 15:31 89
        Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
078900fe sago007 2015-12-05 15:31 90
        Color(const SDL_Color& color);
078900fe sago007 2015-12-05 15:31 91
        
078900fe sago007 2015-12-05 15:31 92
        Color& rgb(Uint8 R, Uint8 G, Uint8 B);
078900fe sago007 2015-12-05 15:31 93
        Color& rgba(Uint8 R, Uint8 G, Uint8 B, Uint8 A);
078900fe sago007 2015-12-05 15:31 94
        Color& color(const SDL_Color& color);
078900fe sago007 2015-12-05 15:31 95
        
078900fe sago007 2015-12-05 15:31 96
        SDL_Color to_SDL_Color() const;
078900fe sago007 2015-12-05 15:31 97
    };
078900fe sago007 2015-12-05 15:31 98
    
078900fe sago007 2015-12-05 15:31 99
	class NFONT_EXPORT Rectf
078900fe sago007 2015-12-05 15:31 100
    {
078900fe sago007 2015-12-05 15:31 101
        public:
078900fe sago007 2015-12-05 15:31 102
        float x, y;
078900fe sago007 2015-12-05 15:31 103
        float w, h;
078900fe sago007 2015-12-05 15:31 104
        
078900fe sago007 2015-12-05 15:31 105
        Rectf();
078900fe sago007 2015-12-05 15:31 106
        Rectf(float x, float y);
078900fe sago007 2015-12-05 15:31 107
        Rectf(float x, float y, float w, float h);
078900fe sago007 2015-12-05 15:31 108
        Rectf(const SDL_Rect& rect);
078900fe sago007 2015-12-05 15:31 109
        
078900fe sago007 2015-12-05 15:31 110
        SDL_Rect to_SDL_Rect() const;
078900fe sago007 2015-12-05 15:31 111
        
078900fe sago007 2015-12-05 15:31 112
        #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 113
        Rectf(const GPU_Rect& rect);
078900fe sago007 2015-12-05 15:31 114
        GPU_Rect to_GPU_Rect() const;
078900fe sago007 2015-12-05 15:31 115
        #endif
078900fe sago007 2015-12-05 15:31 116
    };
078900fe sago007 2015-12-05 15:31 117
078900fe sago007 2015-12-05 15:31 118
    
078900fe sago007 2015-12-05 15:31 119
    enum AlignEnum {LEFT, CENTER, RIGHT};
078900fe sago007 2015-12-05 15:31 120
    enum FilterEnum {NEAREST, LINEAR};
078900fe sago007 2015-12-05 15:31 121
    
078900fe sago007 2015-12-05 15:31 122
	class NFONT_EXPORT Scale
078900fe sago007 2015-12-05 15:31 123
    {
078900fe sago007 2015-12-05 15:31 124
        public:
078900fe sago007 2015-12-05 15:31 125
        
078900fe sago007 2015-12-05 15:31 126
        float x;
078900fe sago007 2015-12-05 15:31 127
        float y;
078900fe sago007 2015-12-05 15:31 128
        
078900fe sago007 2015-12-05 15:31 129
        enum ScaleTypeEnum {NEAREST};
078900fe sago007 2015-12-05 15:31 130
        ScaleTypeEnum type;
078900fe sago007 2015-12-05 15:31 131
        
078900fe sago007 2015-12-05 15:31 132
        Scale()
078900fe sago007 2015-12-05 15:31 133
            : x(1.0f), y(1.0f), type(NEAREST)
078900fe sago007 2015-12-05 15:31 134
        {}
078900fe sago007 2015-12-05 15:31 135
        Scale(float xy)
078900fe sago007 2015-12-05 15:31 136
            : x(xy), y(xy), type(NEAREST)
078900fe sago007 2015-12-05 15:31 137
        {}
078900fe sago007 2015-12-05 15:31 138
        Scale(float xy, ScaleTypeEnum type)
078900fe sago007 2015-12-05 15:31 139
            : x(xy), y(xy), type(type)
078900fe sago007 2015-12-05 15:31 140
        {}
078900fe sago007 2015-12-05 15:31 141
        Scale(float x, float y)
078900fe sago007 2015-12-05 15:31 142
            : x(x), y(y), type(NEAREST)
078900fe sago007 2015-12-05 15:31 143
        {}
078900fe sago007 2015-12-05 15:31 144
        Scale(float x, float y, ScaleTypeEnum type)
078900fe sago007 2015-12-05 15:31 145
            : x(x), y(y), type(type)
078900fe sago007 2015-12-05 15:31 146
        {}
078900fe sago007 2015-12-05 15:31 147
    };
078900fe sago007 2015-12-05 15:31 148
    
078900fe sago007 2015-12-05 15:31 149
	class NFONT_EXPORT Effect
078900fe sago007 2015-12-05 15:31 150
    {
078900fe sago007 2015-12-05 15:31 151
        public:
078900fe sago007 2015-12-05 15:31 152
        AlignEnum alignment;
078900fe sago007 2015-12-05 15:31 153
        Scale scale;
078900fe sago007 2015-12-05 15:31 154
        bool use_color;
078900fe sago007 2015-12-05 15:31 155
        Color color;
078900fe sago007 2015-12-05 15:31 156
        
078900fe sago007 2015-12-05 15:31 157
        Effect()
078900fe sago007 2015-12-05 15:31 158
            : alignment(LEFT), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 159
        {}
078900fe sago007 2015-12-05 15:31 160
        
078900fe sago007 2015-12-05 15:31 161
        Effect(const Scale& scale)
078900fe sago007 2015-12-05 15:31 162
            : alignment(LEFT), scale(scale), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 163
        {}
078900fe sago007 2015-12-05 15:31 164
        Effect(AlignEnum alignment)
078900fe sago007 2015-12-05 15:31 165
            : alignment(alignment), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 166
        {}
078900fe sago007 2015-12-05 15:31 167
        Effect(const Color& color)
078900fe sago007 2015-12-05 15:31 168
            : alignment(LEFT), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 169
        {}
078900fe sago007 2015-12-05 15:31 170
        
078900fe sago007 2015-12-05 15:31 171
        Effect(AlignEnum alignment, const Scale& scale)
078900fe sago007 2015-12-05 15:31 172
            : alignment(alignment), scale(scale), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 173
        {}
078900fe sago007 2015-12-05 15:31 174
        Effect(AlignEnum alignment, const Color& color)
078900fe sago007 2015-12-05 15:31 175
            : alignment(alignment), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 176
        {}
078900fe sago007 2015-12-05 15:31 177
        Effect(const Scale& scale, const Color& color)
078900fe sago007 2015-12-05 15:31 178
            : alignment(LEFT), scale(scale), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 179
        {}
078900fe sago007 2015-12-05 15:31 180
        Effect(AlignEnum alignment, const Scale& scale, const Color& color)
078900fe sago007 2015-12-05 15:31 181
            : alignment(alignment), scale(scale), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 182
        {}
078900fe sago007 2015-12-05 15:31 183
    };
078900fe sago007 2015-12-05 15:31 184
    
078900fe sago007 2015-12-05 15:31 185
    
078900fe sago007 2015-12-05 15:31 186
    // Constructors
078900fe sago007 2015-12-05 15:31 187
    NFont();
078900fe sago007 2015-12-05 15:31 188
    NFont(const NFont& font);
078900fe sago007 2015-12-05 15:31 189
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 190
    NFont(SDL_Surface* src);
078900fe sago007 2015-12-05 15:31 191
    NFont(TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 192
    NFont(TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 193
    NFont(const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 194
    NFont(const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 195
    NFont(SDL_RWops* file_rwops_ttf, Uint8 own_rwops, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 196
    #else
078900fe sago007 2015-12-05 15:31 197
    NFont(SDL_Renderer* renderer, SDL_Surface* src);
078900fe sago007 2015-12-05 15:31 198
    NFont(SDL_Renderer* renderer, TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 199
    NFont(SDL_Renderer* renderer, TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 200
    NFont(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 201
    NFont(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 202
    NFont(SDL_Renderer* renderer, SDL_RWops* file_rwops_ttf, Uint8 own_rwops, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 203
    #endif
078900fe sago007 2015-12-05 15:31 204
    
078900fe sago007 2015-12-05 15:31 205
    ~NFont();
078900fe sago007 2015-12-05 15:31 206
    
078900fe sago007 2015-12-05 15:31 207
    NFont& operator=(const NFont& font);
078900fe sago007 2015-12-05 15:31 208
078900fe sago007 2015-12-05 15:31 209
    // Loading
078900fe sago007 2015-12-05 15:31 210
    void setLoadingString(const char* str);
078900fe sago007 2015-12-05 15:31 211
    
078900fe sago007 2015-12-05 15:31 212
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 213
    bool load(SDL_Surface* FontSurface);
078900fe sago007 2015-12-05 15:31 214
    bool load(TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 215
    bool load(TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 216
    bool load(const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 217
    bool load(const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 218
    bool load(SDL_RWops* file_rwops_ttf, Uint8 own_rwops, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 219
    #else
078900fe sago007 2015-12-05 15:31 220
    bool load(SDL_Renderer* renderer, SDL_Surface* FontSurface);
078900fe sago007 2015-12-05 15:31 221
    bool load(SDL_Renderer* renderer, TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 222
    bool load(SDL_Renderer* renderer, TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 223
    bool load(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 224
    bool load(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 225
    bool load(SDL_Renderer* renderer, SDL_RWops* file_rwops_ttf, Uint8 own_rwops, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 226
    #endif
078900fe sago007 2015-12-05 15:31 227
    
078900fe sago007 2015-12-05 15:31 228
    void free();
078900fe sago007 2015-12-05 15:31 229
078900fe sago007 2015-12-05 15:31 230
    // Drawing
078900fe sago007 2015-12-05 15:31 231
    #ifdef NFONT_USE_SDL_GPU
5e876385 sago007 2016-01-29 22:43 232
    Rectf draw(GPU_Target* dest, float x, float y, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 233
    Rectf draw(GPU_Target* dest, float x, float y, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 234
    Rectf draw(GPU_Target* dest, float x, float y, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 235
    Rectf draw(GPU_Target* dest, float x, float y, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 236
    Rectf draw(GPU_Target* dest, float x, float y, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(6);
078900fe sago007 2015-12-05 15:31 237
    
5e876385 sago007 2016-01-29 22:43 238
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const char* formatted_text, ...) NFONT_FORMAT(4);
5e876385 sago007 2016-01-29 22:43 239
    Rectf drawBox(GPU_Target* dest, const Rectf& box, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 240
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 241
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 242
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(5);
078900fe sago007 2015-12-05 15:31 243
    
5e876385 sago007 2016-01-29 22:43 244
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 245
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 246
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 247
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 248
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(7);
078900fe sago007 2015-12-05 15:31 249
    #else
5e876385 sago007 2016-01-29 22:43 250
    Rectf draw(SDL_Renderer* dest, float x, float y, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 251
    Rectf draw(SDL_Renderer* dest, float x, float y, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 252
    Rectf draw(SDL_Renderer* dest, float x, float y, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 253
    Rectf draw(SDL_Renderer* dest, float x, float y, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 254
    Rectf draw(SDL_Renderer* dest, float x, float y, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(6);
078900fe sago007 2015-12-05 15:31 255
    
5e876385 sago007 2016-01-29 22:43 256
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const char* formatted_text, ...) NFONT_FORMAT(4);
5e876385 sago007 2016-01-29 22:43 257
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 258
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 259
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(5);
5e876385 sago007 2016-01-29 22:43 260
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(5);
078900fe sago007 2015-12-05 15:31 261
    
5e876385 sago007 2016-01-29 22:43 262
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const char* formatted_text, ...) NFONT_FORMAT(6);
5e876385 sago007 2016-01-29 22:43 263
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, AlignEnum align, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 264
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Scale& scale, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 265
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Color& color, const char* formatted_text, ...) NFONT_FORMAT(7);
5e876385 sago007 2016-01-29 22:43 266
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Effect& effect, const char* formatted_text, ...) NFONT_FORMAT(7);
078900fe sago007 2015-12-05 15:31 267
    #endif
078900fe sago007 2015-12-05 15:31 268
    
078900fe sago007 2015-12-05 15:31 269
    // Getters
078900fe sago007 2015-12-05 15:31 270
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 271
    GPU_Image* getImage() const;
078900fe sago007 2015-12-05 15:31 272
    #else
078900fe sago007 2015-12-05 15:31 273
    SDL_Texture* getImage() const;
078900fe sago007 2015-12-05 15:31 274
    #endif
078900fe sago007 2015-12-05 15:31 275
    SDL_Surface* getSurface() const;
078900fe sago007 2015-12-05 15:31 276
    FilterEnum getFilterMode() const;
078900fe sago007 2015-12-05 15:31 277
    Uint16 getHeight() const;
5e876385 sago007 2016-01-29 22:43 278
    Uint16 getHeight(const char* formatted_text, ...) const NFONT_FORMAT(2);
5e876385 sago007 2016-01-29 22:43 279
    Uint16 getWidth(const char* formatted_text, ...) NFONT_FORMAT(2);
5e876385 sago007 2016-01-29 22:43 280
    Rectf getCharacterOffset(Uint16 position_index, int column_width, const char* formatted_text, ...) NFONT_FORMAT(4);
5e876385 sago007 2016-01-29 22:43 281
    Uint16 getColumnHeight(Uint16 width, const char* formatted_text, ...) NFONT_FORMAT(3);
078900fe sago007 2015-12-05 15:31 282
    int getSpacing() const;
078900fe sago007 2015-12-05 15:31 283
    int getLineSpacing() const;
078900fe sago007 2015-12-05 15:31 284
    Uint16 getBaseline() const;
078900fe sago007 2015-12-05 15:31 285
    int getAscent() const;
078900fe sago007 2015-12-05 15:31 286
    int getAscent(const char character);
5e876385 sago007 2016-01-29 22:43 287
    int getAscent(const char* formatted_text, ...) NFONT_FORMAT(2);
078900fe sago007 2015-12-05 15:31 288
    int getDescent() const;
078900fe sago007 2015-12-05 15:31 289
    int getDescent(const char character);
5e876385 sago007 2016-01-29 22:43 290
    int getDescent(const char* formatted_text, ...) NFONT_FORMAT(2);
078900fe sago007 2015-12-05 15:31 291
    Uint16 getMaxWidth() const;
078900fe sago007 2015-12-05 15:31 292
    Color getDefaultColor() const;
078900fe sago007 2015-12-05 15:31 293
    
078900fe sago007 2015-12-05 15:31 294
    // Setters
078900fe sago007 2015-12-05 15:31 295
    void setFilterMode(FilterEnum filter);
078900fe sago007 2015-12-05 15:31 296
    void setSpacing(int LetterSpacing);
078900fe sago007 2015-12-05 15:31 297
    void setLineSpacing(int LineSpacing);
078900fe sago007 2015-12-05 15:31 298
    void setBaseline();
078900fe sago007 2015-12-05 15:31 299
    void setBaseline(Uint16 Baseline);
078900fe sago007 2015-12-05 15:31 300
    void setDefaultColor(const Color& color);
078900fe sago007 2015-12-05 15:31 301
    
078900fe sago007 2015-12-05 15:31 302
    void enableTTFOwnership();
078900fe sago007 2015-12-05 15:31 303
    
078900fe sago007 2015-12-05 15:31 304
  private:
078900fe sago007 2015-12-05 15:31 305
    
078900fe sago007 2015-12-05 15:31 306
    static char* buffer;
078900fe sago007 2015-12-05 15:31 307
    FC_Font* font;
078900fe sago007 2015-12-05 15:31 308
    
078900fe sago007 2015-12-05 15:31 309
    void init();  // Common constructor
078900fe sago007 2015-12-05 15:31 310
078900fe sago007 2015-12-05 15:31 311
};
078900fe sago007 2015-12-05 15:31 312
078900fe sago007 2015-12-05 15:31 313
078900fe sago007 2015-12-05 15:31 314
078900fe sago007 2015-12-05 15:31 315
#endif // _NFONT_H__
1970-01-01 00:00 316