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
078900fe sago007 2015-12-05 15:31 46
#include "stdarg.h"
078900fe sago007 2015-12-05 15:31 47
078900fe sago007 2015-12-05 15:31 48
// Let's pretend this exists...
078900fe sago007 2015-12-05 15:31 49
#ifndef TTF_STYLE_OUTLINE
078900fe sago007 2015-12-05 15:31 50
    #define TTF_STYLE_OUTLINE	16
078900fe sago007 2015-12-05 15:31 51
#endif
078900fe sago007 2015-12-05 15:31 52
078900fe sago007 2015-12-05 15:31 53
struct FC_Font;
078900fe sago007 2015-12-05 15:31 54
078900fe sago007 2015-12-05 15:31 55
typedef struct _TTF_Font TTF_Font;
078900fe sago007 2015-12-05 15:31 56
078900fe sago007 2015-12-05 15:31 57
#if defined(NFONT_DLL) || defined(NFONT_DLL_EXPORT)
078900fe sago007 2015-12-05 15:31 58
	#ifdef NFONT_DLL_EXPORT
078900fe sago007 2015-12-05 15:31 59
	#define NFONT_EXPORT __declspec(dllexport)
078900fe sago007 2015-12-05 15:31 60
	#else
078900fe sago007 2015-12-05 15:31 61
	#define NFONT_EXPORT __declspec(dllimport)
078900fe sago007 2015-12-05 15:31 62
	#endif
078900fe sago007 2015-12-05 15:31 63
#else
078900fe sago007 2015-12-05 15:31 64
	#define NFONT_EXPORT
