aboutsummaryrefslogtreecommitdiff
path: root/include/smbmfont.hpp
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-06 21:28:40 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-06 21:28:40 +0800
commit038b31f0158a0018dbf2eceb71026cc4e665faa9 (patch)
treea373ddab7bc162e477e28a780b0d729660ff8634 /include/smbmfont.hpp
parenta8077292d5d9118866f7358c11a90c855e1b1b02 (diff)
downloadSMELT-038b31f0158a0018dbf2eceb71026cc4e665faa9.tar.xz
Add the SMELT files...
Please, do not laugh too loudly.
Diffstat (limited to 'include/smbmfont.hpp')
-rw-r--r--include/smbmfont.hpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/include/smbmfont.hpp b/include/smbmfont.hpp
new file mode 100644
index 0000000..44f2e2f
--- /dev/null
+++ b/include/smbmfont.hpp
@@ -0,0 +1,61 @@
+// -*- C++ -*-
+/*
+ * Simple MultimEdia LiTerator(SMELT)
+ * by Chris Xiong 2015
+ * 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 <cwchar>
+#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<std::string,SMTEX> xm;
+ void parseMeta(const char* meta,DWORD size);
+public:
+ bool loadAnmFromMemory(const 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<std::string,SMTEX> xm;
+ std::map<wchar_t,smEntity2D*> chars;
+ std::map<wchar_t,int> 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