- Main Page
- Classes
- Files

- File List
- File Members

# flFont.h

Go to the documentation of this file.

    00001 // Funclib Font v1.0.0
    00002 //
    00003 // This module contains functions for dealing with fonts.
    00004 // Use it to draw fonts in games and applications.
    00005 // This module requires doesn't require anything else, however printing characters
    00006 // from a debug font works better with GRAPHICS and better again with TEXTURE and GRAPHICS_2D, loading a texture font requires TEXTURE and
    00007 // rendering a texture font requires GRAPHICS, TEXTURE and GRAPHICS_2D.
    00008 //
    00009 // Contributor(s): Flatmush
    00010
    00011
    00012
    00013 #ifndef FLFONT_H
    00014 #define FLFONT_H
    00015
    00016 #include "flGlobal.h"
    00017
    00018 #if FL_FONT != 0
    00019
    00020 #if FL_TEXTURE != 0
    00021 #include "flTexture.h"
    00022 #endif
    00023
    00024 #ifdef __cplusplus
    00025 extern "C" {
    00026 #endif
    00027
    00028 #define FONT_TYPE_NONE         0
    00029 #define FONT_TYPE_TEXTURE      1
    00030 #define FONT_TYPE_DEBUG        2
    00031 #define FONT_TYPE_TEXTURE_MONO 3
    00032
    00033 typedef struct {
    00034      u8    fontType;
    00035      void* fontData;
    00036      int   fontHSpace;
    00037      int   fontVSpace;
    00038      u32   fontColor;
    00039      u32   fontBackColor;
    00040      bool  fontFixedWidth;
    00041      bool  fontDataGlobal;
    00042 } Font;
    00043
    00044 extern Font* fontDefault;
    00045
    00046 extern void  fontInit();
    00047 extern Font* fontLoad(char* inPath);
    00048 extern bool  fontSave(char* inPath, Font* inFont);
    00049 #if FL_TEXTURE != 0
    00050 extern Font* fontCreateTexture(Texture* inTex, int inHSpace, int inVSpace, u32 inColor);
    00051 #endif
    00052 extern Font* fontCreateDebug(int inHSpace, int inVSpace, u32 inColor);
    00053 #if FL_GRAPHICS != 0
    00054 extern bool  fontCreateDebugTex();
    00055 extern void fontDebugSetColor(u32 inColor, u32 inBackColor);
    00056 #endif
    00057 extern void  fontFree(Font* inFont);
    00058
    00059 extern int   fontHeight(Font* inFont);
    00060 extern int   fontCharWidth(Font* inFont, char inChar);
    00061 extern int   fontStringWidth(Font* inFont, char* inString);
    00062 extern int   fontStringHeight(Font* inFont, char* inString);
    00063
    00064 extern bool  fontDraw2dChar(int inX, int inY, Font* inFont, char inChar);
    00065 extern void  fontDraw2dString(int inX, int inY, Font* inFont, char* inString);
    00066 extern void  fontDraw2dStringCenter(int inY, Font* inFont, char* inString);
    00067 //extern void  fontDraw2dStringFromRight(int inX, int inY, Font* inFont, char* inString);
    00068 #define fontDraw2dStringFromRight(inX, inY, inFont, inString) fontDraw2dString((inX - fontStringWidth(inFont, inString)), inY, inFont, inString);
    00069
    00070 #ifdef __cplusplus
    00071 }
    00072 #endif
    00073
    00074 #endif
    00075
    00076 #endif