From 92f17580846c88108aab023092c23e6bcdcf2f75 Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Fri, 14 Aug 2015 23:45:02 +0800 Subject: SMELT is finally finished! Add the SMELT library for future use. Add .gitignore. --- include/smbmfont.hpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 include/smbmfont.hpp (limited to 'include/smbmfont.hpp') diff --git a/include/smbmfont.hpp b/include/smbmfont.hpp new file mode 100644 index 0000000..8dffc1f --- /dev/null +++ b/include/smbmfont.hpp @@ -0,0 +1,62 @@ +// -*- C++ -*- +/* + * Simple MultimEdia LiTerator(SMELT) + * by Chris Xiong 2015 + * api level 1 + * Bitmap font support header + * + * WARNING: This library is in development and interfaces would be very + * unstable. + * + */ + #ifndef SMBMFONT_H +#define SMBMFONT_H +#include "smanim.hpp" +#include +#ifndef ALIGN_LEFT +#define ALIGN_LEFT 0 +#define ALIGN_RIGHT 1 +#define ALIGN_CENTER 2 +#endif +class smBMFont +{ +private: + static SMELT *sm; + smDtpFileR anm; + float sc,hadv; + smEntity2D* chars[256]; + int pdb[256],pda[256],b; + DWORD color; + std::map xm; + void parseMeta(char* meta,DWORD size); +public: + bool loadAnmFromMemory(char* ptr,DWORD size); + void close(); + void render(float x,float y,float z,int align,float *rw,const char* text); + void printf(float x,float y,float z,int align,float *rw,const char* format,...); + void setColor(DWORD col){color=col;} + void setBlend(int blend){b=blend;} + void setScale(float scale){sc=scale;} +}; +class smBMFontw +{ +private: + static SMELT *sm; + smDtpFileR anm; + float sc,hadv; + int b; + DWORD color; + std::map xm; + std::map chars; + std::map pdb,pda; + void parseMeta(char* meta,DWORD size); +public: + bool loadAnmFromMemory(char* ptr,DWORD size); + void close(); + void render(float x,float y,float z,int align,float *rw,const wchar_t* text); + void printf(float x,float y,float z,int align,float *rw,const wchar_t* format,...); + void setColor(DWORD col){color=col;} + void setBlend(int blend){b=blend;} + void setScale(float scale){sc=scale;} +}; +#endif -- cgit v1.2.3