078900fe sago007 2015-12-05 15:31 65
#endif
078900fe sago007 2015-12-05 15:31 66
078900fe sago007 2015-12-05 15:31 67
class NFONT_EXPORT NFont
078900fe sago007 2015-12-05 15:31 68
{
078900fe sago007 2015-12-05 15:31 69
  public:
078900fe sago007 2015-12-05 15:31 70
078900fe sago007 2015-12-05 15:31 71
	class NFONT_EXPORT Color
078900fe sago007 2015-12-05 15:31 72
    {
078900fe sago007 2015-12-05 15:31 73
        public:
078900fe sago007 2015-12-05 15:31 74
        
078900fe sago007 2015-12-05 15:31 75
        Uint8 r, g, b, a;
078900fe sago007 2015-12-05 15:31 76
        
078900fe sago007 2015-12-05 15:31 77
        Color();
078900fe sago007 2015-12-05 15:31 78
        Color(Uint8 r, Uint8 g, Uint8 b);
078900fe sago007 2015-12-05 15:31 79
        Color(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
078900fe sago007 2015-12-05 15:31 80
        Color(const SDL_Color& color);
078900fe sago007 2015-12-05 15:31 81
        
078900fe sago007 2015-12-05 15:31 82
        Color& rgb(Uint8 R, Uint8 G, Uint8 B);
078900fe sago007 2015-12-05 15:31 83
        Color& rgba(Uint8 R, Uint8 G, Uint8 B, Uint8 A);
078900fe sago007 2015-12-05 15:31 84
        Color& color(const SDL_Color& color);
078900fe sago007 2015-12-05 15:31 85
        
078900fe sago007 2015-12-05 15:31 86
        SDL_Color to_SDL_Color() const;
078900fe sago007 2015-12-05 15:31 87
    };
078900fe sago007 2015-12-05 15:31 88
    
078900fe sago007 2015-12-05 15:31 89
	class NFONT_EXPORT Rectf
078900fe sago007 2015-12-05 15:31 90
    {
078900fe sago007 2015-12-05 15:31 91
        public:
078900fe sago007 2015-12-05 15:31 92
        float x, y;
078900fe sago007 2015-12-05 15:31 93
        float w, h;
078900fe sago007 2015-12-05 15:31 94
        
078900fe sago007 2015-12-05 15:31 95
        Rectf();
078900fe sago007 2015-12-05 15:31 96
        Rectf(float x, float y);
078900fe sago007 2015-12-05 15:31 97
        Rectf(float x, float y, float w, float h);
078900fe sago007 2015-12-05 15:31 98
        Rectf(const SDL_Rect& rect);
078900fe sago007 2015-12-05 15:31 99
        
078900fe sago007 2015-12-05 15:31 100
        SDL_Rect to_SDL_Rect() const;
078900fe sago007 2015-12-05 15:31 101
        
078900fe sago007 2015-12-05 15:31 102
        #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 103
        Rectf(const GPU_Rect& rect);
078900fe sago007 2015-12-05 15:31 104
        GPU_Rect to_GPU_Rect() const;
078900fe sago007 2015-12-05 15:31 105
        #endif
078900fe sago007 2015-12-05 15:31 106
    };
078900fe sago007 2015-12-05 15:31 107
078900fe sago007 2015-12-05 15:31 108
    
078900fe sago007 2015-12-05 15:31 109
    enum AlignEnum {LEFT, CENTER, RIGHT};
078900fe sago007 2015-12-05 15:31 110
    enum FilterEnum {NEAREST, LINEAR};
078900fe sago007 2015-12-05 15:31 111
    
078900fe sago007 2015-12-05 15:31 112
	class NFONT_EXPORT Scale
078900fe sago007 2015-12-05 15:31 113
    {
078900fe sago007 2015-12-05 15:31 114
        public:
078900fe sago007 2015-12-05 15:31 115
        
078900fe sago007 2015-12-05 15:31 116
        float x;
078900fe sago007 2015-12-05 15:31 117
        float y;
078900fe sago007 2015-12-05 15:31 118
        
078900fe sago007 2015-12-05 15:31 119
        enum ScaleTypeEnum {NEAREST};
078900fe sago007 2015-12-05 15:31 120
        ScaleTypeEnum type;
078900fe sago007 2015-12-05 15:31 121
        
078900fe sago007 2015-12-05 15:31 122
        Scale()
078900fe sago007 2015-12-05 15:31 123
            : x(1.0f), y(1.0f), type(NEAREST)
078900fe sago007 2015-12-05 15:31 124
        {}
078900fe sago007 2015-12-05 15:31 125
        Scale(float xy)
078900fe sago007 2015-12-05 15:31 126
            : x(xy), y(xy), type(NEAREST)
078900fe sago007 2015-12-05 15:31 127
        {}
078900fe sago007 2015-12-05 15:31 128
        Scale(float xy, ScaleTypeEnum type)
078900fe sago007 2015-12-05 15:31 129
            : x(xy), y(xy), type(type)
078900fe sago007 2015-12-05 15:31 130
        {}
078900fe sago007 2015-12-05 15:31 131
        Scale(float x, float y)
078900fe sago007 2015-12-05 15:31 132
            : x(x), y(y), type(NEAREST)
078900fe sago007 2015-12-05 15:31 133
        {}
078900fe sago007 2015-12-05 15:31 134
        Scale(float x, float y, ScaleTypeEnum type)
078900fe sago007 2015-12-05 15:31 135
            : x(x), y(y), type(type)
078900fe sago007 2015-12-05 15:31 136
        {}
078900fe sago007 2015-12-05 15:31 137
    };
078900fe sago007 2015-12-05 15:31 138
    
078900fe sago007 2015-12-05 15:31 139
	class NFONT_EXPORT Effect
078900fe sago007 2015-12-05 15:31 140
    {
078900fe sago007 2015-12-05 15:31 141
        public:
078900fe sago007 2015-12-05 15:31 142
        AlignEnum alignment;
078900fe sago007 2015-12-05 15:31 143
        Scale scale;
078900fe sago007 2015-12-05 15:31 144
        bool use_color;
078900fe sago007 2015-12-05 15:31 145
        Color color;
078900fe sago007 2015-12-05 15:31 146
        
078900fe sago007 2015-12-05 15:31 147
        Effect()
078900fe sago007 2015-12-05 15:31 148
            : alignment(LEFT), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 149
        {}
078900fe sago007 2015-12-05 15:31 150
        
078900fe sago007 2015-12-05 15:31 151
        Effect(const Scale& scale)
078900fe sago007 2015-12-05 15:31 152
            : alignment(LEFT), scale(scale), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 153
        {}
078900fe sago007 2015-12-05 15:31 154
        Effect(AlignEnum alignment)
078900fe sago007 2015-12-05 15:31 155
            : alignment(alignment), use_color(false), color(255, 255, 255, 255)
078900fe sago007 2015-12-05 15:31 156
        {}
078900fe sago007 2015-12-05 15:31 157
        Effect(const Color& color)
078900fe sago007 2015-12-05 15:31 158
            : alignment(LEFT), use_color(true), color(color)
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(AlignEnum alignment, const Scale& scale)
078900fe sago007 2015-12-05 15:31 162
            : alignment(alignment), 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, const Color& color)
078900fe sago007 2015-12-05 15:31 165
            : alignment(alignment), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 166
        {}
078900fe sago007 2015-12-05 15:31 167
        Effect(const Scale& scale, const Color& color)
078900fe sago007 2015-12-05 15:31 168
            : alignment(LEFT), scale(scale), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 169
        {}
078900fe sago007 2015-12-05 15:31 170
        Effect(AlignEnum alignment, const Scale& scale, const Color& color)
078900fe sago007 2015-12-05 15:31 171
            : alignment(alignment), scale(scale), use_color(true), color(color)
078900fe sago007 2015-12-05 15:31 172
        {}
078900fe sago007 2015-12-05 15:31 173
    };
078900fe sago007 2015-12-05 15:31 174
    
078900fe sago007 2015-12-05 15:31 175
    
078900fe sago007 2015-12-05 15:31 176
    // Constructors
078900fe sago007 2015-12-05 15:31 177
    NFont();
078900fe sago007 2015-12-05 15:31 178
    NFont(const NFont& font);
078900fe sago007 2015-12-05 15:31 179
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 180
    NFont(SDL_Surface* src);
078900fe sago007 2015-12-05 15:31 181
    NFont(TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 182
    NFont(TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 183
    NFont(const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 184
    NFont(const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 185
    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 186
    #else
078900fe sago007 2015-12-05 15:31 187
    NFont(SDL_Renderer* renderer, SDL_Surface* src);
078900fe sago007 2015-12-05 15:31 188
    NFont(SDL_Renderer* renderer, TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 189
    NFont(SDL_Renderer* renderer, TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 190
    NFont(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 191
    NFont(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 192
    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 193
    #endif
078900fe sago007 2015-12-05 15:31 194
    
078900fe sago007 2015-12-05 15:31 195
    ~NFont();
078900fe sago007 2015-12-05 15:31 196
    
078900fe sago007 2015-12-05 15:31 197
    NFont& operator=(const NFont& font);
078900fe sago007 2015-12-05 15:31 198
078900fe sago007 2015-12-05 15:31 199
    // Loading
078900fe sago007 2015-12-05 15:31 200
    void setLoadingString(const char* str);
078900fe sago007 2015-12-05 15:31 201
    
078900fe sago007 2015-12-05 15:31 202
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 203
    bool load(SDL_Surface* FontSurface);
078900fe sago007 2015-12-05 15:31 204
    bool load(TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 205
    bool load(TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 206
    bool load(const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 207
    bool load(const char* filename_ttf, Uint32 pointSize, const NFont::Color& color, int style = 0);
078900fe sago007 2015-12-05 15:31 208
    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 209
    #else
078900fe sago007 2015-12-05 15:31 210
    bool load(SDL_Renderer* renderer, SDL_Surface* FontSurface);
078900fe sago007 2015-12-05 15:31 211
    bool load(SDL_Renderer* renderer, TTF_Font* ttf);
078900fe sago007 2015-12-05 15:31 212
    bool load(SDL_Renderer* renderer, TTF_Font* ttf, const NFont::Color& color);
078900fe sago007 2015-12-05 15:31 213
    bool load(SDL_Renderer* renderer, const char* filename_ttf, Uint32 pointSize);
078900fe sago007 2015-12-05 15:31 214
    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 215
    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 216
    #endif
078900fe sago007 2015-12-05 15:31 217
    
078900fe sago007 2015-12-05 15:31 218
    void free();
078900fe sago007 2015-12-05 15:31 219
078900fe sago007 2015-12-05 15:31 220
    // Drawing
078900fe sago007 2015-12-05 15:31 221
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 222
    Rectf draw(GPU_Target* dest, float x, float y, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 223
    Rectf draw(GPU_Target* dest, float x, float y, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 224
    Rectf draw(GPU_Target* dest, float x, float y, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 225
    Rectf draw(GPU_Target* dest, float x, float y, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 226
    Rectf draw(GPU_Target* dest, float x, float y, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 227
    
078900fe sago007 2015-12-05 15:31 228
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 229
    Rectf drawBox(GPU_Target* dest, const Rectf& box, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 230
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 231
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 232
    Rectf drawBox(GPU_Target* dest, const Rectf& box, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 233
    
078900fe sago007 2015-12-05 15:31 234
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 235
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 236
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 237
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 238
    Rectf drawColumn(GPU_Target* dest, float x, float y, Uint16 width, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 239
    #else
078900fe sago007 2015-12-05 15:31 240
    Rectf draw(SDL_Renderer* dest, float x, float y, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 241
    Rectf draw(SDL_Renderer* dest, float x, float y, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 242
    Rectf draw(SDL_Renderer* dest, float x, float y, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 243
    Rectf draw(SDL_Renderer* dest, float x, float y, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 244
    Rectf draw(SDL_Renderer* dest, float x, float y, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 245
    
078900fe sago007 2015-12-05 15:31 246
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 247
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 248
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 249
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 250
    Rectf drawBox(SDL_Renderer* dest, const Rectf& box, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 251
    
078900fe sago007 2015-12-05 15:31 252
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 253
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, AlignEnum align, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 254
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Scale& scale, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 255
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Color& color, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 256
    Rectf drawColumn(SDL_Renderer* dest, float x, float y, Uint16 width, const Effect& effect, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 257
    #endif
078900fe sago007 2015-12-05 15:31 258
    
078900fe sago007 2015-12-05 15:31 259
    // Getters
078900fe sago007 2015-12-05 15:31 260
    #ifdef NFONT_USE_SDL_GPU
078900fe sago007 2015-12-05 15:31 261
    GPU_Image* getImage() const;
078900fe sago007 2015-12-05 15:31 262
    #else
078900fe sago007 2015-12-05 15:31 263
    SDL_Texture* getImage() const;
078900fe sago007 2015-12-05 15:31 264
    #endif
078900fe sago007 2015-12-05 15:31 265
    SDL_Surface* getSurface() const;
078900fe sago007 2015-12-05 15:31 266
    FilterEnum getFilterMode() const;
078900fe sago007 2015-12-05 15:31 267
    Uint16 getHeight() const;
078900fe sago007 2015-12-05 15:31 268
    Uint16 getHeight(const char* formatted_text, ...) const;
078900fe sago007 2015-12-05 15:31 269
    Uint16 getWidth(const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 270
    Rectf getCharacterOffset(Uint16 position_index, int column_width, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 271
    Uint16 getColumnHeight(Uint16 width, const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 272
    int getSpacing() const;
078900fe sago007 2015-12-05 15:31 273
    int getLineSpacing() const;
078900fe sago007 2015-12-05 15:31 274
    Uint16 getBaseline() const;
078900fe sago007 2015-12-05 15:31 275
    int getAscent() const;
078900fe sago007 2015-12-05 15:31 276
    int getAscent(const char character);
078900fe sago007 2015-12-05 15:31 277
    int getAscent(const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 278
    int getDescent() const;
078900fe sago007 2015-12-05 15:31 279
    int getDescent(const char character);
078900fe sago007 2015-12-05 15:31 280
    int getDescent(const char* formatted_text, ...);
078900fe sago007 2015-12-05 15:31 281
    Uint16 getMaxWidth() const;
078900fe sago007 2015-12-05 15:31 282
    Color getDefaultColor() const;
078900fe sago007 2015-12-05 15:31 283
    
078900fe sago007 2015-12-05 15:31 284
    // Setters
078900fe sago007 2015-12-05 15:31 285
    void setFilterMode(FilterEnum filter);
078900fe sago007 2015-12-05 15:31 286
    void setSpacing(int LetterSpacing);
078900fe sago007 2015-12-05 15:31 287
    void setLineSpacing(int LineSpacing);
078900fe sago007 2015-12-05 15:31 288
    void setBaseline();
078900fe sago007 2015-12-05 15:31 289
    void setBaseline(Uint16 Baseline);
078900fe sago007 2015-12-05 15:31 290
    void setDefaultColor(const Color& color);
078900fe sago007 2015-12-05 15:31 291
    
078900fe sago007 2015-12-05 15:31 292
    void enableTTFOwnership();
078900fe sago007 2015-12-05 15:31 293
    
078900fe sago007 2015-12-05 15:31 294
  private:
078900fe sago007 2015-12-05 15:31 295
    
078900fe sago007 2015-12-05 15:31 296
    static char* buffer;
078900fe sago007 2015-12-05 15:31 297
    FC_Font* font;
078900fe sago007 2015-12-05 15:31 298
    
078900fe sago007 2015-12-05 15:31 299
    void init();  // Common constructor
078900fe sago007 2015-12-05 15:31 300
078900fe sago007 2015-12-05 15:31 301
};
078900fe sago007 2015-12-05 15:31 302
078900fe sago007 2015-12-05 15:31 303
078900fe sago007 2015-12-05 15:31 304
078900fe sago007 2015-12-05 15:31 305
#endif // _NFONT_H__
1970-01-01 00:00 306