diff options
author | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 18:54:10 +1000 |
commit | 959831f4ef5a3e797f576c3de08cd65032c997ad (patch) | |
tree | e7351908be5995f0b325b2ebeaa02d5a34b82583 /libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool | |
parent | Add info about changes to Irrlicht. (diff) | |
download | SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.zip SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.gz SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.bz2 SledjHamr-959831f4ef5a3e797f576c3de08cd65032c997ad.tar.xz |
Remove damned ancient DOS line endings from Irrlicht. Hopefully I did not go overboard.
Diffstat (limited to '')
13 files changed, 3500 insertions, 3500 deletions
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.cpp b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.cpp index 780e9b0..7579d5d 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.cpp +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.cpp | |||
@@ -1,801 +1,801 @@ | |||
1 | #include "CFontTool.h" | 1 | #include "CFontTool.h" |
2 | #include "IXMLWriter.h" | 2 | #include "IXMLWriter.h" |
3 | 3 | ||
4 | using namespace irr; | 4 | using namespace irr; |
5 | 5 | ||
6 | const int fontsizes[] = {4,6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,56,68,72,0}; | 6 | const int fontsizes[] = {4,6,8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,56,68,72,0}; |
7 | 7 | ||
8 | inline u32 getTextureSizeFromSurfaceSize(u32 size) | 8 | inline u32 getTextureSizeFromSurfaceSize(u32 size) |
9 | { | 9 | { |
10 | u32 ts = 0x01; | 10 | u32 ts = 0x01; |
11 | while(ts < size) | 11 | while(ts < size) |
12 | ts <<= 1; | 12 | ts <<= 1; |
13 | 13 | ||
14 | return ts; | 14 | return ts; |
15 | } | 15 | } |
16 | 16 | ||
17 | // windows specific | 17 | // windows specific |
18 | #ifdef _IRR_WINDOWS_ | 18 | #ifdef _IRR_WINDOWS_ |
19 | 19 | ||
20 | const DWORD charsets[] = { ANSI_CHARSET, DEFAULT_CHARSET, OEM_CHARSET, BALTIC_CHARSET, GB2312_CHARSET, CHINESEBIG5_CHARSET, | 20 | const DWORD charsets[] = { ANSI_CHARSET, DEFAULT_CHARSET, OEM_CHARSET, BALTIC_CHARSET, GB2312_CHARSET, CHINESEBIG5_CHARSET, |
21 | EASTEUROPE_CHARSET, GREEK_CHARSET, HANGUL_CHARSET, MAC_CHARSET, RUSSIAN_CHARSET, | 21 | EASTEUROPE_CHARSET, GREEK_CHARSET, HANGUL_CHARSET, MAC_CHARSET, RUSSIAN_CHARSET, |
22 | SHIFTJIS_CHARSET, SYMBOL_CHARSET, TURKISH_CHARSET, VIETNAMESE_CHARSET, JOHAB_CHARSET, | 22 | SHIFTJIS_CHARSET, SYMBOL_CHARSET, TURKISH_CHARSET, VIETNAMESE_CHARSET, JOHAB_CHARSET, |
23 | ARABIC_CHARSET, HEBREW_CHARSET, THAI_CHARSET, 0}; | 23 | ARABIC_CHARSET, HEBREW_CHARSET, THAI_CHARSET, 0}; |
24 | 24 | ||
25 | const wchar_t *setnames[] = {L"ANSI", L"All Available", L"OEM", L"Baltic", L"Chinese Simplified", L"Chinese Traditional", | 25 | const wchar_t *setnames[] = {L"ANSI", L"All Available", L"OEM", L"Baltic", L"Chinese Simplified", L"Chinese Traditional", |
26 | L"Eastern European", L"Greek", L"Hangul", L"Macintosh", L"Russian", | 26 | L"Eastern European", L"Greek", L"Hangul", L"Macintosh", L"Russian", |
27 | L"Japanese", L"Symbol", L"Turkish", L"Vietnamese", L"Johab", | 27 | L"Japanese", L"Symbol", L"Turkish", L"Vietnamese", L"Johab", |
28 | L"Arabic", L"Hebrew", L"Thai", 0}; | 28 | L"Arabic", L"Hebrew", L"Thai", 0}; |
29 | 29 | ||
30 | // callback for adding font names | 30 | // callback for adding font names |
31 | int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, | 31 | int CALLBACK EnumFontFamExProc( ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, |
32 | DWORD FontType, LPARAM lParam) | 32 | DWORD FontType, LPARAM lParam) |
33 | { | 33 | { |
34 | CFontTool* t = (CFontTool*) lParam; | 34 | CFontTool* t = (CFontTool*) lParam; |
35 | t->FontNames.push_back( core::stringw(lpelfe->elfFullName)); | 35 | t->FontNames.push_back( core::stringw(lpelfe->elfFullName)); |
36 | return 1; | 36 | return 1; |
37 | } | 37 | } |
38 | 38 | ||
39 | // | 39 | // |
40 | // Constructor | 40 | // Constructor |
41 | // | 41 | // |
42 | 42 | ||
43 | CFontTool::CFontTool(IrrlichtDevice* device) : FontSizes(fontsizes), | 43 | CFontTool::CFontTool(IrrlichtDevice* device) : FontSizes(fontsizes), |
44 | Device(device), UseAlphaChannel(false), | 44 | Device(device), UseAlphaChannel(false), |
45 | // win specific | 45 | // win specific |
46 | dc(0) | 46 | dc(0) |
47 | { | 47 | { |
48 | // init display context | 48 | // init display context |
49 | dc = CreateDC(L"DISPLAY", L"DISPLAY", 0 ,0 ); | 49 | dc = CreateDC(L"DISPLAY", L"DISPLAY", 0 ,0 ); |
50 | 50 | ||
51 | // populate list of available character set names | 51 | // populate list of available character set names |
52 | for (int i=0; setnames[i] != 0; ++i) | 52 | for (int i=0; setnames[i] != 0; ++i) |
53 | CharSets.push_back( core::stringw(setnames[i])); | 53 | CharSets.push_back( core::stringw(setnames[i])); |
54 | 54 | ||
55 | selectCharSet(0); | 55 | selectCharSet(0); |
56 | } | 56 | } |
57 | 57 | ||
58 | void CFontTool::selectCharSet(u32 currentCharSet) | 58 | void CFontTool::selectCharSet(u32 currentCharSet) |
59 | { | 59 | { |
60 | if ( currentCharSet >= CharSets.size() ) | 60 | if ( currentCharSet >= CharSets.size() ) |
61 | return; | 61 | return; |
62 | 62 | ||
63 | LOGFONTW lf; | 63 | LOGFONTW lf; |
64 | lf.lfFaceName[0] = L'\0'; | 64 | lf.lfFaceName[0] = L'\0'; |
65 | lf.lfCharSet = (BYTE) charsets[currentCharSet]; | 65 | lf.lfCharSet = (BYTE) charsets[currentCharSet]; |
66 | // HRESULT hr; // no error checking(!) | 66 | // HRESULT hr; // no error checking(!) |
67 | 67 | ||
68 | // clear font list | 68 | // clear font list |
69 | FontNames.clear(); | 69 | FontNames.clear(); |
70 | 70 | ||
71 | // create list of available fonts | 71 | // create list of available fonts |
72 | EnumFontFamiliesExW( dc, (LPLOGFONTW) &lf, (FONTENUMPROCW) EnumFontFamExProc, (LPARAM) this, 0); | 72 | EnumFontFamiliesExW( dc, (LPLOGFONTW) &lf, (FONTENUMPROCW) EnumFontFamExProc, (LPARAM) this, 0); |
73 | } | 73 | } |
74 | 74 | ||
75 | bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha) | 75 | bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha) |
76 | { | 76 | { |
77 | if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() ) | 77 | if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() ) |
78 | return false; | 78 | return false; |
79 | 79 | ||
80 | UseAlphaChannel = alpha; | 80 | UseAlphaChannel = alpha; |
81 | u32 currentImage = 0; | 81 | u32 currentImage = 0; |
82 | 82 | ||
83 | // create the font | 83 | // create the font |
84 | HFONT font = CreateFontW( | 84 | HFONT font = CreateFontW( |
85 | -MulDiv(fontSize, GetDeviceCaps(dc, LOGPIXELSY), 72), 0, | 85 | -MulDiv(fontSize, GetDeviceCaps(dc, LOGPIXELSY), 72), 0, |
86 | 0,0, | 86 | 0,0, |
87 | bold ? FW_BOLD : 0, | 87 | bold ? FW_BOLD : 0, |
88 | italic, 0,0, charsets[charsetIndex], 0,0, | 88 | italic, 0,0, charsets[charsetIndex], 0,0, |
89 | aa ? ANTIALIASED_QUALITY : 0, | 89 | aa ? ANTIALIASED_QUALITY : 0, |
90 | 0, FontNames[fontIndex].c_str() ); | 90 | 0, FontNames[fontIndex].c_str() ); |
91 | 91 | ||
92 | if (!font) | 92 | if (!font) |
93 | return false; | 93 | return false; |
94 | 94 | ||
95 | SelectObject(dc, font); | 95 | SelectObject(dc, font); |
96 | SetTextAlign (dc,TA_LEFT | TA_TOP | TA_NOUPDATECP); | 96 | SetTextAlign (dc,TA_LEFT | TA_TOP | TA_NOUPDATECP); |
97 | 97 | ||
98 | // get rid of the current textures/images | 98 | // get rid of the current textures/images |
99 | for (u32 i=0; i<currentTextures.size(); ++i) | 99 | for (u32 i=0; i<currentTextures.size(); ++i) |
100 | currentTextures[i]->drop(); | 100 | currentTextures[i]->drop(); |
101 | currentTextures.clear(); | 101 | currentTextures.clear(); |
102 | 102 | ||
103 | for (u32 i=0; i<currentImages.size(); ++i) | 103 | for (u32 i=0; i<currentImages.size(); ++i) |
104 | currentImages[i]->drop(); | 104 | currentImages[i]->drop(); |
105 | currentImages.clear(); | 105 | currentImages.clear(); |
106 | 106 | ||
107 | // clear current image mappings | 107 | // clear current image mappings |
108 | CharMap.clear(); | 108 | CharMap.clear(); |
109 | // clear array | 109 | // clear array |
110 | Areas.clear(); | 110 | Areas.clear(); |
111 | 111 | ||
112 | // get information about this font's unicode ranges. | 112 | // get information about this font's unicode ranges. |
113 | s32 size = GetFontUnicodeRanges( dc, 0); | 113 | s32 size = GetFontUnicodeRanges( dc, 0); |
114 | c8 *buf = new c8[size]; | 114 | c8 *buf = new c8[size]; |
115 | LPGLYPHSET glyphs = (LPGLYPHSET)buf; | 115 | LPGLYPHSET glyphs = (LPGLYPHSET)buf; |
116 | 116 | ||
117 | GetFontUnicodeRanges( dc, glyphs); | 117 | GetFontUnicodeRanges( dc, glyphs); |
118 | 118 | ||
119 | // s32 TotalCharCount = glyphs->cGlyphsSupported; | 119 | // s32 TotalCharCount = glyphs->cGlyphsSupported; |
120 | 120 | ||
121 | s32 currentx=0, currenty=0, maxy=0; | 121 | s32 currentx=0, currenty=0, maxy=0; |
122 | 122 | ||
123 | for (u32 range=0; range < glyphs->cRanges; range++) | 123 | for (u32 range=0; range < glyphs->cRanges; range++) |
124 | { | 124 | { |
125 | WCRANGE* current = &glyphs->ranges[range]; | 125 | WCRANGE* current = &glyphs->ranges[range]; |
126 | 126 | ||
127 | //maxy=0; | 127 | //maxy=0; |
128 | 128 | ||
129 | // loop through each glyph and write its size and position | 129 | // loop through each glyph and write its size and position |
130 | for (s32 ch=current->wcLow; ch< current->wcLow + current->cGlyphs; ch++) | 130 | for (s32 ch=current->wcLow; ch< current->wcLow + current->cGlyphs; ch++) |
131 | { | 131 | { |
132 | wchar_t currentchar = ch; | 132 | wchar_t currentchar = ch; |
133 | 133 | ||
134 | if ( IsDBCSLeadByte((BYTE) ch)) | 134 | if ( IsDBCSLeadByte((BYTE) ch)) |
135 | continue; // surragate pairs unsupported | 135 | continue; // surragate pairs unsupported |
136 | 136 | ||
137 | // get the dimensions | 137 | // get the dimensions |
138 | SIZE size; | 138 | SIZE size; |
139 | ABC abc; | 139 | ABC abc; |
140 | GetTextExtentPoint32W(dc, ¤tchar, 1, &size); | 140 | GetTextExtentPoint32W(dc, ¤tchar, 1, &size); |
141 | SFontArea fa; | 141 | SFontArea fa; |
142 | fa.underhang = 0; | 142 | fa.underhang = 0; |
143 | fa.overhang = 0; | 143 | fa.overhang = 0; |
144 | 144 | ||
145 | if (GetCharABCWidthsW(dc, currentchar, currentchar, &abc)) // for unicode fonts, get overhang, underhang, width | 145 | if (GetCharABCWidthsW(dc, currentchar, currentchar, &abc)) // for unicode fonts, get overhang, underhang, width |
146 | { | 146 | { |
147 | size.cx = abc.abcB; | 147 | size.cx = abc.abcB; |
148 | fa.underhang = abc.abcA; | 148 | fa.underhang = abc.abcA; |
149 | fa.overhang = abc.abcC; | 149 | fa.overhang = abc.abcC; |
150 | 150 | ||
151 | if (abc.abcB-abc.abcA+abc.abcC<1) | 151 | if (abc.abcB-abc.abcA+abc.abcC<1) |
152 | continue; // nothing of width 0 | 152 | continue; // nothing of width 0 |
153 | } | 153 | } |
154 | if (size.cy < 1) | 154 | if (size.cy < 1) |
155 | continue; | 155 | continue; |
156 | 156 | ||
157 | //GetGlyphOutline(dc, currentchar, GGO_METRICS, &gm, 0, 0, 0); | 157 | //GetGlyphOutline(dc, currentchar, GGO_METRICS, &gm, 0, 0, 0); |
158 | 158 | ||
159 | //size.cx++; size.cy++; | 159 | //size.cx++; size.cy++; |
160 | 160 | ||
161 | // wrap around? | 161 | // wrap around? |
162 | if (currentx + size.cx > (s32) textureWidth) | 162 | if (currentx + size.cx > (s32) textureWidth) |
163 | { | 163 | { |
164 | currenty += maxy; | 164 | currenty += maxy; |
165 | currentx = 0; | 165 | currentx = 0; |
166 | if ((u32)(currenty + maxy) > textureHeight) | 166 | if ((u32)(currenty + maxy) > textureHeight) |
167 | { | 167 | { |
168 | currentImage++; // increase Image count | 168 | currentImage++; // increase Image count |
169 | currenty=0; | 169 | currenty=0; |
170 | } | 170 | } |
171 | maxy = 0; | 171 | maxy = 0; |
172 | } | 172 | } |
173 | // add this char dimension to the current map | 173 | // add this char dimension to the current map |
174 | 174 | ||
175 | fa.rectangle = core::rect<s32>(currentx, currenty, currentx + size.cx, currenty + size.cy); | 175 | fa.rectangle = core::rect<s32>(currentx, currenty, currentx + size.cx, currenty + size.cy); |
176 | fa.sourceimage = currentImage; | 176 | fa.sourceimage = currentImage; |
177 | 177 | ||
178 | CharMap.insert(currentchar, Areas.size()); | 178 | CharMap.insert(currentchar, Areas.size()); |
179 | Areas.push_back( fa ); | 179 | Areas.push_back( fa ); |
180 | 180 | ||
181 | currentx += size.cx +1; | 181 | currentx += size.cx +1; |
182 | 182 | ||
183 | if (size.cy+1 > maxy) | 183 | if (size.cy+1 > maxy) |
184 | maxy = size.cy+1; | 184 | maxy = size.cy+1; |
185 | } | 185 | } |
186 | } | 186 | } |
187 | currenty += maxy; | 187 | currenty += maxy; |
188 | 188 | ||
189 | u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currenty); | 189 | u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currenty); |
190 | 190 | ||
191 | // delete the glyph set | 191 | // delete the glyph set |
192 | delete [] buf; | 192 | delete [] buf; |
193 | 193 | ||
194 | currentImages.set_used(currentImage+1); | 194 | currentImages.set_used(currentImage+1); |
195 | currentTextures.set_used(currentImage+1); | 195 | currentTextures.set_used(currentImage+1); |
196 | 196 | ||
197 | for (currentImage=0; currentImage < currentImages.size(); ++currentImage) | 197 | for (currentImage=0; currentImage < currentImages.size(); ++currentImage) |
198 | { | 198 | { |
199 | core::stringc logmsg = "Creating image "; | 199 | core::stringc logmsg = "Creating image "; |
200 | logmsg += (s32) (currentImage+1); | 200 | logmsg += (s32) (currentImage+1); |
201 | logmsg += " of "; | 201 | logmsg += " of "; |
202 | logmsg += (s32) currentImages.size(); | 202 | logmsg += (s32) currentImages.size(); |
203 | Device->getLogger()->log(logmsg.c_str()); | 203 | Device->getLogger()->log(logmsg.c_str()); |
204 | // no need for a huge final texture | 204 | // no need for a huge final texture |
205 | u32 texHeight = textureHeight; | 205 | u32 texHeight = textureHeight; |
206 | if (currentImage == currentImages.size()-1 ) | 206 | if (currentImage == currentImages.size()-1 ) |
207 | texHeight = lastTextureHeight; | 207 | texHeight = lastTextureHeight; |
208 | 208 | ||
209 | // make a new bitmap | 209 | // make a new bitmap |
210 | HBITMAP bmp = CreateCompatibleBitmap(dc, textureWidth, texHeight); | 210 | HBITMAP bmp = CreateCompatibleBitmap(dc, textureWidth, texHeight); |
211 | HDC bmpdc = CreateCompatibleDC(dc); | 211 | HDC bmpdc = CreateCompatibleDC(dc); |
212 | 212 | ||
213 | LOGBRUSH lbrush; | 213 | LOGBRUSH lbrush; |
214 | lbrush.lbColor = RGB(0,0,0); | 214 | lbrush.lbColor = RGB(0,0,0); |
215 | lbrush.lbHatch = 0; | 215 | lbrush.lbHatch = 0; |
216 | lbrush.lbStyle = BS_SOLID; | 216 | lbrush.lbStyle = BS_SOLID; |
217 | 217 | ||
218 | HBRUSH brush = CreateBrushIndirect(&lbrush); | 218 | HBRUSH brush = CreateBrushIndirect(&lbrush); |
219 | HPEN pen = CreatePen(PS_NULL, 0, 0); | 219 | HPEN pen = CreatePen(PS_NULL, 0, 0); |
220 | 220 | ||
221 | HGDIOBJ oldbmp = SelectObject(bmpdc, bmp); | 221 | HGDIOBJ oldbmp = SelectObject(bmpdc, bmp); |
222 | HGDIOBJ oldbmppen = SelectObject(bmpdc, pen); | 222 | HGDIOBJ oldbmppen = SelectObject(bmpdc, pen); |
223 | HGDIOBJ oldbmpbrush = SelectObject(bmpdc, brush); | 223 | HGDIOBJ oldbmpbrush = SelectObject(bmpdc, brush); |
224 | HGDIOBJ oldbmpfont = SelectObject(bmpdc, font); | 224 | HGDIOBJ oldbmpfont = SelectObject(bmpdc, font); |
225 | 225 | ||
226 | SetTextColor(bmpdc, RGB(255,255,255)); | 226 | SetTextColor(bmpdc, RGB(255,255,255)); |
227 | 227 | ||
228 | Rectangle(bmpdc, 0,0,textureWidth,texHeight); | 228 | Rectangle(bmpdc, 0,0,textureWidth,texHeight); |
229 | SetBkMode(bmpdc, TRANSPARENT); | 229 | SetBkMode(bmpdc, TRANSPARENT); |
230 | 230 | ||
231 | // draw the letters... | 231 | // draw the letters... |
232 | 232 | ||
233 | // iterate through the tree | 233 | // iterate through the tree |
234 | core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); | 234 | core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); |
235 | while (!it.atEnd()) | 235 | while (!it.atEnd()) |
236 | { | 236 | { |
237 | s32 currentArea = (*it).getValue(); | 237 | s32 currentArea = (*it).getValue(); |
238 | wchar_t wch = (*it).getKey(); | 238 | wchar_t wch = (*it).getKey(); |
239 | // sloppy but I couldnt be bothered rewriting it | 239 | // sloppy but I couldnt be bothered rewriting it |
240 | if (Areas[currentArea].sourceimage == currentImage) | 240 | if (Areas[currentArea].sourceimage == currentImage) |
241 | { | 241 | { |
242 | // draw letter | 242 | // draw letter |
243 | s32 sx = Areas[currentArea].rectangle.UpperLeftCorner.X - Areas[currentArea].underhang; | 243 | s32 sx = Areas[currentArea].rectangle.UpperLeftCorner.X - Areas[currentArea].underhang; |
244 | TextOutW(bmpdc, sx, Areas[currentArea].rectangle.UpperLeftCorner.Y, &wch, 1); | 244 | TextOutW(bmpdc, sx, Areas[currentArea].rectangle.UpperLeftCorner.Y, &wch, 1); |
245 | 245 | ||
246 | // if ascii font... | 246 | // if ascii font... |
247 | //SetPixel(bmpdc, Areas[currentArea].rectangle.UpperLeftCorner.X, Areas[currentArea].rectangle.UpperLeftCorner.Y, RGB(255,255,0));// left upper corner mark | 247 | //SetPixel(bmpdc, Areas[currentArea].rectangle.UpperLeftCorner.X, Areas[currentArea].rectangle.UpperLeftCorner.Y, RGB(255,255,0));// left upper corner mark |
248 | } | 248 | } |
249 | it++; | 249 | it++; |
250 | } | 250 | } |
251 | 251 | ||
252 | // copy the font bitmap into a new irrlicht image | 252 | // copy the font bitmap into a new irrlicht image |
253 | BITMAP b; | 253 | BITMAP b; |
254 | PBITMAPINFO pbmi; | 254 | PBITMAPINFO pbmi; |
255 | WORD cClrBits; | 255 | WORD cClrBits; |
256 | u32 cformat; | 256 | u32 cformat; |
257 | 257 | ||
258 | // Retrieve the bitmap color format, width, and height. | 258 | // Retrieve the bitmap color format, width, and height. |
259 | GetObject(bmp, sizeof(BITMAP), (LPSTR)&b); | 259 | GetObject(bmp, sizeof(BITMAP), (LPSTR)&b); |
260 | 260 | ||
261 | // Convert the color format to a count of bits. | 261 | // Convert the color format to a count of bits. |
262 | cClrBits = (WORD)(b.bmPlanes * b.bmBitsPixel); | 262 | cClrBits = (WORD)(b.bmPlanes * b.bmBitsPixel); |
263 | 263 | ||
264 | if (cClrBits <= 8) // we're not supporting these | 264 | if (cClrBits <= 8) // we're not supporting these |
265 | cformat = -1; | 265 | cformat = -1; |
266 | else if (cClrBits <= 16) | 266 | else if (cClrBits <= 16) |
267 | cformat = video::ECF_A1R5G5B5; | 267 | cformat = video::ECF_A1R5G5B5; |
268 | else if (cClrBits <= 24) | 268 | else if (cClrBits <= 24) |
269 | cformat = video::ECF_R8G8B8; | 269 | cformat = video::ECF_R8G8B8; |
270 | else | 270 | else |
271 | cformat = video::ECF_A8R8G8B8; | 271 | cformat = video::ECF_A8R8G8B8; |
272 | 272 | ||
273 | pbmi = (PBITMAPINFO) LocalAlloc(LPTR, | 273 | pbmi = (PBITMAPINFO) LocalAlloc(LPTR, |
274 | sizeof(BITMAPINFOHEADER)); | 274 | sizeof(BITMAPINFOHEADER)); |
275 | 275 | ||
276 | // Initialize the fields in the BITMAPINFO structure. | 276 | // Initialize the fields in the BITMAPINFO structure. |
277 | 277 | ||
278 | pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | 278 | pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); |
279 | pbmi->bmiHeader.biWidth = b.bmWidth; | 279 | pbmi->bmiHeader.biWidth = b.bmWidth; |
280 | pbmi->bmiHeader.biHeight = b.bmHeight; | 280 | pbmi->bmiHeader.biHeight = b.bmHeight; |
281 | pbmi->bmiHeader.biPlanes = b.bmPlanes; | 281 | pbmi->bmiHeader.biPlanes = b.bmPlanes; |
282 | pbmi->bmiHeader.biBitCount = b.bmBitsPixel; | 282 | pbmi->bmiHeader.biBitCount = b.bmBitsPixel; |
283 | 283 | ||
284 | // If the bitmap is not compressed, set the BI_RGB flag. | 284 | // If the bitmap is not compressed, set the BI_RGB flag. |
285 | pbmi->bmiHeader.biCompression = BI_RGB; | 285 | pbmi->bmiHeader.biCompression = BI_RGB; |
286 | 286 | ||
287 | // Compute the number of bytes in the array of color | 287 | // Compute the number of bytes in the array of color |
288 | // indices and store the result in biSizeImage. | 288 | // indices and store the result in biSizeImage. |
289 | // For Windows NT, the width must be DWORD aligned unless | 289 | // For Windows NT, the width must be DWORD aligned unless |
290 | // the bitmap is RLE compressed. This example shows this. | 290 | // the bitmap is RLE compressed. This example shows this. |
291 | // For Windows 95/98/Me, the width must be WORD aligned unless the | 291 | // For Windows 95/98/Me, the width must be WORD aligned unless the |
292 | // bitmap is RLE compressed. | 292 | // bitmap is RLE compressed. |
293 | pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8 | 293 | pbmi->bmiHeader.biSizeImage = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8 |
294 | * pbmi->bmiHeader.biHeight; | 294 | * pbmi->bmiHeader.biHeight; |
295 | // Set biClrImportant to 0, indicating that all of the | 295 | // Set biClrImportant to 0, indicating that all of the |
296 | // device colors are important. | 296 | // device colors are important. |
297 | pbmi->bmiHeader.biClrImportant = 0; | 297 | pbmi->bmiHeader.biClrImportant = 0; |
298 | 298 | ||
299 | LPBYTE lpBits; // memory pointer | 299 | LPBYTE lpBits; // memory pointer |
300 | 300 | ||
301 | PBITMAPINFOHEADER pbih = (PBITMAPINFOHEADER) pbmi; | 301 | PBITMAPINFOHEADER pbih = (PBITMAPINFOHEADER) pbmi; |
302 | lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage); | 302 | lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, pbih->biSizeImage); |
303 | 303 | ||
304 | GetDIBits(dc, bmp, 0, (WORD) pbih->biHeight, lpBits, pbmi, DIB_RGB_COLORS); | 304 | GetDIBits(dc, bmp, 0, (WORD) pbih->biHeight, lpBits, pbmi, DIB_RGB_COLORS); |
305 | 305 | ||
306 | // DEBUG- copy to clipboard | 306 | // DEBUG- copy to clipboard |
307 | //OpenClipboard(hWnd); | 307 | //OpenClipboard(hWnd); |
308 | //EmptyClipboard(); | 308 | //EmptyClipboard(); |
309 | //SetClipboardData(CF_BITMAP, bmp); | 309 | //SetClipboardData(CF_BITMAP, bmp); |
310 | //CloseClipboard(); | 310 | //CloseClipboard(); |
311 | 311 | ||
312 | // flip bitmap | 312 | // flip bitmap |
313 | s32 rowsize = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8; | 313 | s32 rowsize = ((pbmi->bmiHeader.biWidth * cClrBits +31) & ~31) /8; |
314 | c8 *row = new c8[rowsize]; | 314 | c8 *row = new c8[rowsize]; |
315 | for (s32 i=0; i < (pbih->biHeight/2); ++i) | 315 | for (s32 i=0; i < (pbih->biHeight/2); ++i) |
316 | { | 316 | { |
317 | // grab a row | 317 | // grab a row |
318 | memcpy(row, lpBits + (rowsize * i), rowsize); | 318 | memcpy(row, lpBits + (rowsize * i), rowsize); |
319 | // swap row | 319 | // swap row |
320 | memcpy(lpBits + (rowsize * i), lpBits + ((pbih->biHeight-1 -i) * rowsize ) , rowsize); | 320 | memcpy(lpBits + (rowsize * i), lpBits + ((pbih->biHeight-1 -i) * rowsize ) , rowsize); |
321 | memcpy(lpBits + ((pbih->biHeight-1 -i) * rowsize ), row , rowsize); | 321 | memcpy(lpBits + ((pbih->biHeight-1 -i) * rowsize ), row , rowsize); |
322 | } | 322 | } |
323 | 323 | ||
324 | bool ret = false; | 324 | bool ret = false; |
325 | 325 | ||
326 | if (cformat == video::ECF_A8R8G8B8) | 326 | if (cformat == video::ECF_A8R8G8B8) |
327 | { | 327 | { |
328 | // in this case the font should have an alpha channel, but since windows doesn't draw one | 328 | // in this case the font should have an alpha channel, but since windows doesn't draw one |
329 | // we have to set one manually by going through all the pixels.. *sigh* | 329 | // we have to set one manually by going through all the pixels.. *sigh* |
330 | 330 | ||
331 | u8* m; | 331 | u8* m; |
332 | for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=4) | 332 | for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=4) |
333 | { | 333 | { |
334 | if (UseAlphaChannel) | 334 | if (UseAlphaChannel) |
335 | { | 335 | { |
336 | if (m[0] > 0) // pixel has colour | 336 | if (m[0] > 0) // pixel has colour |
337 | { | 337 | { |
338 | m[3]=m[0]; // set alpha | 338 | m[3]=m[0]; // set alpha |
339 | m[0]=m[1]=m[2] = 255; // everything else is full | 339 | m[0]=m[1]=m[2] = 255; // everything else is full |
340 | } | 340 | } |
341 | } | 341 | } |
342 | else | 342 | else |
343 | m[3]=255; // all pixels are full alpha | 343 | m[3]=255; // all pixels are full alpha |
344 | } | 344 | } |
345 | 345 | ||
346 | } | 346 | } |
347 | else if (cformat == video::ECF_A1R5G5B5) | 347 | else if (cformat == video::ECF_A1R5G5B5) |
348 | { | 348 | { |
349 | u8* m; | 349 | u8* m; |
350 | for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=2) | 350 | for (m = lpBits; m < lpBits + pbih->biSizeImage; m+=2) |
351 | { | 351 | { |
352 | WORD *p = (WORD*)m; | 352 | WORD *p = (WORD*)m; |
353 | if (m[0] > 0 || !UseAlphaChannel) // alpha should be set | 353 | if (m[0] > 0 || !UseAlphaChannel) // alpha should be set |
354 | *p |= 0x8000; // set alpha bit | 354 | *p |= 0x8000; // set alpha bit |
355 | } | 355 | } |
356 | } | 356 | } |
357 | else | 357 | else |
358 | { | 358 | { |
359 | cformat = -1; | 359 | cformat = -1; |
360 | } | 360 | } |
361 | 361 | ||
362 | // make a texture from the image | 362 | // make a texture from the image |
363 | if (cformat != -1) | 363 | if (cformat != -1) |
364 | { | 364 | { |
365 | // turn mip-mapping off | 365 | // turn mip-mapping off |
366 | bool b = Device->getVideoDriver()->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS); | 366 | bool b = Device->getVideoDriver()->getTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS); |
367 | currentImages[currentImage] = Device->getVideoDriver()->createImageFromData((video::ECOLOR_FORMAT)cformat, core::dimension2d<u32>(textureWidth,texHeight), (void*)lpBits); | 367 | currentImages[currentImage] = Device->getVideoDriver()->createImageFromData((video::ECOLOR_FORMAT)cformat, core::dimension2d<u32>(textureWidth,texHeight), (void*)lpBits); |
368 | Device->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS,b); | 368 | Device->getVideoDriver()->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS,b); |
369 | } | 369 | } |
370 | else | 370 | else |
371 | { | 371 | { |
372 | Device->getLogger()->log("Couldn't create font, your pixel format is unsupported."); | 372 | Device->getLogger()->log("Couldn't create font, your pixel format is unsupported."); |
373 | } | 373 | } |
374 | 374 | ||
375 | // free memory and windows resources | 375 | // free memory and windows resources |
376 | // sloppy I know, but I only intended to create one image at first. | 376 | // sloppy I know, but I only intended to create one image at first. |
377 | delete [] row; | 377 | delete [] row; |
378 | LocalFree(pbmi); | 378 | LocalFree(pbmi); |
379 | GlobalFree(lpBits); | 379 | GlobalFree(lpBits); |
380 | DeleteDC(bmpdc); | 380 | DeleteDC(bmpdc); |
381 | DeleteObject(brush); | 381 | DeleteObject(brush); |
382 | DeleteObject(pen); | 382 | DeleteObject(pen); |
383 | DeleteObject(bmp); | 383 | DeleteObject(bmp); |
384 | 384 | ||
385 | if (currentImages[currentImage]) | 385 | if (currentImages[currentImage]) |
386 | { | 386 | { |
387 | // add texture | 387 | // add texture |
388 | currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]); | 388 | currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]); |
389 | currentTextures[currentImage]->grab(); | 389 | currentTextures[currentImage]->grab(); |
390 | } | 390 | } |
391 | else | 391 | else |
392 | { | 392 | { |
393 | Device->getLogger()->log("Something went wrong, aborting."); | 393 | Device->getLogger()->log("Something went wrong, aborting."); |
394 | // drop all images | 394 | // drop all images |
395 | DeleteObject(font); | 395 | DeleteObject(font); |
396 | return false; | 396 | return false; |
397 | } | 397 | } |
398 | } // looping through each texture | 398 | } // looping through each texture |
399 | DeleteObject(font); | 399 | DeleteObject(font); |
400 | return true; | 400 | return true; |
401 | } | 401 | } |
402 | 402 | ||
403 | #else | 403 | #else |
404 | 404 | ||
405 | CFontTool::CFontTool(IrrlichtDevice *device) : FontSizes(fontsizes), Device(device), UseAlphaChannel(false) | 405 | CFontTool::CFontTool(IrrlichtDevice *device) : FontSizes(fontsizes), Device(device), UseAlphaChannel(false) |
406 | { | 406 | { |
407 | if (!XftInitFtLibrary()) | 407 | if (!XftInitFtLibrary()) |
408 | { | 408 | { |
409 | core::stringc logmsg = "XFT not found\n"; | 409 | core::stringc logmsg = "XFT not found\n"; |
410 | Device->getLogger()->log(logmsg.c_str()); | 410 | Device->getLogger()->log(logmsg.c_str()); |
411 | exit(EXIT_FAILURE); | 411 | exit(EXIT_FAILURE); |
412 | } | 412 | } |
413 | 413 | ||
414 | /* Get a list of the font foundries, storing them in a set to sort */ | 414 | /* Get a list of the font foundries, storing them in a set to sort */ |
415 | std::set<core::stringw> foundries; | 415 | std::set<core::stringw> foundries; |
416 | Display* display = (Display*)Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display; | 416 | Display* display = (Display*)Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display; |
417 | XftFontSet* fonts = XftListFonts(display, DefaultScreen(display), 0, XFT_FOUNDRY, 0); | 417 | XftFontSet* fonts = XftListFonts(display, DefaultScreen(display), 0, XFT_FOUNDRY, 0); |
418 | for (int i = 0; i < fonts->nfont; i++) | 418 | for (int i = 0; i < fonts->nfont; i++) |
419 | { | 419 | { |
420 | char *foundry; | 420 | char *foundry; |
421 | XftPatternGetString(fonts->fonts[i], XFT_FOUNDRY, 0, &foundry); | 421 | XftPatternGetString(fonts->fonts[i], XFT_FOUNDRY, 0, &foundry); |
422 | core::stringw tmp(foundry); | 422 | core::stringw tmp(foundry); |
423 | foundries.insert(tmp); | 423 | foundries.insert(tmp); |
424 | } | 424 | } |
425 | XftFontSetDestroy(fonts); | 425 | XftFontSetDestroy(fonts); |
426 | 426 | ||
427 | /* Copy the sorted list into the array */ | 427 | /* Copy the sorted list into the array */ |
428 | CharSets.clear(); | 428 | CharSets.clear(); |
429 | for (std::set<core::stringw>::iterator i = foundries.begin(); i != foundries.end(); i++) | 429 | for (std::set<core::stringw>::iterator i = foundries.begin(); i != foundries.end(); i++) |
430 | CharSets.push_back((*i).c_str()); | 430 | CharSets.push_back((*i).c_str()); |
431 | selectCharSet(0); | 431 | selectCharSet(0); |
432 | } | 432 | } |
433 | 433 | ||
434 | /* Note: There must be some trick for using strings as pattern parameters to XftListFonts because | 434 | /* Note: There must be some trick for using strings as pattern parameters to XftListFonts because |
435 | no matter how I specify a string, I end up with an intermittent segfault. Since XftFontList is | 435 | no matter how I specify a string, I end up with an intermittent segfault. Since XftFontList is |
436 | just calling FcFontList, that's what I'll do too since that works OK */ | 436 | just calling FcFontList, that's what I'll do too since that works OK */ |
437 | void CFontTool::selectCharSet(u32 currentCharSet) | 437 | void CFontTool::selectCharSet(u32 currentCharSet) |
438 | { | 438 | { |
439 | /* Get a list of the font families, storing them in a set to sort */ | 439 | /* Get a list of the font families, storing them in a set to sort */ |
440 | char foundry[256]; | 440 | char foundry[256]; |
441 | sprintf(&foundry[0],"%ls",CharSets[currentCharSet].c_str()); | 441 | sprintf(&foundry[0],"%ls",CharSets[currentCharSet].c_str()); |
442 | std::set<core::stringw> families; | 442 | std::set<core::stringw> families; |
443 | XftPattern *pattern = FcPatternCreate(); | 443 | XftPattern *pattern = FcPatternCreate(); |
444 | XftPatternAddString(pattern, FC_FOUNDRY, &foundry[0]); | 444 | XftPatternAddString(pattern, FC_FOUNDRY, &foundry[0]); |
445 | XftObjectSet *objectset = FcObjectSetCreate(); | 445 | XftObjectSet *objectset = FcObjectSetCreate(); |
446 | XftObjectSetAdd(objectset, XFT_FOUNDRY); | 446 | XftObjectSetAdd(objectset, XFT_FOUNDRY); |
447 | XftObjectSetAdd(objectset, XFT_FAMILY); | 447 | XftObjectSetAdd(objectset, XFT_FAMILY); |
448 | FcFontSet *fonts = FcFontList(NULL, pattern, objectset); | 448 | FcFontSet *fonts = FcFontList(NULL, pattern, objectset); |
449 | 449 | ||
450 | for (int i = 0; i < fonts->nfont; i++) | 450 | for (int i = 0; i < fonts->nfont; i++) |
451 | { | 451 | { |
452 | char* ptr; | 452 | char* ptr; |
453 | XftPatternGetString(fonts->fonts[i], XFT_FAMILY, 0, &ptr); | 453 | XftPatternGetString(fonts->fonts[i], XFT_FAMILY, 0, &ptr); |
454 | core::stringw family(ptr); | 454 | core::stringw family(ptr); |
455 | families.insert(family); | 455 | families.insert(family); |
456 | } | 456 | } |
457 | XftPatternDestroy(pattern); | 457 | XftPatternDestroy(pattern); |
458 | FcObjectSetDestroy(objectset); | 458 | FcObjectSetDestroy(objectset); |
459 | 459 | ||
460 | /* Copy the sorted list into the array */ | 460 | /* Copy the sorted list into the array */ |
461 | FontNames.clear(); | 461 | FontNames.clear(); |
462 | for (std::set<core::stringw>::iterator i = families.begin(); i != families.end(); i++) | 462 | for (std::set<core::stringw>::iterator i = families.begin(); i != families.end(); i++) |
463 | FontNames.push_back((*i).c_str()); | 463 | FontNames.push_back((*i).c_str()); |
464 | } | 464 | } |
465 | 465 | ||
466 | bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha) | 466 | bool CFontTool::makeBitmapFont(u32 fontIndex, u32 charsetIndex, s32 fontSize, u32 textureWidth, u32 textureHeight, bool bold, bool italic, bool aa, bool alpha) |
467 | { | 467 | { |
468 | if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() ) | 468 | if (fontIndex >= FontNames.size() || charsetIndex >= CharSets.size() ) |
469 | return false; | 469 | return false; |
470 | 470 | ||
471 | Display *display = (Display*) Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display; | 471 | Display *display = (Display*) Device->getVideoDriver()->getExposedVideoData().OpenGLLinux.X11Display; |
472 | u32 screen = DefaultScreen(display); | 472 | u32 screen = DefaultScreen(display); |
473 | Window win = RootWindow(display, screen); | 473 | Window win = RootWindow(display, screen); |
474 | Visual *visual = DefaultVisual(display, screen); | 474 | Visual *visual = DefaultVisual(display, screen); |
475 | UseAlphaChannel = alpha; | 475 | UseAlphaChannel = alpha; |
476 | u32 currentImage = 0; | 476 | u32 currentImage = 0; |
477 | 477 | ||
478 | XftResult result; | 478 | XftResult result; |
479 | XftPattern *request = XftPatternCreate(); | 479 | XftPattern *request = XftPatternCreate(); |
480 | char foundry[256], family[256]; | 480 | char foundry[256], family[256]; |
481 | sprintf(&foundry[0],"%ls",CharSets[charsetIndex].c_str()); | 481 | sprintf(&foundry[0],"%ls",CharSets[charsetIndex].c_str()); |
482 | sprintf(&family[0],"%ls",FontNames[fontIndex].c_str()); | 482 | sprintf(&family[0],"%ls",FontNames[fontIndex].c_str()); |
483 | XftPatternAddString(request, XFT_FOUNDRY, &foundry[0]); | 483 | XftPatternAddString(request, XFT_FOUNDRY, &foundry[0]); |
484 | XftPatternAddString(request, XFT_FAMILY, &family[0]); | 484 | XftPatternAddString(request, XFT_FAMILY, &family[0]); |
485 | XftPatternAddInteger(request, XFT_PIXEL_SIZE, fontSize); | 485 | XftPatternAddInteger(request, XFT_PIXEL_SIZE, fontSize); |
486 | XftPatternAddInteger(request, XFT_WEIGHT, bold ? XFT_WEIGHT_BLACK : XFT_WEIGHT_LIGHT); | 486 | XftPatternAddInteger(request, XFT_WEIGHT, bold ? XFT_WEIGHT_BLACK : XFT_WEIGHT_LIGHT); |
487 | XftPatternAddInteger(request, XFT_SLANT, italic ? XFT_SLANT_ITALIC : XFT_SLANT_ROMAN); | 487 | XftPatternAddInteger(request, XFT_SLANT, italic ? XFT_SLANT_ITALIC : XFT_SLANT_ROMAN); |
488 | XftPatternAddBool(request, XFT_ANTIALIAS, aa); | 488 | XftPatternAddBool(request, XFT_ANTIALIAS, aa); |
489 | 489 | ||
490 | /* Find the closest font that matches the user choices and open it and check if the returned | 490 | /* Find the closest font that matches the user choices and open it and check if the returned |
491 | font has anti aliasing enabled by default, even if it wasn't requested */ | 491 | font has anti aliasing enabled by default, even if it wasn't requested */ |
492 | FcBool aaEnabled; | 492 | FcBool aaEnabled; |
493 | XftPattern *found = XftFontMatch(display, DefaultScreen(display), request, &result); | 493 | XftPattern *found = XftFontMatch(display, DefaultScreen(display), request, &result); |
494 | XftPatternGetBool(found, XFT_ANTIALIAS, 0, &aaEnabled); | 494 | XftPatternGetBool(found, XFT_ANTIALIAS, 0, &aaEnabled); |
495 | aa = aaEnabled; | 495 | aa = aaEnabled; |
496 | XftFont *font = XftFontOpenPattern(display, found); | 496 | XftFont *font = XftFontOpenPattern(display, found); |
497 | 497 | ||
498 | // get rid of the current textures/images | 498 | // get rid of the current textures/images |
499 | for (u32 i=0; i<currentTextures.size(); ++i) | 499 | for (u32 i=0; i<currentTextures.size(); ++i) |
500 | currentTextures[i]->drop(); | 500 | currentTextures[i]->drop(); |
501 | currentTextures.clear(); | 501 | currentTextures.clear(); |
502 | for (u32 i=0; i<currentImages.size(); ++i) | 502 | for (u32 i=0; i<currentImages.size(); ++i) |
503 | currentImages[i]->drop(); | 503 | currentImages[i]->drop(); |
504 | currentImages.clear(); | 504 | currentImages.clear(); |
505 | CharMap.clear(); | 505 | CharMap.clear(); |
506 | Areas.clear(); | 506 | Areas.clear(); |
507 | 507 | ||
508 | /* Calculate the max height of the font. Annoyingly, it seems that the height property of the font | 508 | /* Calculate the max height of the font. Annoyingly, it seems that the height property of the font |
509 | is the maximum height of any single character, but a string of characters, aligned along their | 509 | is the maximum height of any single character, but a string of characters, aligned along their |
510 | baselines, can exceed this figure. Because I don't know any better way of doing it, I'm going to | 510 | baselines, can exceed this figure. Because I don't know any better way of doing it, I'm going to |
511 | have to use the brute force method. | 511 | have to use the brute force method. |
512 | 512 | ||
513 | Note: There will be a certain number of charters in a font, however they may not be grouped | 513 | Note: There will be a certain number of charters in a font, however they may not be grouped |
514 | consecutively, and could in fact be spread out with many gaps */ | 514 | consecutively, and could in fact be spread out with many gaps */ |
515 | u32 maxY = 0; | 515 | u32 maxY = 0; |
516 | u32 charsFound = 0; | 516 | u32 charsFound = 0; |
517 | for (FT_UInt charCode = 0; charsFound < FcCharSetCount(font->charset); charCode++) | 517 | for (FT_UInt charCode = 0; charsFound < FcCharSetCount(font->charset); charCode++) |
518 | { | 518 | { |
519 | if (!XftCharExists(display, font, charCode)) | 519 | if (!XftCharExists(display, font, charCode)) |
520 | continue; | 520 | continue; |
521 | 521 | ||
522 | charsFound++; | 522 | charsFound++; |
523 | 523 | ||
524 | XGlyphInfo extents; | 524 | XGlyphInfo extents; |
525 | XftTextExtents32(display, font, &charCode, 1, &extents); | 525 | XftTextExtents32(display, font, &charCode, 1, &extents); |
526 | if ((extents.xOff <= 0) && (extents.height <= 0)) | 526 | if ((extents.xOff <= 0) && (extents.height <= 0)) |
527 | continue; | 527 | continue; |
528 | 528 | ||
529 | /* Calculate the width and height, adding 1 extra pixel if anti aliasing is enabled */ | 529 | /* Calculate the width and height, adding 1 extra pixel if anti aliasing is enabled */ |
530 | u32 chWidth = extents.xOff + (aa ? 1 : 0); | 530 | u32 chWidth = extents.xOff + (aa ? 1 : 0); |
531 | u32 chHeight = (font->ascent - extents.y + extents.height) + (aa ? 1 : 0); | 531 | u32 chHeight = (font->ascent - extents.y + extents.height) + (aa ? 1 : 0); |
532 | if (chHeight > maxY) | 532 | if (chHeight > maxY) |
533 | maxY = chHeight; | 533 | maxY = chHeight; |
534 | 534 | ||
535 | /* Store the character details here */ | 535 | /* Store the character details here */ |
536 | SFontArea fontArea; | 536 | SFontArea fontArea; |
537 | fontArea.rectangle = core::rect<s32>(0, 0, chWidth, chHeight); | 537 | fontArea.rectangle = core::rect<s32>(0, 0, chWidth, chHeight); |
538 | CharMap.insert(charCode, Areas.size()); | 538 | CharMap.insert(charCode, Areas.size()); |
539 | Areas.push_back(fontArea); | 539 | Areas.push_back(fontArea); |
540 | } | 540 | } |
541 | core::stringc logmsg = "Found "; | 541 | core::stringc logmsg = "Found "; |
542 | logmsg += (s32) (CharMap.size() + 1); | 542 | logmsg += (s32) (CharMap.size() + 1); |
543 | logmsg += " characters"; | 543 | logmsg += " characters"; |
544 | Device->getLogger()->log(logmsg.c_str()); | 544 | Device->getLogger()->log(logmsg.c_str()); |
545 | 545 | ||
546 | /* Get the size of the chars and allocate them a position on a texture. If the next character that | 546 | /* Get the size of the chars and allocate them a position on a texture. If the next character that |
547 | is added would be outside the width or height of the texture, then a new texture is added */ | 547 | is added would be outside the width or height of the texture, then a new texture is added */ |
548 | u32 currentX = 0, currentY = 0, rowY = 0; | 548 | u32 currentX = 0, currentY = 0, rowY = 0; |
549 | for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++) | 549 | for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++) |
550 | { | 550 | { |
551 | s32 currentArea = (*it).getValue(); | 551 | s32 currentArea = (*it).getValue(); |
552 | SFontArea *fontArea = &Areas[currentArea]; | 552 | SFontArea *fontArea = &Areas[currentArea]; |
553 | u32 chWidth = fontArea->rectangle.LowerRightCorner.X; | 553 | u32 chWidth = fontArea->rectangle.LowerRightCorner.X; |
554 | u32 chHeight = fontArea->rectangle.LowerRightCorner.Y; | 554 | u32 chHeight = fontArea->rectangle.LowerRightCorner.Y; |
555 | 555 | ||
556 | /* If the width of this char will exceed the textureWidth then start a new row */ | 556 | /* If the width of this char will exceed the textureWidth then start a new row */ |
557 | if ((currentX + chWidth) > textureWidth) | 557 | if ((currentX + chWidth) > textureWidth) |
558 | { | 558 | { |
559 | currentY += rowY; | 559 | currentY += rowY; |
560 | currentX = 0; | 560 | currentX = 0; |
561 | 561 | ||
562 | /* If the new row added to the texture exceeds the textureHeight then start a new texture */ | 562 | /* If the new row added to the texture exceeds the textureHeight then start a new texture */ |
563 | if ((currentY + rowY) > textureHeight) | 563 | if ((currentY + rowY) > textureHeight) |
564 | { | 564 | { |
565 | currentImage++; | 565 | currentImage++; |
566 | currentY = 0; | 566 | currentY = 0; |
567 | } | 567 | } |
568 | rowY = 0; | 568 | rowY = 0; |
569 | } | 569 | } |
570 | 570 | ||
571 | /* Update the area with the current x and y and texture */ | 571 | /* Update the area with the current x and y and texture */ |
572 | fontArea->rectangle = core::rect<s32>(currentX, currentY, currentX + chWidth, currentY + chHeight); | 572 | fontArea->rectangle = core::rect<s32>(currentX, currentY, currentX + chWidth, currentY + chHeight); |
573 | fontArea->sourceimage = currentImage; | 573 | fontArea->sourceimage = currentImage; |
574 | currentX += chWidth + 1; | 574 | currentX += chWidth + 1; |
575 | if (chHeight + 1 > rowY) | 575 | if (chHeight + 1 > rowY) |
576 | rowY = chHeight + 1; | 576 | rowY = chHeight + 1; |
577 | } | 577 | } |
578 | 578 | ||
579 | /* The last row of chars and the last texture weren't accounted for in the loop, so add them here */ | 579 | /* The last row of chars and the last texture weren't accounted for in the loop, so add them here */ |
580 | currentY += rowY; | 580 | currentY += rowY; |
581 | u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currentY); | 581 | u32 lastTextureHeight = getTextureSizeFromSurfaceSize(currentY); |
582 | currentImages.set_used(currentImage + 1); | 582 | currentImages.set_used(currentImage + 1); |
583 | currentTextures.set_used(currentImage + 1); | 583 | currentTextures.set_used(currentImage + 1); |
584 | 584 | ||
585 | /* Initialise colours */ | 585 | /* Initialise colours */ |
586 | XftColor colFore, colBack; | 586 | XftColor colFore, colBack; |
587 | XRenderColor xFore = {0xffff, 0xffff, 0xffff, 0xffff}; | 587 | XRenderColor xFore = {0xffff, 0xffff, 0xffff, 0xffff}; |
588 | XRenderColor xBack = {0x0000, 0x0000, 0x0000, 0xffff}; | 588 | XRenderColor xBack = {0x0000, 0x0000, 0x0000, 0xffff}; |
589 | XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xFore, &colFore); | 589 | XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xFore, &colFore); |
590 | XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xBack, &colBack); | 590 | XftColorAllocValue(display, DefaultVisual(display, screen), DefaultColormap(display, screen), &xBack, &colBack); |
591 | 591 | ||
592 | /* Create a pixmap that is large enough to hold any character in the font */ | 592 | /* Create a pixmap that is large enough to hold any character in the font */ |
593 | Pixmap pixmap = XCreatePixmap(display, win, textureWidth, maxY, DefaultDepth(display, screen)); | 593 | Pixmap pixmap = XCreatePixmap(display, win, textureWidth, maxY, DefaultDepth(display, screen)); |
594 | XftDraw *draw = XftDrawCreate(display, pixmap, visual, DefaultColormap(display, screen)); | 594 | XftDraw *draw = XftDrawCreate(display, pixmap, visual, DefaultColormap(display, screen)); |
595 | 595 | ||
596 | /* Render the chars */ | 596 | /* Render the chars */ |
597 | for (currentImage = 0; currentImage < currentImages.size(); ++currentImage) | 597 | for (currentImage = 0; currentImage < currentImages.size(); ++currentImage) |
598 | { | 598 | { |
599 | core::stringc logmsg = "Creating image "; | 599 | core::stringc logmsg = "Creating image "; |
600 | logmsg += (s32) (currentImage+1); | 600 | logmsg += (s32) (currentImage+1); |
601 | logmsg += " of "; | 601 | logmsg += " of "; |
602 | logmsg += (s32) currentImages.size(); | 602 | logmsg += (s32) currentImages.size(); |
603 | Device->getLogger()->log(logmsg.c_str()); | 603 | Device->getLogger()->log(logmsg.c_str()); |
604 | 604 | ||
605 | /* The last texture that is saved is vertically shrunk to fit the characters drawn on it */ | 605 | /* The last texture that is saved is vertically shrunk to fit the characters drawn on it */ |
606 | u32 texHeight = textureHeight; | 606 | u32 texHeight = textureHeight; |
607 | if (currentImage == currentImages.size() - 1) | 607 | if (currentImage == currentImages.size() - 1) |
608 | texHeight = lastTextureHeight; | 608 | texHeight = lastTextureHeight; |
609 | 609 | ||
610 | /* The texture that holds this "page" of characters */ | 610 | /* The texture that holds this "page" of characters */ |
611 | currentImages[currentImage] = Device->getVideoDriver()->createImage(video::ECF_A8R8G8B8, core::dimension2du(textureWidth, texHeight)); | 611 | currentImages[currentImage] = Device->getVideoDriver()->createImage(video::ECF_A8R8G8B8, core::dimension2du(textureWidth, texHeight)); |
612 | currentImages[currentImage]->fill(video::SColor(alpha ? 0 : 255,0,0,0)); | 612 | currentImages[currentImage]->fill(video::SColor(alpha ? 0 : 255,0,0,0)); |
613 | 613 | ||
614 | for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++) | 614 | for (core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); !it.atEnd(); it++) |
615 | { | 615 | { |
616 | FcChar32 wch = (*it).getKey(); | 616 | FcChar32 wch = (*it).getKey(); |
617 | s32 currentArea = (*it).getValue(); | 617 | s32 currentArea = (*it).getValue(); |
618 | if (Areas[currentArea].sourceimage == currentImage) | 618 | if (Areas[currentArea].sourceimage == currentImage) |
619 | { | 619 | { |
620 | SFontArea *fontArea = &Areas[currentArea]; | 620 | SFontArea *fontArea = &Areas[currentArea]; |
621 | u32 chWidth = fontArea->rectangle.LowerRightCorner.X - fontArea->rectangle.UpperLeftCorner.X; | 621 | u32 chWidth = fontArea->rectangle.LowerRightCorner.X - fontArea->rectangle.UpperLeftCorner.X; |
622 | u32 chHeight = fontArea->rectangle.LowerRightCorner.Y - fontArea->rectangle.UpperLeftCorner.Y; | 622 | u32 chHeight = fontArea->rectangle.LowerRightCorner.Y - fontArea->rectangle.UpperLeftCorner.Y; |
623 | 623 | ||
624 | /* Draw the glyph onto the pixmap */ | 624 | /* Draw the glyph onto the pixmap */ |
625 | XGlyphInfo extents; | 625 | XGlyphInfo extents; |
626 | XftDrawRect(draw, &colBack, 0, 0, chWidth, chHeight); | 626 | XftDrawRect(draw, &colBack, 0, 0, chWidth, chHeight); |
627 | XftTextExtents32(display, font, &wch, 1, &extents); | 627 | XftTextExtents32(display, font, &wch, 1, &extents); |
628 | XftDrawString32(draw, &colFore, font, extents.x, extents.y, &wch, 1); | 628 | XftDrawString32(draw, &colFore, font, extents.x, extents.y, &wch, 1); |
629 | 629 | ||
630 | /* Convert the pixmap into an image, then copy it onto the Irrlicht texture, pixel by pixel. | 630 | /* Convert the pixmap into an image, then copy it onto the Irrlicht texture, pixel by pixel. |
631 | There's bound to be a faster way, but this is adequate */ | 631 | There's bound to be a faster way, but this is adequate */ |
632 | u32 xDest = fontArea->rectangle.UpperLeftCorner.X; | 632 | u32 xDest = fontArea->rectangle.UpperLeftCorner.X; |
633 | u32 yDest = fontArea->rectangle.UpperLeftCorner.Y + font->ascent - extents.y; | 633 | u32 yDest = fontArea->rectangle.UpperLeftCorner.Y + font->ascent - extents.y; |
634 | XImage *image = XGetImage(display, pixmap, 0, 0, chWidth, chHeight, 0xffffff, XYPixmap); | 634 | XImage *image = XGetImage(display, pixmap, 0, 0, chWidth, chHeight, 0xffffff, XYPixmap); |
635 | if (image) | 635 | if (image) |
636 | { | 636 | { |
637 | for (u32 ySrc = 0; ySrc < chHeight; ySrc++) | 637 | for (u32 ySrc = 0; ySrc < chHeight; ySrc++) |
638 | for (u32 xSrc = 0; xSrc < chWidth; xSrc++) | 638 | for (u32 xSrc = 0; xSrc < chWidth; xSrc++) |
639 | { | 639 | { |
640 | /* Get the pixel colour and break it down into rgb components */ | 640 | /* Get the pixel colour and break it down into rgb components */ |
641 | u32 col = XGetPixel(image, xSrc, ySrc); | 641 | u32 col = XGetPixel(image, xSrc, ySrc); |
642 | u32 a = 255; | 642 | u32 a = 255; |
643 | u32 r = col & visual->red_mask; | 643 | u32 r = col & visual->red_mask; |
644 | u32 g = col & visual->green_mask; | 644 | u32 g = col & visual->green_mask; |
645 | u32 b = col & visual->blue_mask; | 645 | u32 b = col & visual->blue_mask; |
646 | while (r > 0xff) r >>= 8; | 646 | while (r > 0xff) r >>= 8; |
647 | while (g > 0xff) g >>= 8; | 647 | while (g > 0xff) g >>= 8; |
648 | while (b > 0xff) b >>= 8; | 648 | while (b > 0xff) b >>= 8; |
649 | 649 | ||
650 | /* To make the background transparent, set the colour to 100% white and the alpha to | 650 | /* To make the background transparent, set the colour to 100% white and the alpha to |
651 | the average of the three rgb colour components to maintain the anti-aliasing */ | 651 | the average of the three rgb colour components to maintain the anti-aliasing */ |
652 | if (alpha) | 652 | if (alpha) |
653 | { | 653 | { |
654 | a = (r + g + b) / 3; | 654 | a = (r + g + b) / 3; |
655 | r = 255; | 655 | r = 255; |
656 | g = 255; | 656 | g = 255; |
657 | b = 255; | 657 | b = 255; |
658 | } | 658 | } |
659 | currentImages[currentImage]->setPixel(xDest + xSrc,yDest + ySrc,video::SColor(a,r,g,b)); | 659 | currentImages[currentImage]->setPixel(xDest + xSrc,yDest + ySrc,video::SColor(a,r,g,b)); |
660 | } | 660 | } |
661 | image->f.destroy_image(image); | 661 | image->f.destroy_image(image); |
662 | } | 662 | } |
663 | } | 663 | } |
664 | } | 664 | } |
665 | 665 | ||
666 | /* Add the texture to the list */ | 666 | /* Add the texture to the list */ |
667 | currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]); | 667 | currentTextures[currentImage] = Device->getVideoDriver()->addTexture("GUIFontImage",currentImages[currentImage]); |
668 | currentTextures[currentImage]->grab(); | 668 | currentTextures[currentImage]->grab(); |
669 | } | 669 | } |
670 | 670 | ||
671 | XftColorFree (display, visual, DefaultColormap(display, screen), &colFore); | 671 | XftColorFree (display, visual, DefaultColormap(display, screen), &colFore); |
672 | XftColorFree (display, visual, DefaultColormap(display, screen), &colBack); | 672 | XftColorFree (display, visual, DefaultColormap(display, screen), &colBack); |
673 | XftFontClose(display,font); | 673 | XftFontClose(display,font); |
674 | XftPatternDestroy(request); | 674 | XftPatternDestroy(request); |
675 | XftDrawDestroy(draw); | 675 | XftDrawDestroy(draw); |
676 | XFreePixmap(display, pixmap); | 676 | XFreePixmap(display, pixmap); |
677 | return true; | 677 | return true; |
678 | } | 678 | } |
679 | #endif | 679 | #endif |
680 | 680 | ||
681 | CFontTool::~CFontTool() | 681 | CFontTool::~CFontTool() |
682 | { | 682 | { |
683 | #ifdef _IRR_WINDOWS_ | 683 | #ifdef _IRR_WINDOWS_ |
684 | // destroy display context | 684 | // destroy display context |
685 | if (dc) | 685 | if (dc) |
686 | DeleteDC(dc); | 686 | DeleteDC(dc); |
687 | #endif | 687 | #endif |
688 | 688 | ||
689 | // drop textures+images | 689 | // drop textures+images |
690 | for (u32 i=0; i<currentTextures.size(); ++i) | 690 | for (u32 i=0; i<currentTextures.size(); ++i) |
691 | currentTextures[i]->drop(); | 691 | currentTextures[i]->drop(); |
692 | currentTextures.clear(); | 692 | currentTextures.clear(); |
693 | 693 | ||
694 | for (u32 i=0; i<currentImages.size(); ++i) | 694 | for (u32 i=0; i<currentImages.size(); ++i) |
695 | currentImages[i]->drop(); | 695 | currentImages[i]->drop(); |
696 | currentImages.clear(); | 696 | currentImages.clear(); |
697 | } | 697 | } |
698 | 698 | ||
699 | bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format) | 699 | bool CFontTool::saveBitmapFont(const c8 *filename, const c8* format) |
700 | { | 700 | { |
701 | if (currentImages.size() == 0) | 701 | if (currentImages.size() == 0) |
702 | { | 702 | { |
703 | Device->getLogger()->log("No image data to write, aborting."); | 703 | Device->getLogger()->log("No image data to write, aborting."); |
704 | return false; | 704 | return false; |
705 | } | 705 | } |
706 | 706 | ||
707 | core::stringc fn = filename; | 707 | core::stringc fn = filename; |
708 | core::stringc imagename = filename; | 708 | core::stringc imagename = filename; |
709 | fn += ".xml"; | 709 | fn += ".xml"; |
710 | 710 | ||
711 | io::IXMLWriter *writer = Device->getFileSystem()->createXMLWriter(fn.c_str()); | 711 | io::IXMLWriter *writer = Device->getFileSystem()->createXMLWriter(fn.c_str()); |
712 | 712 | ||
713 | // header and line breaks | 713 | // header and line breaks |
714 | writer->writeXMLHeader(); | 714 | writer->writeXMLHeader(); |
715 | writer->writeLineBreak(); | 715 | writer->writeLineBreak(); |
716 | 716 | ||
717 | // write information | 717 | // write information |
718 | writer->writeElement(L"font", false, L"type", L"bitmap"); | 718 | writer->writeElement(L"font", false, L"type", L"bitmap"); |
719 | writer->writeLineBreak(); | 719 | writer->writeLineBreak(); |
720 | writer->writeLineBreak(); | 720 | writer->writeLineBreak(); |
721 | 721 | ||
722 | // write images and link to them | 722 | // write images and link to them |
723 | for (u32 i=0; i<currentImages.size(); ++i) | 723 | for (u32 i=0; i<currentImages.size(); ++i) |
724 | { | 724 | { |
725 | imagename = filename; | 725 | imagename = filename; |
726 | imagename += (s32)i; | 726 | imagename += (s32)i; |
727 | imagename += "."; | 727 | imagename += "."; |
728 | imagename += format; | 728 | imagename += format; |
729 | Device->getVideoDriver()->writeImageToFile(currentImages[i],imagename.c_str()); | 729 | Device->getVideoDriver()->writeImageToFile(currentImages[i],imagename.c_str()); |
730 | 730 | ||
731 | writer->writeElement(L"Texture", true, | 731 | writer->writeElement(L"Texture", true, |
732 | L"index", core::stringw(i).c_str(), | 732 | L"index", core::stringw(i).c_str(), |
733 | L"filename", core::stringw(imagename.c_str()).c_str(), | 733 | L"filename", core::stringw(imagename.c_str()).c_str(), |
734 | L"hasAlpha", UseAlphaChannel ? L"true" : L"false"); | 734 | L"hasAlpha", UseAlphaChannel ? L"true" : L"false"); |
735 | writer->writeLineBreak(); | 735 | writer->writeLineBreak(); |
736 | } | 736 | } |
737 | 737 | ||
738 | writer->writeLineBreak(); | 738 | writer->writeLineBreak(); |
739 | 739 | ||
740 | // write each character | 740 | // write each character |
741 | core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); | 741 | core::map<wchar_t, u32>::Iterator it = CharMap.getIterator(); |
742 | while (!it.atEnd()) | 742 | while (!it.atEnd()) |
743 | { | 743 | { |
744 | SFontArea &fa = Areas[(*it).getValue()]; | 744 | SFontArea &fa = Areas[(*it).getValue()]; |
745 | 745 | ||
746 | wchar_t c[2]; | 746 | wchar_t c[2]; |
747 | c[0] = (*it).getKey(); | 747 | c[0] = (*it).getKey(); |
748 | c[1] = L'\0'; | 748 | c[1] = L'\0'; |
749 | core::stringw area, under, over, image; | 749 | core::stringw area, under, over, image; |
750 | area = core::stringw(fa.rectangle.UpperLeftCorner.X); | 750 | area = core::stringw(fa.rectangle.UpperLeftCorner.X); |
751 | area += L", "; | 751 | area += L", "; |
752 | area += fa.rectangle.UpperLeftCorner.Y; | 752 | area += fa.rectangle.UpperLeftCorner.Y; |
753 | area += L", "; | 753 | area += L", "; |
754 | area += fa.rectangle.LowerRightCorner.X; | 754 | area += fa.rectangle.LowerRightCorner.X; |
755 | area += L", "; | 755 | area += L", "; |
756 | area += fa.rectangle.LowerRightCorner.Y; | 756 | area += fa.rectangle.LowerRightCorner.Y; |
757 | 757 | ||
758 | core::array<core::stringw> names; | 758 | core::array<core::stringw> names; |
759 | core::array<core::stringw> values; | 759 | core::array<core::stringw> values; |
760 | names.clear(); | 760 | names.clear(); |
761 | values.clear(); | 761 | values.clear(); |
762 | // char | 762 | // char |
763 | names.push_back(core::stringw(L"c")); | 763 | names.push_back(core::stringw(L"c")); |
764 | values.push_back(core::stringw(c)); | 764 | values.push_back(core::stringw(c)); |
765 | // image number | 765 | // image number |
766 | if (fa.sourceimage != 0) | 766 | if (fa.sourceimage != 0) |
767 | { | 767 | { |
768 | image = core::stringw(fa.sourceimage); | 768 | image = core::stringw(fa.sourceimage); |
769 | names.push_back(core::stringw(L"i")); | 769 | names.push_back(core::stringw(L"i")); |
770 | values.push_back(image); | 770 | values.push_back(image); |
771 | } | 771 | } |
772 | // rectangle | 772 | // rectangle |
773 | names.push_back(core::stringw(L"r")); | 773 | names.push_back(core::stringw(L"r")); |
774 | values.push_back(area); | 774 | values.push_back(area); |
775 | 775 | ||
776 | if (fa.underhang != 0) | 776 | if (fa.underhang != 0) |
777 | { | 777 | { |
778 | under = core::stringw(fa.underhang); | 778 | under = core::stringw(fa.underhang); |
779 | names.push_back(core::stringw(L"u")); | 779 | names.push_back(core::stringw(L"u")); |
780 | values.push_back(under); | 780 | values.push_back(under); |
781 | } | 781 | } |
782 | if (fa.overhang != 0) | 782 | if (fa.overhang != 0) |
783 | { | 783 | { |
784 | over = core::stringw(fa.overhang); | 784 | over = core::stringw(fa.overhang); |
785 | names.push_back(core::stringw(L"o")); | 785 | names.push_back(core::stringw(L"o")); |
786 | values.push_back(over); | 786 | values.push_back(over); |
787 | } | 787 | } |
788 | writer->writeElement(L"c", true, names, values); | 788 | writer->writeElement(L"c", true, names, values); |
789 | 789 | ||
790 | writer->writeLineBreak(); | 790 | writer->writeLineBreak(); |
791 | it++; | 791 | it++; |
792 | } | 792 | } |
793 | 793 | ||
794 | writer->writeClosingTag(L"font"); | 794 | writer->writeClosingTag(L"font"); |
795 | 795 | ||
796 | writer->drop(); | 796 | writer->drop(); |
797 | 797 | ||
798 | Device->getLogger()->log("Bitmap font saved."); | 798 | Device->getLogger()->log("Bitmap font saved."); |
799 | 799 | ||
800 | return true; | 800 | return true; |
801 | } | 801 | } |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.h b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.h index 5a35938..ee0eefb 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.h +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CFontTool.h | |||
@@ -1,78 +1,78 @@ | |||
1 | #ifndef __IRR_FONT_TOOL_INCLUDED__ | 1 | #ifndef __IRR_FONT_TOOL_INCLUDED__ |
2 | #define __IRR_FONT_TOOL_INCLUDED__ | 2 | #define __IRR_FONT_TOOL_INCLUDED__ |
3 | 3 | ||
4 | 4 | ||
5 | #include "irrlicht.h" | 5 | #include "irrlicht.h" |
6 | 6 | ||
7 | #if defined(_IRR_WINDOWS_) | 7 | #if defined(_IRR_WINDOWS_) |
8 | #ifdef _MBCS | 8 | #ifdef _MBCS |
9 | #undef _MBCS | 9 | #undef _MBCS |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #define UNICODE | 12 | #define UNICODE |
13 | #define _WIN32_WINNT 0x0500 | 13 | #define _WIN32_WINNT 0x0500 |
14 | #include "windows.h" | 14 | #include "windows.h" |
15 | #else | 15 | #else |
16 | #ifdef _IRR_COMPILE_WITH_X11_ | 16 | #ifdef _IRR_COMPILE_WITH_X11_ |
17 | #include <X11/Xlib.h> | 17 | #include <X11/Xlib.h> |
18 | #endif | 18 | #endif |
19 | #include <X11/Xft/Xft.h> | 19 | #include <X11/Xft/Xft.h> |
20 | #include <set> | 20 | #include <set> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | 23 | ||
24 | namespace irr { | 24 | namespace irr { |
25 | class CFontTool : public irr::IReferenceCounted | 25 | class CFontTool : public irr::IReferenceCounted |
26 | { | 26 | { |
27 | public: | 27 | public: |
28 | CFontTool(irr::IrrlichtDevice* device); | 28 | CFontTool(irr::IrrlichtDevice* device); |
29 | ~CFontTool(); | 29 | ~CFontTool(); |
30 | 30 | ||
31 | virtual bool makeBitmapFont(u32 fontIndex, u32 charsetIndex, | 31 | virtual bool makeBitmapFont(u32 fontIndex, u32 charsetIndex, |
32 | s32 fontSize, u32 texturewidth, u32 textureHeight, | 32 | s32 fontSize, u32 texturewidth, u32 textureHeight, |
33 | bool bold, bool italic, bool aa, bool alpha); | 33 | bool bold, bool italic, bool aa, bool alpha); |
34 | 34 | ||
35 | virtual bool saveBitmapFont(const c8* filename, const c8* format); | 35 | virtual bool saveBitmapFont(const c8* filename, const c8* format); |
36 | 36 | ||
37 | virtual void selectCharSet(u32 currentCharSet); | 37 | virtual void selectCharSet(u32 currentCharSet); |
38 | 38 | ||
39 | struct SFontArea | 39 | struct SFontArea |
40 | { | 40 | { |
41 | SFontArea() : rectangle(), underhang(0), overhang(0), sourceimage(0) {} | 41 | SFontArea() : rectangle(), underhang(0), overhang(0), sourceimage(0) {} |
42 | core::rect<s32> rectangle; | 42 | core::rect<s32> rectangle; |
43 | s32 underhang; | 43 | s32 underhang; |
44 | s32 overhang; | 44 | s32 overhang; |
45 | u32 sourceimage; | 45 | u32 sourceimage; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* struct SFontMap | 48 | /* struct SFontMap |
49 | { | 49 | { |
50 | SFontMap() : areas(), start(0), count(0) {} | 50 | SFontMap() : areas(), start(0), count(0) {} |
51 | core::array< SFontArea > areas; | 51 | core::array< SFontArea > areas; |
52 | s32 start; | 52 | s32 start; |
53 | s32 count; | 53 | s32 count; |
54 | };*/ | 54 | };*/ |
55 | 55 | ||
56 | 56 | ||
57 | 57 | ||
58 | core::array<core::stringw> FontNames; | 58 | core::array<core::stringw> FontNames; |
59 | core::array<core::stringw> CharSets; | 59 | core::array<core::stringw> CharSets; |
60 | //core::array<SFontMap> Mappings; | 60 | //core::array<SFontMap> Mappings; |
61 | core::array<SFontArea> Areas; | 61 | core::array<SFontArea> Areas; |
62 | core::map<wchar_t, u32> CharMap; | 62 | core::map<wchar_t, u32> CharMap; |
63 | 63 | ||
64 | core::array<video::ITexture*> currentTextures; | 64 | core::array<video::ITexture*> currentTextures; |
65 | core::array<video::IImage*> currentImages; | 65 | core::array<video::IImage*> currentImages; |
66 | const int *FontSizes; | 66 | const int *FontSizes; |
67 | IrrlichtDevice *Device; | 67 | IrrlichtDevice *Device; |
68 | 68 | ||
69 | bool UseAlphaChannel; | 69 | bool UseAlphaChannel; |
70 | 70 | ||
71 | // windows | 71 | // windows |
72 | #ifdef _IRR_WINDOWS_ | 72 | #ifdef _IRR_WINDOWS_ |
73 | HDC dc; | 73 | HDC dc; |
74 | #endif | 74 | #endif |
75 | 75 | ||
76 | }; | 76 | }; |
77 | } | 77 | } |
78 | #endif // __IRR_FONT_TOOL_INCLUDED__ | 78 | #endif // __IRR_FONT_TOOL_INCLUDED__ |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CVectorFontTool.h b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CVectorFontTool.h index 05a9c79..c139f3d 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CVectorFontTool.h +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/CVectorFontTool.h | |||
@@ -1,1199 +1,1199 @@ | |||
1 | /* | 1 | /* |
2 | Vector font tool - Gaz Davidson December 2006-2012 | 2 | Vector font tool - Gaz Davidson December 2006-2012 |
3 | 3 | ||
4 | I noticed bitmap fonts were taking massive amounts of video memory at reasonable sizes, | 4 | I noticed bitmap fonts were taking massive amounts of video memory at reasonable sizes, |
5 | so I decided to make a vector font. I always wanted to try converting pixels to triangles... | 5 | so I decided to make a vector font. I always wanted to try converting pixels to triangles... |
6 | 6 | ||
7 | And I failed! This is a collection of the ugliest, bloated, most inneficient algorithms | 7 | And I failed! This is a collection of the ugliest, bloated, most inneficient algorithms |
8 | i've ever written, but its kinda working so I'm not changing it. | 8 | i've ever written, but its kinda working so I'm not changing it. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #ifndef __VECTOR_FONT_TOOL_INCLUDED__ | 11 | #ifndef __VECTOR_FONT_TOOL_INCLUDED__ |
12 | #define __VECTOR_FONT_TOOL_INCLUDED__ | 12 | #define __VECTOR_FONT_TOOL_INCLUDED__ |
13 | 13 | ||
14 | #include "irrlicht.h" | 14 | #include "irrlicht.h" |
15 | #include "CFontTool.h" | 15 | #include "CFontTool.h" |
16 | #include <assert.h> | 16 | #include <assert.h> |
17 | 17 | ||
18 | using namespace irr; | 18 | using namespace irr; |
19 | using namespace video; | 19 | using namespace video; |
20 | 20 | ||
21 | struct STriangleList | 21 | struct STriangleList |
22 | { | 22 | { |
23 | core::array<core::vector2df> positions; | 23 | core::array<core::vector2df> positions; |
24 | core::array<u16> indexes; | 24 | core::array<u16> indexes; |
25 | 25 | ||
26 | // for adding one triangle list to another, | 26 | // for adding one triangle list to another, |
27 | // these triangles share positions, but dont share triangles | 27 | // these triangles share positions, but dont share triangles |
28 | STriangleList& operator+=(STriangleList &other) | 28 | STriangleList& operator+=(STriangleList &other) |
29 | { | 29 | { |
30 | core::matrix4 m; | 30 | core::matrix4 m; |
31 | core::array<s32> map; | 31 | core::array<s32> map; |
32 | map.set_used(other.positions.size()); | 32 | map.set_used(other.positions.size()); |
33 | 33 | ||
34 | for (u32 i=0; i<map.size(); ++i) | 34 | for (u32 i=0; i<map.size(); ++i) |
35 | map[i]=-1; | 35 | map[i]=-1; |
36 | 36 | ||
37 | for (u32 i=0; i<positions.size(); ++i) | 37 | for (u32 i=0; i<positions.size(); ++i) |
38 | for (u32 j=0; j<map.size(); ++j) | 38 | for (u32 j=0; j<map.size(); ++j) |
39 | if ( positions[i] == other.positions[j] ) | 39 | if ( positions[i] == other.positions[j] ) |
40 | map[j] = i; | 40 | map[j] = i; |
41 | 41 | ||
42 | for (u32 i=0; i<map.size(); ++i) | 42 | for (u32 i=0; i<map.size(); ++i) |
43 | if (map[i] == -1) | 43 | if (map[i] == -1) |
44 | { | 44 | { |
45 | positions.push_back(other.positions[i]); | 45 | positions.push_back(other.positions[i]); |
46 | map[i] = positions.size()-1; | 46 | map[i] = positions.size()-1; |
47 | } | 47 | } |
48 | 48 | ||
49 | // add triangles | 49 | // add triangles |
50 | for (u32 i=0; i<other.indexes.size(); ++i) | 50 | for (u32 i=0; i<other.indexes.size(); ++i) |
51 | indexes.push_back((u32)map[other.indexes[i]]); | 51 | indexes.push_back((u32)map[other.indexes[i]]); |
52 | 52 | ||
53 | return *this; | 53 | return *this; |
54 | } | 54 | } |
55 | 55 | ||
56 | // functions for building triangles for shapes, | 56 | // functions for building triangles for shapes, |
57 | // each shape can't have duplicate triangles | 57 | // each shape can't have duplicate triangles |
58 | bool hasTriangle(core::vector2df a, core::vector2df b, core::vector2df c) | 58 | bool hasTriangle(core::vector2df a, core::vector2df b, core::vector2df c) |
59 | { | 59 | { |
60 | // make sure the triangle is wound correctly | 60 | // make sure the triangle is wound correctly |
61 | if (core::line2df(a,b).getPointOrientation(c) < 0) | 61 | if (core::line2df(a,b).getPointOrientation(c) < 0) |
62 | { core::vector2df tmp=a; a=b; b=tmp; } | 62 | { core::vector2df tmp=a; a=b; b=tmp; } |
63 | 63 | ||
64 | u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff; | 64 | u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff; |
65 | // Find each vertex | 65 | // Find each vertex |
66 | for (u32 i=0; i < positions.size() && (ia==(u32)-1||ib==(u32)-1||ic==(u32)-1) ; ++i) | 66 | for (u32 i=0; i < positions.size() && (ia==(u32)-1||ib==(u32)-1||ic==(u32)-1) ; ++i) |
67 | { | 67 | { |
68 | if (positions[i] == a) | 68 | if (positions[i] == a) |
69 | ia = i; | 69 | ia = i; |
70 | if (positions[i] == b) | 70 | if (positions[i] == b) |
71 | ib = i; | 71 | ib = i; |
72 | if (positions[i] == c) | 72 | if (positions[i] == c) |
73 | ic = i; | 73 | ic = i; |
74 | } | 74 | } |
75 | 75 | ||
76 | if (ia==0xffffffff) | 76 | if (ia==0xffffffff) |
77 | { | 77 | { |
78 | return false; | 78 | return false; |
79 | } | 79 | } |
80 | if (ib==0xffffffff) | 80 | if (ib==0xffffffff) |
81 | { | 81 | { |
82 | return false; | 82 | return false; |
83 | } | 83 | } |
84 | if (ic==0xffffffff) | 84 | if (ic==0xffffffff) |
85 | { | 85 | { |
86 | return false; | 86 | return false; |
87 | } | 87 | } |
88 | 88 | ||
89 | for (u32 i=0; i<indexes.size(); i+=3) | 89 | for (u32 i=0; i<indexes.size(); i+=3) |
90 | if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) || | 90 | if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) || |
91 | (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) || | 91 | (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) || |
92 | (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) ) | 92 | (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) ) |
93 | return true; | 93 | return true; |
94 | 94 | ||
95 | return false; | 95 | return false; |
96 | } | 96 | } |
97 | 97 | ||
98 | void add(core::vector2df a, core::vector2df b, core::vector2df c) | 98 | void add(core::vector2df a, core::vector2df b, core::vector2df c) |
99 | { | 99 | { |
100 | 100 | ||
101 | // make sure the triangle is wound correctly | 101 | // make sure the triangle is wound correctly |
102 | if (core::line2df(a,b).getPointOrientation(c) < 0) | 102 | if (core::line2df(a,b).getPointOrientation(c) < 0) |
103 | { | 103 | { |
104 | core::vector2df tmp=a; a=b; b=tmp; | 104 | core::vector2df tmp=a; a=b; b=tmp; |
105 | } | 105 | } |
106 | 106 | ||
107 | u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff; | 107 | u32 ia=0xffffffff, ib=0xffffffff, ic=0xffffffff; |
108 | // no duplicate vertex positions allowed... | 108 | // no duplicate vertex positions allowed... |
109 | for (u32 i=0; i < positions.size() && (ia==-1||ib==-1||ic==-1) ; ++i) | 109 | for (u32 i=0; i < positions.size() && (ia==-1||ib==-1||ic==-1) ; ++i) |
110 | { | 110 | { |
111 | if (positions[i] == a) | 111 | if (positions[i] == a) |
112 | ia = i; | 112 | ia = i; |
113 | if (positions[i] == b) | 113 | if (positions[i] == b) |
114 | ib = i; | 114 | ib = i; |
115 | if (positions[i] == c) | 115 | if (positions[i] == c) |
116 | ic = i; | 116 | ic = i; |
117 | } | 117 | } |
118 | bool found=true; | 118 | bool found=true; |
119 | if (ia==0xffffffff) | 119 | if (ia==0xffffffff) |
120 | { | 120 | { |
121 | ia = positions.size(); | 121 | ia = positions.size(); |
122 | positions.push_back(a); | 122 | positions.push_back(a); |
123 | found=false; | 123 | found=false; |
124 | } | 124 | } |
125 | if (ib==0xffffffff) | 125 | if (ib==0xffffffff) |
126 | { | 126 | { |
127 | ib = positions.size(); | 127 | ib = positions.size(); |
128 | positions.push_back(b); | 128 | positions.push_back(b); |
129 | found=false; | 129 | found=false; |
130 | } | 130 | } |
131 | if (ic==0xffffffff) | 131 | if (ic==0xffffffff) |
132 | { | 132 | { |
133 | ic = positions.size(); | 133 | ic = positions.size(); |
134 | positions.push_back(c); | 134 | positions.push_back(c); |
135 | found=false; | 135 | found=false; |
136 | } | 136 | } |
137 | 137 | ||
138 | // no duplicate triangles allowed | 138 | // no duplicate triangles allowed |
139 | if (found) | 139 | if (found) |
140 | { | 140 | { |
141 | found=false; | 141 | found=false; |
142 | for (u32 i=0; i<indexes.size(); i+=3) | 142 | for (u32 i=0; i<indexes.size(); i+=3) |
143 | { | 143 | { |
144 | if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) || | 144 | if ( (indexes[i] == ia && indexes[i+1] == ib && indexes[i+2] == ic) || |
145 | (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) || | 145 | (indexes[i] == ic && indexes[i+1] == ia && indexes[i+2] == ib) || |
146 | (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) ) | 146 | (indexes[i] == ib && indexes[i+1] == ic && indexes[i+2] == ia) ) |
147 | { | 147 | { |
148 | found=true; | 148 | found=true; |
149 | break; | 149 | break; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | if (!found) | 154 | if (!found) |
155 | { | 155 | { |
156 | indexes.push_back(ia); | 156 | indexes.push_back(ia); |
157 | indexes.push_back(ib); | 157 | indexes.push_back(ib); |
158 | indexes.push_back(ic); | 158 | indexes.push_back(ic); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | }; | 161 | }; |
162 | 162 | ||
163 | // finds groups of pixels and triangulates them | 163 | // finds groups of pixels and triangulates them |
164 | class CGroupFinder | 164 | class CGroupFinder |
165 | { | 165 | { |
166 | public: | 166 | public: |
167 | CGroupFinder(bool *memory, s32 w, s32 h, IrrlichtDevice *dev): | 167 | CGroupFinder(bool *memory, s32 w, s32 h, IrrlichtDevice *dev): |
168 | width(w), height(h), mem(memory), Device(dev) | 168 | width(w), height(h), mem(memory), Device(dev) |
169 | { | 169 | { |
170 | refbuffer.set_used(w*h); | 170 | refbuffer.set_used(w*h); |
171 | for (u32 i=0; i<refbuffer.size(); ++i) | 171 | for (u32 i=0; i<refbuffer.size(); ++i) |
172 | refbuffer[i]=0; | 172 | refbuffer[i]=0; |
173 | // find groups of pixels | 173 | // find groups of pixels |
174 | findGroups(); | 174 | findGroups(); |
175 | removeGroups(); | 175 | removeGroups(); |
176 | 176 | ||
177 | // triangulate | 177 | // triangulate |
178 | for (u32 i=0; i<groups.size(); ++i) | 178 | for (u32 i=0; i<groups.size(); ++i) |
179 | { | 179 | { |
180 | groups[i].triangulate(); | 180 | groups[i].triangulate(); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | // contains a clockwise edge line | 184 | // contains a clockwise edge line |
185 | struct SEdge | 185 | struct SEdge |
186 | { | 186 | { |
187 | SEdge() : positions() { } | 187 | SEdge() : positions() { } |
188 | 188 | ||
189 | core::array<core::position2di> positions; | 189 | core::array<core::position2di> positions; |
190 | 190 | ||
191 | bool isMember(s32 x, s32 y) | 191 | bool isMember(s32 x, s32 y) |
192 | { | 192 | { |
193 | for (u32 i=0; i<positions.size(); ++i) | 193 | for (u32 i=0; i<positions.size(); ++i) |
194 | if (positions[i].X == x && positions[i].Y == y) | 194 | if (positions[i].X == x && positions[i].Y == y) |
195 | return true; | 195 | return true; |
196 | return false; | 196 | return false; |
197 | } | 197 | } |
198 | 198 | ||
199 | // reduces the number of points in the edge | 199 | // reduces the number of points in the edge |
200 | void reduce(s32 level=0) | 200 | void reduce(s32 level=0) |
201 | { | 201 | { |
202 | // level 0- remove points on the same line | 202 | // level 0- remove points on the same line |
203 | for (u32 i=1; i < positions.size()-1; ++i) | 203 | for (u32 i=1; i < positions.size()-1; ++i) |
204 | { | 204 | { |
205 | // same point as the last one?! shouldnt happen, dunno why it does :| | 205 | // same point as the last one?! shouldnt happen, dunno why it does :| |
206 | if (positions[i-1] == positions[i]) | 206 | if (positions[i-1] == positions[i]) |
207 | { | 207 | { |
208 | positions.erase(i--); | 208 | positions.erase(i--); |
209 | continue; | 209 | continue; |
210 | } | 210 | } |
211 | 211 | ||
212 | // get headings | 212 | // get headings |
213 | core::vector2d<f32> h1((f32)(positions[i-1].X - positions[i].X),(f32)(positions[i-1].Y - positions[i].Y)), | 213 | core::vector2d<f32> h1((f32)(positions[i-1].X - positions[i].X),(f32)(positions[i-1].Y - positions[i].Y)), |
214 | h2((f32)(positions[i].X - positions[i+1].X),(f32)(positions[i].Y - positions[i+1].Y)); | 214 | h2((f32)(positions[i].X - positions[i+1].X),(f32)(positions[i].Y - positions[i+1].Y)); |
215 | h1.normalize(); | 215 | h1.normalize(); |
216 | h2.normalize(); | 216 | h2.normalize(); |
217 | 217 | ||
218 | if (h1==h2) // erase the current point | 218 | if (h1==h2) // erase the current point |
219 | positions.erase(i--); | 219 | positions.erase(i--); |
220 | } | 220 | } |
221 | 221 | ||
222 | // level 1- if point1 points at point3, we can skip point2 | 222 | // level 1- if point1 points at point3, we can skip point2 |
223 | // level 2+ allow a deviation of level-1 | 223 | // level 2+ allow a deviation of level-1 |
224 | 224 | ||
225 | } | 225 | } |
226 | 226 | ||
227 | }; | 227 | }; |
228 | 228 | ||
229 | // contains an array of lines for triangulation | 229 | // contains an array of lines for triangulation |
230 | struct SLineList | 230 | struct SLineList |
231 | { | 231 | { |
232 | core::array<core::line2df> lines; | 232 | core::array<core::line2df> lines; |
233 | SLineList() : lines() { } | 233 | SLineList() : lines() { } |
234 | void addEdge(const SEdge &edge) | 234 | void addEdge(const SEdge &edge) |
235 | { | 235 | { |
236 | // adds lines to the buffer | 236 | // adds lines to the buffer |
237 | for (u32 i=1; i<edge.positions.size(); ++i) | 237 | for (u32 i=1; i<edge.positions.size(); ++i) |
238 | addLine(core::line2df((f32)edge.positions[i-1].X, (f32)edge.positions[i-1].Y, | 238 | addLine(core::line2df((f32)edge.positions[i-1].X, (f32)edge.positions[i-1].Y, |
239 | (f32)edge.positions[i].X, (f32)edge.positions[i].Y )); | 239 | (f32)edge.positions[i].X, (f32)edge.positions[i].Y )); |
240 | } | 240 | } |
241 | void addLine( const core::line2df &line ) | 241 | void addLine( const core::line2df &line ) |
242 | { | 242 | { |
243 | // no dupes! | 243 | // no dupes! |
244 | if (!hasLine(line)) | 244 | if (!hasLine(line)) |
245 | lines.push_back(line); | 245 | lines.push_back(line); |
246 | } | 246 | } |
247 | bool hasLine( const core::line2df &line ) | 247 | bool hasLine( const core::line2df &line ) |
248 | { | 248 | { |
249 | for (u32 i=0; i<lines.size(); ++i) | 249 | for (u32 i=0; i<lines.size(); ++i) |
250 | if (line == lines[i] || (line.start == lines[i].end && line.end == lines[i].start) ) | 250 | if (line == lines[i] || (line.start == lines[i].end && line.end == lines[i].start) ) |
251 | return true; | 251 | return true; |
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | bool crossesWith( core::line2df l, core::vector2df p) | 255 | bool crossesWith( core::line2df l, core::vector2df p) |
256 | { | 256 | { |
257 | // inside checks only work with clockwise triangles | 257 | // inside checks only work with clockwise triangles |
258 | if (l.getPointOrientation(p) < 0) | 258 | if (l.getPointOrientation(p) < 0) |
259 | { core::vector2df tmp=l.start; l.start=l.end; l.end=tmp; } | 259 | { core::vector2df tmp=l.start; l.start=l.end; l.end=tmp; } |
260 | 260 | ||
261 | // make the 3 triangle edges | 261 | // make the 3 triangle edges |
262 | core::line2df &la=l, lb(l.end,p), lc(p,l.start); | 262 | core::line2df &la=l, lb(l.end,p), lc(p,l.start); |
263 | 263 | ||
264 | // test every line in the list | 264 | // test every line in the list |
265 | for (u32 i=0; i<lines.size(); ++i) | 265 | for (u32 i=0; i<lines.size(); ++i) |
266 | { | 266 | { |
267 | core::line2df &l2 = lines[i]; | 267 | core::line2df &l2 = lines[i]; |
268 | 268 | ||
269 | // the triangle isn't allowed to enclose any points | 269 | // the triangle isn't allowed to enclose any points |
270 | // triangles are clockwise, so if to the right of all 3 lines, it's enclosed | 270 | // triangles are clockwise, so if to the right of all 3 lines, it's enclosed |
271 | if (la.getPointOrientation(l2.start) > 0 && | 271 | if (la.getPointOrientation(l2.start) > 0 && |
272 | lb.getPointOrientation(l2.start) > 0 && | 272 | lb.getPointOrientation(l2.start) > 0 && |
273 | lc.getPointOrientation(l2.start) > 0) | 273 | lc.getPointOrientation(l2.start) > 0) |
274 | return true; | 274 | return true; |
275 | //if (la.getPointOrientation(l2.start) < 0 && | 275 | //if (la.getPointOrientation(l2.start) < 0 && |
276 | // lb.getPointOrientation(l2.start) < 0 && | 276 | // lb.getPointOrientation(l2.start) < 0 && |
277 | // lc.getPointOrientation(l2.start) < 0) | 277 | // lc.getPointOrientation(l2.start) < 0) |
278 | // return true; | 278 | // return true; |
279 | 279 | ||
280 | core::vector2df out; | 280 | core::vector2df out; |
281 | //if (la.intersectWith(l2,out)) | 281 | //if (la.intersectWith(l2,out)) |
282 | // if (out != la.start && out != la.end && | 282 | // if (out != la.start && out != la.end && |
283 | // out != l2.start && out != l2.end) | 283 | // out != l2.start && out != l2.end) |
284 | // return true; | 284 | // return true; |
285 | if (lb.intersectWith(l2,out)) | 285 | if (lb.intersectWith(l2,out)) |
286 | if (!out.equals(lb.start) && !out.equals(lb.end) && | 286 | if (!out.equals(lb.start) && !out.equals(lb.end) && |
287 | !out.equals(l2.start) && !out.equals(l2.end)) | 287 | !out.equals(l2.start) && !out.equals(l2.end)) |
288 | return true; | 288 | return true; |
289 | if (lc.intersectWith(l2,out)) | 289 | if (lc.intersectWith(l2,out)) |
290 | if (!out.equals(lc.start) && !out.equals(lc.end) && | 290 | if (!out.equals(lc.start) && !out.equals(lc.end) && |
291 | !out.equals(l2.start) && !out.equals(l2.end)) | 291 | !out.equals(l2.start) && !out.equals(l2.end)) |
292 | return true; | 292 | return true; |
293 | 293 | ||
294 | // my shit intersection code only works with lines in certain directions :( | 294 | // my shit intersection code only works with lines in certain directions :( |
295 | if (l2.intersectWith(lb,out)) | 295 | if (l2.intersectWith(lb,out)) |
296 | if (!out.equals(lb.start) && !out.equals(lb.end) && | 296 | if (!out.equals(lb.start) && !out.equals(lb.end) && |
297 | !out.equals(l2.start) && !out.equals(l2.end)) | 297 | !out.equals(l2.start) && !out.equals(l2.end)) |
298 | return true; | 298 | return true; |
299 | if (l2.intersectWith(lc,out)) | 299 | if (l2.intersectWith(lc,out)) |
300 | if (!out.equals(lc.start) && !out.equals(lc.end) && | 300 | if (!out.equals(lc.start) && !out.equals(lc.end) && |
301 | !out.equals(l2.start) && !out.equals(l2.end)) | 301 | !out.equals(l2.start) && !out.equals(l2.end)) |
302 | return true; | 302 | return true; |
303 | 303 | ||
304 | 304 | ||
305 | if (lb.isPointOnLine(l2.start) && l2.start != lb.start && l2.start != lb.end) | 305 | if (lb.isPointOnLine(l2.start) && l2.start != lb.start && l2.start != lb.end) |
306 | return true; | 306 | return true; |
307 | if (lc.isPointOnLine(l2.start) && l2.start != lc.start && l2.start != lc.end) | 307 | if (lc.isPointOnLine(l2.start) && l2.start != lc.start && l2.start != lc.end) |
308 | return true; | 308 | return true; |
309 | 309 | ||
310 | } | 310 | } |
311 | return false; | 311 | return false; |
312 | } | 312 | } |
313 | }; | 313 | }; |
314 | 314 | ||
315 | // an area of adjacent pixels | 315 | // an area of adjacent pixels |
316 | struct SPixelGroup | 316 | struct SPixelGroup |
317 | { | 317 | { |
318 | SPixelGroup(IrrlichtDevice *device) : triangles(), pixelWidth(0), pixelHeight(0), | 318 | SPixelGroup(IrrlichtDevice *device) : triangles(), pixelWidth(0), pixelHeight(0), |
319 | Device(device) {} | 319 | Device(device) {} |
320 | 320 | ||
321 | core::array<core::position2di> pixels; | 321 | core::array<core::position2di> pixels; |
322 | core::array<SEdge> edges; | 322 | core::array<SEdge> edges; |
323 | STriangleList triangles; | 323 | STriangleList triangles; |
324 | core::array<SLineList> ll; | 324 | core::array<SLineList> ll; |
325 | core::array<bool> isMemberCache; | 325 | core::array<bool> isMemberCache; |
326 | s32 pixelWidth; | 326 | s32 pixelWidth; |
327 | s32 pixelHeight; | 327 | s32 pixelHeight; |
328 | IrrlichtDevice *Device; | 328 | IrrlichtDevice *Device; |
329 | 329 | ||
330 | void triangulate() | 330 | void triangulate() |
331 | { | 331 | { |
332 | 332 | ||
333 | // find edges in this group | 333 | // find edges in this group |
334 | makeEdges(); | 334 | makeEdges(); |
335 | 335 | ||
336 | // triangulate the group | 336 | // triangulate the group |
337 | makeTriangles(); | 337 | makeTriangles(); |
338 | 338 | ||
339 | } | 339 | } |
340 | 340 | ||
341 | void drawTriangle( core::line2df line, core::vector2df point) | 341 | void drawTriangle( core::line2df line, core::vector2df point) |
342 | { | 342 | { |
343 | //const u32 endt = Device->getTimer()->getTime() + t; | 343 | //const u32 endt = Device->getTimer()->getTime() + t; |
344 | f32 scale = 5; | 344 | f32 scale = 5; |
345 | 345 | ||
346 | 346 | ||
347 | //while(Device->getTimer()->getTime() < endt ) | 347 | //while(Device->getTimer()->getTime() < endt ) |
348 | //{ | 348 | //{ |
349 | Device->run(); | 349 | Device->run(); |
350 | Device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); | 350 | Device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); |
351 | for (u32 v=0;v<ll.size(); ++v) | 351 | for (u32 v=0;v<ll.size(); ++v) |
352 | for (u32 h=0;h<ll[v].lines.size(); ++h) | 352 | for (u32 h=0;h<ll[v].lines.size(); ++h) |
353 | { | 353 | { |
354 | core::line2df ¤tline = ll[v].lines[h]; | 354 | core::line2df ¤tline = ll[v].lines[h]; |
355 | core::position2di st = core::position2di((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50); | 355 | core::position2di st = core::position2di((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50); |
356 | core::position2di en = core::position2di((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50); | 356 | core::position2di en = core::position2di((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50); |
357 | 357 | ||
358 | Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,255,255)); | 358 | Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,255,255)); |
359 | } | 359 | } |
360 | // draw this triangle | 360 | // draw this triangle |
361 | const core::position2di st((s32)(line.start.X*scale)+50, (s32)(line.start.Y*scale)+50); | 361 | const core::position2di st((s32)(line.start.X*scale)+50, (s32)(line.start.Y*scale)+50); |
362 | const core::position2di en((s32)(line.end.X*scale)+50, (s32)(line.end.Y*scale)+50); | 362 | const core::position2di en((s32)(line.end.X*scale)+50, (s32)(line.end.Y*scale)+50); |
363 | const core::position2di p((s32)(point.X*scale)+50, (s32)(point.Y*scale)+50); | 363 | const core::position2di p((s32)(point.X*scale)+50, (s32)(point.Y*scale)+50); |
364 | Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); | 364 | Device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); |
365 | Device->getVideoDriver()->draw2DLine(en,p, SColor(255,0,255,0)); | 365 | Device->getVideoDriver()->draw2DLine(en,p, SColor(255,0,255,0)); |
366 | Device->getVideoDriver()->draw2DLine(p,st, SColor(255,0,0,255)); | 366 | Device->getVideoDriver()->draw2DLine(p,st, SColor(255,0,0,255)); |
367 | 367 | ||
368 | Device->getVideoDriver()->endScene(); | 368 | Device->getVideoDriver()->endScene(); |
369 | //} | 369 | //} |
370 | } | 370 | } |
371 | 371 | ||
372 | void makeTriangles() | 372 | void makeTriangles() |
373 | { | 373 | { |
374 | // make lines from edges, because they're easier to deal with | 374 | // make lines from edges, because they're easier to deal with |
375 | ll.clear(); | 375 | ll.clear(); |
376 | for (u32 i=0; i < edges.size(); ++i) | 376 | for (u32 i=0; i < edges.size(); ++i) |
377 | { | 377 | { |
378 | SLineList l; | 378 | SLineList l; |
379 | l.addEdge(edges[i]); | 379 | l.addEdge(edges[i]); |
380 | ll.push_back(l); | 380 | ll.push_back(l); |
381 | } | 381 | } |
382 | // add an extra one for inside edges | 382 | // add an extra one for inside edges |
383 | SLineList innerlines; | 383 | SLineList innerlines; |
384 | ll.push_back(innerlines); | 384 | ll.push_back(innerlines); |
385 | 385 | ||
386 | // loop through each edge and make triangles | 386 | // loop through each edge and make triangles |
387 | for (u32 i=0; i<ll.size(); ++i) | 387 | for (u32 i=0; i<ll.size(); ++i) |
388 | { | 388 | { |
389 | // loop through each line in the edge | 389 | // loop through each line in the edge |
390 | for (u32 cl=0; cl<ll[i].lines.size(); ++cl) | 390 | for (u32 cl=0; cl<ll[i].lines.size(); ++cl) |
391 | { | 391 | { |
392 | 392 | ||
393 | core::line2df ¤tLine = ll[i].lines[cl]; | 393 | core::line2df ¤tLine = ll[i].lines[cl]; |
394 | f32 bestScore = -10.0f; | 394 | f32 bestScore = -10.0f; |
395 | s32 bestEdge = -1; | 395 | s32 bestEdge = -1; |
396 | s32 bestPoint = -1; | 396 | s32 bestPoint = -1; |
397 | // find the best scoring point to join to this line | 397 | // find the best scoring point to join to this line |
398 | for (u32 k=0; k<ll.size(); ++k) | 398 | for (u32 k=0; k<ll.size(); ++k) |
399 | for (u32 j=0; j< ll[k].lines.size(); ++j) | 399 | for (u32 j=0; j< ll[k].lines.size(); ++j) |
400 | { | 400 | { |
401 | f32 score = 0.0f; | 401 | f32 score = 0.0f; |
402 | core::vector2df point(ll[k].lines[j].start.X, | 402 | core::vector2df point(ll[k].lines[j].start.X, |
403 | ll[k].lines[j].start.Y); | 403 | ll[k].lines[j].start.Y); |
404 | core::line2df line1(point,currentLine.start); | 404 | core::line2df line1(point,currentLine.start); |
405 | core::line2df line2(currentLine.end,point); | 405 | core::line2df line2(currentLine.end,point); |
406 | 406 | ||
407 | // can't be part of the current line | 407 | // can't be part of the current line |
408 | if (point == currentLine.start || point == currentLine.end) | 408 | if (point == currentLine.start || point == currentLine.end) |
409 | continue; | 409 | continue; |
410 | 410 | ||
411 | // must be to the right hand side (triangles are wound clockwise) | 411 | // must be to the right hand side (triangles are wound clockwise) |
412 | // unless its part of the inside... | 412 | // unless its part of the inside... |
413 | f32 side1 = currentLine.getPointOrientation(point); | 413 | f32 side1 = currentLine.getPointOrientation(point); |
414 | f32 side2 = core::line2df(point,currentLine.start).getPointOrientation(currentLine.end); | 414 | f32 side2 = core::line2df(point,currentLine.start).getPointOrientation(currentLine.end); |
415 | f32 side3 = core::line2df(currentLine.end,point).getPointOrientation(currentLine.start); | 415 | f32 side3 = core::line2df(currentLine.end,point).getPointOrientation(currentLine.start); |
416 | if (i<ll.size()-1) | 416 | if (i<ll.size()-1) |
417 | if (side1 <= 0 || side2 <= 0 || side3 <=0) | 417 | if (side1 <= 0 || side2 <= 0 || side3 <=0) |
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | // can't already have this triangle | 420 | // can't already have this triangle |
421 | if (triangles.hasTriangle(currentLine.start,currentLine.end,point)) | 421 | if (triangles.hasTriangle(currentLine.start,currentLine.end,point)) |
422 | continue; | 422 | continue; |
423 | 423 | ||
424 | // must not cross any other lines or enclose any points | 424 | // must not cross any other lines or enclose any points |
425 | bool itCrossed = false; | 425 | bool itCrossed = false; |
426 | for (u32 v=0; v<ll.size(); ++v) | 426 | for (u32 v=0; v<ll.size(); ++v) |
427 | if (ll[v].crossesWith(currentLine, point)) | 427 | if (ll[v].crossesWith(currentLine, point)) |
428 | { | 428 | { |
429 | itCrossed = true; | 429 | itCrossed = true; |
430 | break; | 430 | break; |
431 | } | 431 | } |
432 | if (itCrossed) | 432 | if (itCrossed) |
433 | continue; | 433 | continue; |
434 | 434 | ||
435 | 435 | ||
436 | // so, we like this triangle, but how much? | 436 | // so, we like this triangle, but how much? |
437 | // is it better than all the others? | 437 | // is it better than all the others? |
438 | 438 | ||
439 | // we prefer points from other edges, unless its on the inside | 439 | // we prefer points from other edges, unless its on the inside |
440 | if (k==i && i != ll.size()-1) | 440 | if (k==i && i != ll.size()-1) |
441 | score = 1; | 441 | score = 1; |
442 | else | 442 | else |
443 | score = 2; | 443 | score = 2; |
444 | 444 | ||
445 | // we prefer evenly shaped triangles | 445 | // we prefer evenly shaped triangles |
446 | 446 | ||
447 | // we prefer triangles with a large area | 447 | // we prefer triangles with a large area |
448 | 448 | ||
449 | // do we like this one more than the others? | 449 | // do we like this one more than the others? |
450 | if (score>bestScore) | 450 | if (score>bestScore) |
451 | { | 451 | { |
452 | bestScore = score; | 452 | bestScore = score; |
453 | bestEdge = k; | 453 | bestEdge = k; |
454 | bestPoint = j; | 454 | bestPoint = j; |
455 | } | 455 | } |
456 | } | 456 | } |
457 | // hopefully we found one | 457 | // hopefully we found one |
458 | if (bestEdge >= 0 && bestPoint >= 0 && bestScore >= 0.0f) | 458 | if (bestEdge >= 0 && bestPoint >= 0 && bestScore >= 0.0f) |
459 | { | 459 | { |
460 | //assert(bestEdge >= 0 && bestPoint >= 0); | 460 | //assert(bestEdge >= 0 && bestPoint >= 0); |
461 | //assert(bestScore >= 0.0f); | 461 | //assert(bestScore >= 0.0f); |
462 | 462 | ||
463 | core::vector2df point(ll[bestEdge].lines[bestPoint].start.X, ll[bestEdge].lines[bestPoint].start.Y); | 463 | core::vector2df point(ll[bestEdge].lines[bestPoint].start.X, ll[bestEdge].lines[bestPoint].start.Y); |
464 | 464 | ||
465 | // add it to the triangles list | 465 | // add it to the triangles list |
466 | triangles.add(currentLine.start, currentLine.end, point); | 466 | triangles.add(currentLine.start, currentLine.end, point); |
467 | 467 | ||
468 | // add inner lines to the line buffer, but only if they arent in others | 468 | // add inner lines to the line buffer, but only if they arent in others |
469 | 469 | ||
470 | core::line2df la(point,currentLine.start); | 470 | core::line2df la(point,currentLine.start); |
471 | core::line2df lb(currentLine.end,point); | 471 | core::line2df lb(currentLine.end,point); |
472 | 472 | ||
473 | bool found = false; | 473 | bool found = false; |
474 | for (u32 lineno=0;lineno<ll.size()-1; ++lineno) | 474 | for (u32 lineno=0;lineno<ll.size()-1; ++lineno) |
475 | if (ll[lineno].hasLine(la)) | 475 | if (ll[lineno].hasLine(la)) |
476 | { found=true; break; } | 476 | { found=true; break; } |
477 | if (!found) | 477 | if (!found) |
478 | ll[ll.size()-1].addLine(la); | 478 | ll[ll.size()-1].addLine(la); |
479 | 479 | ||
480 | for (u32 lineno=0;lineno<ll.size()-1; ++lineno) | 480 | for (u32 lineno=0;lineno<ll.size()-1; ++lineno) |
481 | if (ll[lineno].hasLine(lb)) | 481 | if (ll[lineno].hasLine(lb)) |
482 | { found=true; break; } | 482 | { found=true; break; } |
483 | if (!found) | 483 | if (!found) |
484 | ll[ll.size()-1].addLine(lb); | 484 | ll[ll.size()-1].addLine(lb); |
485 | 485 | ||
486 | //drawTriangle(currentLine, point); | 486 | //drawTriangle(currentLine, point); |
487 | 487 | ||
488 | } | 488 | } |
489 | 489 | ||
490 | } | 490 | } |
491 | } | 491 | } |
492 | } | 492 | } |
493 | 493 | ||
494 | // finds the edges | 494 | // finds the edges |
495 | void makeEdges() | 495 | void makeEdges() |
496 | { | 496 | { |
497 | 497 | ||
498 | // speed it up | 498 | // speed it up |
499 | refreshIsMemberCache(); | 499 | refreshIsMemberCache(); |
500 | 500 | ||
501 | // clear the edges | 501 | // clear the edges |
502 | edges.clear(); | 502 | edges.clear(); |
503 | 503 | ||
504 | // loop through each pixel | 504 | // loop through each pixel |
505 | for (u32 i=0; i < pixels.size(); ++i) | 505 | for (u32 i=0; i < pixels.size(); ++i) |
506 | { | 506 | { |
507 | core::position2di &p = pixels[i]; | 507 | core::position2di &p = pixels[i]; |
508 | s32 &x=p.X, &y=p.Y; | 508 | s32 &x=p.X, &y=p.Y; |
509 | bool ul = isMember(p.X-1,p.Y-1); | 509 | bool ul = isMember(p.X-1,p.Y-1); |
510 | bool u = isMember(p.X,p.Y-1); | 510 | bool u = isMember(p.X,p.Y-1); |
511 | bool ur = isMember(p.X+1,p.Y-1); | 511 | bool ur = isMember(p.X+1,p.Y-1); |
512 | bool l = isMember(p.X-1,p.Y); | 512 | bool l = isMember(p.X-1,p.Y); |
513 | bool r = isMember(p.X+1,p.Y); | 513 | bool r = isMember(p.X+1,p.Y); |
514 | bool bl = isMember(p.X-1,p.Y+1); | 514 | bool bl = isMember(p.X-1,p.Y+1); |
515 | bool b = isMember(p.X,p.Y+1); | 515 | bool b = isMember(p.X,p.Y+1); |
516 | bool br = isMember(p.X+1,p.Y+1); | 516 | bool br = isMember(p.X+1,p.Y+1); |
517 | 517 | ||
518 | // walls already added? | 518 | // walls already added? |
519 | bool top=u, bottom=b, left=l, right=r; | 519 | bool top=u, bottom=b, left=l, right=r; |
520 | 520 | ||
521 | if (!(ul | u | ur | l | r | bl | b | br)) | 521 | if (!(ul | u | ur | l | r | bl | b | br)) |
522 | { | 522 | { |
523 | // lone square | 523 | // lone square |
524 | SEdge a; | 524 | SEdge a; |
525 | a.positions.push_back( core::position2di(x,y)); | 525 | a.positions.push_back( core::position2di(x,y)); |
526 | a.positions.push_back( core::position2di(x+1,y)); | 526 | a.positions.push_back( core::position2di(x+1,y)); |
527 | a.positions.push_back( core::position2di(x+1,y+1)); | 527 | a.positions.push_back( core::position2di(x+1,y+1)); |
528 | a.positions.push_back( core::position2di(x,y+1)); | 528 | a.positions.push_back( core::position2di(x,y+1)); |
529 | a.positions.push_back( core::position2di(x,y)); | 529 | a.positions.push_back( core::position2di(x,y)); |
530 | edges.push_back(a); | 530 | edges.push_back(a); |
531 | top=bottom=left=right=true; | 531 | top=bottom=left=right=true; |
532 | } | 532 | } |
533 | else | 533 | else |
534 | { | 534 | { |
535 | if (!(ul|u|l) && (b&r) ) | 535 | if (!(ul|u|l) && (b&r) ) |
536 | { | 536 | { |
537 | // upper outer diagonal "/" | 537 | // upper outer diagonal "/" |
538 | addToEdges(x,y+1,x+1,y); | 538 | addToEdges(x,y+1,x+1,y); |
539 | top=left=true; | 539 | top=left=true; |
540 | } else if ( !(u|ur|r) && (b&l) ) | 540 | } else if ( !(u|ur|r) && (b&l) ) |
541 | { | 541 | { |
542 | // upper outer diagonal "\" | 542 | // upper outer diagonal "\" |
543 | addToEdges(x,y,x+1,y+1); | 543 | addToEdges(x,y,x+1,y+1); |
544 | top=right=true; | 544 | top=right=true; |
545 | } else if ( !(l|bl|b) && (r&u) ) | 545 | } else if ( !(l|bl|b) && (r&u) ) |
546 | { | 546 | { |
547 | // lower outer diagonal "\" | 547 | // lower outer diagonal "\" |
548 | addToEdges(x+1,y+1,x,y); | 548 | addToEdges(x+1,y+1,x,y); |
549 | left=bottom=true; | 549 | left=bottom=true; |
550 | } else if ( !(r|br|b) && (l&u) ) | 550 | } else if ( !(r|br|b) && (l&u) ) |
551 | { | 551 | { |
552 | // lower outer diagonal "/" | 552 | // lower outer diagonal "/" |
553 | addToEdges(x+1,y,x,y+1); | 553 | addToEdges(x+1,y,x,y+1); |
554 | right=bottom=true; | 554 | right=bottom=true; |
555 | }/* else if (!(b) && (l&bl) ) | 555 | }/* else if (!(b) && (l&bl) ) |
556 | { | 556 | { |
557 | // upper inner diagonal "/" | 557 | // upper inner diagonal "/" |
558 | addToEdges(x+1,y+1,x,y+2); | 558 | addToEdges(x+1,y+1,x,y+2); |
559 | //bottom=true; | 559 | //bottom=true; |
560 | } else if ( !(b) && (r&br) ) | 560 | } else if ( !(b) && (r&br) ) |
561 | { | 561 | { |
562 | // upper inner diagonal "\" | 562 | // upper inner diagonal "\" |
563 | addToEdges(x+1,y+2,x,y+1); | 563 | addToEdges(x+1,y+2,x,y+1); |
564 | //bottom=true; | 564 | //bottom=true; |
565 | } else if ( !(r) && (b&br) ) | 565 | } else if ( !(r) && (b&br) ) |
566 | { | 566 | { |
567 | // lower inner diagonal "\" | 567 | // lower inner diagonal "\" |
568 | addToEdges(x+1,y,x+2,y+1); | 568 | addToEdges(x+1,y,x+2,y+1); |
569 | //right=true; | 569 | //right=true; |
570 | } else if ( !(l) && (b&bl) ) | 570 | } else if ( !(l) && (b&bl) ) |
571 | { | 571 | { |
572 | // lower inner diagonal "/" | 572 | // lower inner diagonal "/" |
573 | addToEdges(x-1,y+1,x,y); | 573 | addToEdges(x-1,y+1,x,y); |
574 | //left=true; | 574 | //left=true; |
575 | }*/ | 575 | }*/ |
576 | 576 | ||
577 | // add flat edges | 577 | // add flat edges |
578 | if (!left /*&& !( (u&ul) || (b&bl)) */) addToEdges(x,y+1,x,y); | 578 | if (!left /*&& !( (u&ul) || (b&bl)) */) addToEdges(x,y+1,x,y); |
579 | if (!top /*&& !( (l&ul) || (r&ur)) */) addToEdges(x,y,x+1,y); | 579 | if (!top /*&& !( (l&ul) || (r&ur)) */) addToEdges(x,y,x+1,y); |
580 | if (!right /*&& !( (u&ur) || (b&br)) */) addToEdges(x+1,y,x+1,y+1); | 580 | if (!right /*&& !( (u&ur) || (b&br)) */) addToEdges(x+1,y,x+1,y+1); |
581 | if (!bottom /*&& !( (l&bl) || (r&br)) */) addToEdges(x+1,y+1,x,y+1); | 581 | if (!bottom /*&& !( (l&bl) || (r&br)) */) addToEdges(x+1,y+1,x,y+1); |
582 | } // lone square | 582 | } // lone square |
583 | } // for | 583 | } // for |
584 | 584 | ||
585 | // reduce the number of points in each edge | 585 | // reduce the number of points in each edge |
586 | for (u32 i=0; i<edges.size(); ++i) | 586 | for (u32 i=0; i<edges.size(); ++i) |
587 | { | 587 | { |
588 | edges[i].reduce(1); | 588 | edges[i].reduce(1); |
589 | 589 | ||
590 | // all edges should have at least 3 points | 590 | // all edges should have at least 3 points |
591 | assert(edges[i].positions.size() >= 3); | 591 | assert(edges[i].positions.size() >= 3); |
592 | 592 | ||
593 | // all edges should be closed | 593 | // all edges should be closed |
594 | assert(edges[i].positions[0] == edges[i].positions[edges[i].positions.size()-1] ); | 594 | assert(edges[i].positions[0] == edges[i].positions[edges[i].positions.size()-1] ); |
595 | } | 595 | } |
596 | } | 596 | } |
597 | 597 | ||
598 | // adds a line to the edges arrays | 598 | // adds a line to the edges arrays |
599 | void addToEdges(s32 x1, s32 y1, s32 x2, s32 y2) | 599 | void addToEdges(s32 x1, s32 y1, s32 x2, s32 y2) |
600 | { | 600 | { |
601 | bool found=false; | 601 | bool found=false; |
602 | // loop through each edge | 602 | // loop through each edge |
603 | for (u32 i=0; i<edges.size(); ++i) | 603 | for (u32 i=0; i<edges.size(); ++i) |
604 | { | 604 | { |
605 | // if this line starts at the end of an edge | 605 | // if this line starts at the end of an edge |
606 | if ( edges[i].positions[edges[i].positions.size()-1] == core::position2di(x1,y1)) | 606 | if ( edges[i].positions[edges[i].positions.size()-1] == core::position2di(x1,y1)) |
607 | { | 607 | { |
608 | // add it to the end | 608 | // add it to the end |
609 | edges[i].positions.push_back(core::position2di(x2,y2)); | 609 | edges[i].positions.push_back(core::position2di(x2,y2)); |
610 | found=true; | 610 | found=true; |
611 | break; | 611 | break; |
612 | } | 612 | } |
613 | // if the line ends at the start of the edge | 613 | // if the line ends at the start of the edge |
614 | if ( edges[i].positions[0]== core::position2di(x2,y2)) | 614 | if ( edges[i].positions[0]== core::position2di(x2,y2)) |
615 | { | 615 | { |
616 | // add it to the front | 616 | // add it to the front |
617 | edges[i].positions.push_front(core::position2di(x1,y1)); | 617 | edges[i].positions.push_front(core::position2di(x1,y1)); |
618 | found=true; | 618 | found=true; |
619 | break; | 619 | break; |
620 | } | 620 | } |
621 | } | 621 | } |
622 | if (!found) | 622 | if (!found) |
623 | { | 623 | { |
624 | // we make a new edge | 624 | // we make a new edge |
625 | SEdge n; | 625 | SEdge n; |
626 | n.positions.push_back(core::position2di(x1,y1)); | 626 | n.positions.push_back(core::position2di(x1,y1)); |
627 | n.positions.push_back(core::position2di(x2,y2)); | 627 | n.positions.push_back(core::position2di(x2,y2)); |
628 | edges.push_back(n); | 628 | edges.push_back(n); |
629 | } | 629 | } |
630 | 630 | ||
631 | joinEdges(); | 631 | joinEdges(); |
632 | } | 632 | } |
633 | 633 | ||
634 | void joinEdges() | 634 | void joinEdges() |
635 | { | 635 | { |
636 | // touching edges are joined | 636 | // touching edges are joined |
637 | 637 | ||
638 | for (u32 i=0; i < edges.size(); ++i) | 638 | for (u32 i=0; i < edges.size(); ++i) |
639 | for (u32 j=0; j < edges.size(); ++j) | 639 | for (u32 j=0; j < edges.size(); ++j) |
640 | { | 640 | { |
641 | if (i != j && edges[j].positions.size() && edges[i].positions.size()) | 641 | if (i != j && edges[j].positions.size() && edges[i].positions.size()) |
642 | { | 642 | { |
643 | if (edges[j].positions[0] == edges[i].positions[edges[i].positions.size()-1]) | 643 | if (edges[j].positions[0] == edges[i].positions[edges[i].positions.size()-1]) |
644 | { | 644 | { |
645 | for (u32 k=0; k < edges[j].positions.size(); ++k) | 645 | for (u32 k=0; k < edges[j].positions.size(); ++k) |
646 | edges[i].positions.push_back(edges[j].positions[k]); | 646 | edges[i].positions.push_back(edges[j].positions[k]); |
647 | edges[j].positions.clear(); | 647 | edges[j].positions.clear(); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | } | 650 | } |
651 | 651 | ||
652 | // remove empty edges | 652 | // remove empty edges |
653 | for (u32 i=0; i<edges.size(); ++i) | 653 | for (u32 i=0; i<edges.size(); ++i) |
654 | if (edges[i].positions.size() == 0) | 654 | if (edges[i].positions.size() == 0) |
655 | edges.erase(i--); | 655 | edges.erase(i--); |
656 | } | 656 | } |
657 | 657 | ||
658 | // tells if this x,y position is a member of this group | 658 | // tells if this x,y position is a member of this group |
659 | bool isMember(s32 x, s32 y) | 659 | bool isMember(s32 x, s32 y) |
660 | { | 660 | { |
661 | //for (u32 i=0; i<pixels.size(); ++i) | 661 | //for (u32 i=0; i<pixels.size(); ++i) |
662 | // if (pixels[i].X == x && pixels[i].Y == y) | 662 | // if (pixels[i].X == x && pixels[i].Y == y) |
663 | // return true; | 663 | // return true; |
664 | if (x>pixelWidth || y>pixelHeight || x<0 || y<0) | 664 | if (x>pixelWidth || y>pixelHeight || x<0 || y<0) |
665 | return false; | 665 | return false; |
666 | else | 666 | else |
667 | return isMemberCache[pixelWidth*y + x]; | 667 | return isMemberCache[pixelWidth*y + x]; |
668 | } | 668 | } |
669 | 669 | ||
670 | void refreshIsMemberCache() | 670 | void refreshIsMemberCache() |
671 | { | 671 | { |
672 | isMemberCache.clear(); | 672 | isMemberCache.clear(); |
673 | pixelWidth=0; pixelHeight=0; | 673 | pixelWidth=0; pixelHeight=0; |
674 | for (u32 i=0; i<pixels.size(); ++i) | 674 | for (u32 i=0; i<pixels.size(); ++i) |
675 | { | 675 | { |
676 | if (pixels[i].X>pixelWidth) pixelWidth=pixels[i].X; | 676 | if (pixels[i].X>pixelWidth) pixelWidth=pixels[i].X; |
677 | if (pixels[i].Y>pixelHeight) pixelHeight=pixels[i].Y; | 677 | if (pixels[i].Y>pixelHeight) pixelHeight=pixels[i].Y; |
678 | } | 678 | } |
679 | pixelWidth+=2; pixelHeight+=2; | 679 | pixelWidth+=2; pixelHeight+=2; |
680 | isMemberCache.set_used(pixelWidth*pixelHeight+1); | 680 | isMemberCache.set_used(pixelWidth*pixelHeight+1); |
681 | for (u32 i=0; i<isMemberCache.size(); ++i) | 681 | for (u32 i=0; i<isMemberCache.size(); ++i) |
682 | isMemberCache[i] = false; | 682 | isMemberCache[i] = false; |
683 | for (u32 i=0; i<pixels.size(); ++i) | 683 | for (u32 i=0; i<pixels.size(); ++i) |
684 | isMemberCache[pixelWidth*pixels[i].Y + pixels[i].X] = true; | 684 | isMemberCache[pixelWidth*pixels[i].Y + pixels[i].X] = true; |
685 | } | 685 | } |
686 | }; | 686 | }; |
687 | 687 | ||
688 | 688 | ||
689 | void drawEdges(IrrlichtDevice *device, u32 t, s32 scale) | 689 | void drawEdges(IrrlichtDevice *device, u32 t, s32 scale) |
690 | { | 690 | { |
691 | const u32 stt = device->getTimer()->getTime(); | 691 | const u32 stt = device->getTimer()->getTime(); |
692 | const u32 endt = stt + t; | 692 | const u32 endt = stt + t; |
693 | 693 | ||
694 | while(device->getTimer()->getTime() < endt ) | 694 | while(device->getTimer()->getTime() < endt ) |
695 | { | 695 | { |
696 | const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f; | 696 | const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f; |
697 | 697 | ||
698 | device->run(); | 698 | device->run(); |
699 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); | 699 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); |
700 | for (u32 g=0;g<groups.size(); ++g) | 700 | for (u32 g=0;g<groups.size(); ++g) |
701 | for (u32 v=0;v<groups[g].edges.size(); ++v) | 701 | for (u32 v=0;v<groups[g].edges.size(); ++v) |
702 | for (u32 p=1;p<groups[g].edges[v].positions.size(); ++p) | 702 | for (u32 p=1;p<groups[g].edges[v].positions.size(); ++p) |
703 | { | 703 | { |
704 | core::position2di st = core::position2di(groups[g].edges[v].positions[p-1].X*scale+50, groups[g].edges[v].positions[p-1].Y*scale+50) ; | 704 | core::position2di st = core::position2di(groups[g].edges[v].positions[p-1].X*scale+50, groups[g].edges[v].positions[p-1].Y*scale+50) ; |
705 | core::position2di en = core::position2di(groups[g].edges[v].positions[p].X*scale+50, groups[g].edges[v].positions[p].Y*scale+50) ; | 705 | core::position2di en = core::position2di(groups[g].edges[v].positions[p].X*scale+50, groups[g].edges[v].positions[p].Y*scale+50) ; |
706 | core::position2di ep = en-st; | 706 | core::position2di ep = en-st; |
707 | ep = st + core::position2di((s32)(ep.X*phase), (s32)(ep.Y*phase)); | 707 | ep = st + core::position2di((s32)(ep.X*phase), (s32)(ep.Y*phase)); |
708 | device->getVideoDriver()->draw2DLine(st,en); | 708 | device->getVideoDriver()->draw2DLine(st,en); |
709 | device->getVideoDriver()->draw2DLine(st,ep,video::SColor(255,255,0,0) ); | 709 | device->getVideoDriver()->draw2DLine(st,ep,video::SColor(255,255,0,0) ); |
710 | } | 710 | } |
711 | device->getVideoDriver()->endScene(); | 711 | device->getVideoDriver()->endScene(); |
712 | } | 712 | } |
713 | } | 713 | } |
714 | 714 | ||
715 | void drawTriangles(IrrlichtDevice *device, u32 t, s32 scale) | 715 | void drawTriangles(IrrlichtDevice *device, u32 t, s32 scale) |
716 | { | 716 | { |
717 | const u32 stt = device->getTimer()->getTime(); | 717 | const u32 stt = device->getTimer()->getTime(); |
718 | const u32 endt = stt + t; | 718 | const u32 endt = stt + t; |
719 | 719 | ||
720 | while(device->getTimer()->getTime() < endt ) | 720 | while(device->getTimer()->getTime() < endt ) |
721 | { | 721 | { |
722 | const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f; | 722 | const f32 phase = f32((device->getTimer()->getTime()-stt) % 500) / 500.0f; |
723 | 723 | ||
724 | device->run(); | 724 | device->run(); |
725 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); | 725 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); |
726 | for (u32 g=0;g<groups.size(); ++g) | 726 | for (u32 g=0;g<groups.size(); ++g) |
727 | for (u32 v=0;v<groups[g].triangles.indexes.size()*phase; v+=3) | 727 | for (u32 v=0;v<groups[g].triangles.indexes.size()*phase; v+=3) |
728 | { | 728 | { |
729 | STriangleList &t = groups[g].triangles; | 729 | STriangleList &t = groups[g].triangles; |
730 | core::position2di st((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50); | 730 | core::position2di st((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50); |
731 | core::position2di en((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50); | 731 | core::position2di en((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50); |
732 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); | 732 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); |
733 | st = core::position2di((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50); | 733 | st = core::position2di((s32)(t.positions[t.indexes[v+1]].X*scale)+50,(s32)(t.positions[t.indexes[v+1]].Y*scale)+50); |
734 | en = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50); | 734 | en = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50); |
735 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,255,0)); | 735 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,255,0)); |
736 | st = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50); | 736 | st = core::position2di((s32)(t.positions[t.indexes[v+2]].X*scale)+50,(s32)(t.positions[t.indexes[v+2]].Y*scale)+50); |
737 | en = core::position2di((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50); | 737 | en = core::position2di((s32)(t.positions[t.indexes[v+0]].X*scale)+50,(s32)(t.positions[t.indexes[v+0]].Y*scale)+50); |
738 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,0,255)); | 738 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,0,0,255)); |
739 | } | 739 | } |
740 | device->getVideoDriver()->endScene(); | 740 | device->getVideoDriver()->endScene(); |
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | void drawTriLines(IrrlichtDevice *device, u32 t, s32 scale) | 744 | void drawTriLines(IrrlichtDevice *device, u32 t, s32 scale) |
745 | { | 745 | { |
746 | const u32 endt = device->getTimer()->getTime() + t; | 746 | const u32 endt = device->getTimer()->getTime() + t; |
747 | 747 | ||
748 | while(device->getTimer()->getTime() < endt ) | 748 | while(device->getTimer()->getTime() < endt ) |
749 | { | 749 | { |
750 | device->run(); | 750 | device->run(); |
751 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); | 751 | device->getVideoDriver()->beginScene(true,true,video::SColor(0,0,0,0)); |
752 | for (u32 g=0;g<groups.size(); ++g) | 752 | for (u32 g=0;g<groups.size(); ++g) |
753 | for (u32 v=0;v<groups[g].ll.size()-1; ++v) | 753 | for (u32 v=0;v<groups[g].ll.size()-1; ++v) |
754 | for (u32 h=0;h<groups[g].ll[v].lines.size(); ++h) | 754 | for (u32 h=0;h<groups[g].ll[v].lines.size(); ++h) |
755 | { | 755 | { |
756 | core::line2df ¤tline = groups[g].ll[v].lines[h]; | 756 | core::line2df ¤tline = groups[g].ll[v].lines[h]; |
757 | const core::position2di st((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50); | 757 | const core::position2di st((s32)(currentline.start.X*scale)+50, (s32)(currentline.start.Y*scale)+50); |
758 | const core::position2di en((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50); | 758 | const core::position2di en((s32)(currentline.end.X*scale)+50, (s32)(currentline.end.Y*scale)+50); |
759 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); | 759 | device->getVideoDriver()->draw2DLine(st,en, SColor(255,255,0,0)); |
760 | } | 760 | } |
761 | 761 | ||
762 | device->getVideoDriver()->endScene(); | 762 | device->getVideoDriver()->endScene(); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | void drawTri3D(IrrlichtDevice *device, u32 t) | 765 | void drawTri3D(IrrlichtDevice *device, u32 t) |
766 | { | 766 | { |
767 | for (u32 g=0;g<groups.size(); ++g) | 767 | for (u32 g=0;g<groups.size(); ++g) |
768 | { | 768 | { |
769 | STriangleList &t = groups[g].triangles; | 769 | STriangleList &t = groups[g].triangles; |
770 | core::array<S3DVertex> verts; | 770 | core::array<S3DVertex> verts; |
771 | verts.clear(); | 771 | verts.clear(); |
772 | for(u32 v=0; v< t.positions.size(); ++v) | 772 | for(u32 v=0; v< t.positions.size(); ++v) |
773 | { | 773 | { |
774 | verts.push_back(S3DVertex( | 774 | verts.push_back(S3DVertex( |
775 | -t.positions[v].X, -t.positions[v].Y, -100, | 775 | -t.positions[v].X, -t.positions[v].Y, -100, |
776 | 0,0,1,SColor(255,255,255,255),0,0)); | 776 | 0,0,1,SColor(255,255,255,255),0,0)); |
777 | } | 777 | } |
778 | 778 | ||
779 | device->getVideoDriver()->drawIndexedTriangleList(verts.pointer(),verts.size(),t.indexes.pointer(), t.indexes.size()/3 ); | 779 | device->getVideoDriver()->drawIndexedTriangleList(verts.pointer(),verts.size(),t.indexes.pointer(), t.indexes.size()/3 ); |
780 | } | 780 | } |
781 | } | 781 | } |
782 | 782 | ||
783 | 783 | ||
784 | // process all pixels | 784 | // process all pixels |
785 | void findGroups() | 785 | void findGroups() |
786 | { | 786 | { |
787 | for (int y=0; y<height; ++y) | 787 | for (int y=0; y<height; ++y) |
788 | for (int x=0; x<width; ++x) | 788 | for (int x=0; x<width; ++x) |
789 | processPixel(x,y); | 789 | processPixel(x,y); |
790 | 790 | ||
791 | } | 791 | } |
792 | 792 | ||
793 | // remove groups with no pixels | 793 | // remove groups with no pixels |
794 | void removeGroups() | 794 | void removeGroups() |
795 | { | 795 | { |
796 | for (u32 i=0; i<groups.size(); ++i) | 796 | for (u32 i=0; i<groups.size(); ++i) |
797 | if (groups[i].pixels.size() == 0) | 797 | if (groups[i].pixels.size() == 0) |
798 | groups.erase(i--); | 798 | groups.erase(i--); |
799 | 799 | ||
800 | /*for (s32 y=0; y <height; ++y) | 800 | /*for (s32 y=0; y <height; ++y) |
801 | { | 801 | { |
802 | printf("\n"); | 802 | printf("\n"); |
803 | for (s32 x=0; x <width; ++x) | 803 | for (s32 x=0; x <width; ++x) |
804 | { | 804 | { |
805 | s32 i; | 805 | s32 i; |
806 | for (i=0; i<groups.size(); ++i) | 806 | for (i=0; i<groups.size(); ++i) |
807 | { | 807 | { |
808 | bool k = groups[i].isMember(x,y); | 808 | bool k = groups[i].isMember(x,y); |
809 | if (k) | 809 | if (k) |
810 | break; | 810 | break; |
811 | } | 811 | } |
812 | printf("%d",i); | 812 | printf("%d",i); |
813 | } | 813 | } |
814 | }*/ | 814 | }*/ |
815 | 815 | ||
816 | 816 | ||
817 | } | 817 | } |
818 | 818 | ||
819 | // adds a pixel to its area, merging touching areas | 819 | // adds a pixel to its area, merging touching areas |
820 | void processPixel(s32 x, s32 y) | 820 | void processPixel(s32 x, s32 y) |
821 | { | 821 | { |
822 | // solid? | 822 | // solid? |
823 | if (getPixel(x,y)) | 823 | if (getPixel(x,y)) |
824 | { | 824 | { |
825 | s32 g=0, grp=0; | 825 | s32 g=0, grp=0; |
826 | 826 | ||
827 | bool found=false; | 827 | bool found=false; |
828 | if (x>0) // look one behind | 828 | if (x>0) // look one behind |
829 | { | 829 | { |
830 | grp = getRef(x-1,y); | 830 | grp = getRef(x-1,y); |
831 | if (grp) found=true; | 831 | if (grp) found=true; |
832 | } | 832 | } |
833 | if (y>0) // look above | 833 | if (y>0) // look above |
834 | { | 834 | { |
835 | if (x>0) // top left | 835 | if (x>0) // top left |
836 | { | 836 | { |
837 | g = getRef(x-1,y-1); | 837 | g = getRef(x-1,y-1); |
838 | 838 | ||
839 | if (g) | 839 | if (g) |
840 | { | 840 | { |
841 | if (found) | 841 | if (found) |
842 | { | 842 | { |
843 | mergeGroups(grp, g); | 843 | mergeGroups(grp, g); |
844 | } | 844 | } |
845 | else | 845 | else |
846 | { | 846 | { |
847 | grp = g; | 847 | grp = g; |
848 | found = true; | 848 | found = true; |
849 | } | 849 | } |
850 | } | 850 | } |
851 | } | 851 | } |
852 | 852 | ||
853 | if (x<width-1) // top right | 853 | if (x<width-1) // top right |
854 | { | 854 | { |
855 | g = getRef(x+1,y-1); | 855 | g = getRef(x+1,y-1); |
856 | 856 | ||
857 | if (g) | 857 | if (g) |
858 | { | 858 | { |
859 | if (found) | 859 | if (found) |
860 | { | 860 | { |
861 | mergeGroups(grp, g); | 861 | mergeGroups(grp, g); |
862 | } | 862 | } |
863 | else | 863 | else |
864 | { | 864 | { |
865 | grp = g; | 865 | grp = g; |
866 | found = true; | 866 | found = true; |
867 | } | 867 | } |
868 | } | 868 | } |
869 | } | 869 | } |
870 | 870 | ||
871 | // top | 871 | // top |
872 | 872 | ||
873 | g = getRef(x,y-1); | 873 | g = getRef(x,y-1); |
874 | 874 | ||
875 | if (g) | 875 | if (g) |
876 | { | 876 | { |
877 | if (found) | 877 | if (found) |
878 | { | 878 | { |
879 | mergeGroups(grp, g); | 879 | mergeGroups(grp, g); |
880 | } | 880 | } |
881 | else | 881 | else |
882 | { | 882 | { |
883 | grp = g; | 883 | grp = g; |
884 | found = true; | 884 | found = true; |
885 | } | 885 | } |
886 | } | 886 | } |
887 | 887 | ||
888 | } | 888 | } |
889 | 889 | ||
890 | // didn't find a group for this pixel, so we add one | 890 | // didn't find a group for this pixel, so we add one |
891 | if (!found) | 891 | if (!found) |
892 | { | 892 | { |
893 | SPixelGroup p(Device); | 893 | SPixelGroup p(Device); |
894 | p.pixels.push_back(core::position2di(x,y)); | 894 | p.pixels.push_back(core::position2di(x,y)); |
895 | groups.push_back(p); | 895 | groups.push_back(p); |
896 | groupRefs.push_back(groups.size()); | 896 | groupRefs.push_back(groups.size()); |
897 | grp=groups.size(); | 897 | grp=groups.size(); |
898 | } | 898 | } |
899 | else | 899 | else |
900 | { | 900 | { |
901 | groups[groupRefs[grp-1]-1].pixels.push_back(core::position2di(x,y)); | 901 | groups[groupRefs[grp-1]-1].pixels.push_back(core::position2di(x,y)); |
902 | } | 902 | } |
903 | setRef(x,y,groupRefs[grp-1]); | 903 | setRef(x,y,groupRefs[grp-1]); |
904 | } | 904 | } |
905 | } | 905 | } |
906 | 906 | ||
907 | bool& getPixel(s32 x, s32 y) { return mem[y*width +x]; } | 907 | bool& getPixel(s32 x, s32 y) { return mem[y*width +x]; } |
908 | s32& getRef(s32 x, s32 y) { return refbuffer[y*width +x]; } | 908 | s32& getRef(s32 x, s32 y) { return refbuffer[y*width +x]; } |
909 | void setRef(s32 x, s32 y, s32 g) { refbuffer[y*width +x] = g; } | 909 | void setRef(s32 x, s32 y, s32 g) { refbuffer[y*width +x] = g; } |
910 | 910 | ||
911 | void mergeGroups(s32 g1, s32 g2) | 911 | void mergeGroups(s32 g1, s32 g2) |
912 | { | 912 | { |
913 | if (g1==g2) | 913 | if (g1==g2) |
914 | return; | 914 | return; |
915 | // joins two groups together | 915 | // joins two groups together |
916 | for (u32 i=0; i<groups[g2-1].pixels.size(); ++i) | 916 | for (u32 i=0; i<groups[g2-1].pixels.size(); ++i) |
917 | groups[g1-1].pixels.push_back(groups[g2-1].pixels[i]); | 917 | groups[g1-1].pixels.push_back(groups[g2-1].pixels[i]); |
918 | groups[g2-1].pixels.clear(); | 918 | groups[g2-1].pixels.clear(); |
919 | groupRefs[g2-1] = g1; | 919 | groupRefs[g2-1] = g1; |
920 | } | 920 | } |
921 | 921 | ||
922 | s32 width, height; | 922 | s32 width, height; |
923 | core::array<SPixelGroup> groups; | 923 | core::array<SPixelGroup> groups; |
924 | core::array<s32> groupRefs; | 924 | core::array<s32> groupRefs; |
925 | core::array<s32> refbuffer; | 925 | core::array<s32> refbuffer; |
926 | bool *mem; | 926 | bool *mem; |
927 | IrrlichtDevice *Device; | 927 | IrrlichtDevice *Device; |
928 | }; | 928 | }; |
929 | 929 | ||
930 | // creates a simple vector font from a bitmap from the font tool | 930 | // creates a simple vector font from a bitmap from the font tool |
931 | class CVectorFontTool | 931 | class CVectorFontTool |
932 | { | 932 | { |
933 | public: | 933 | public: |
934 | CVectorFontTool(CFontTool *fonttool) : | 934 | CVectorFontTool(CFontTool *fonttool) : |
935 | triangulator(0), FontTool(fonttool), | 935 | triangulator(0), FontTool(fonttool), |
936 | letterHeight(0), letterWidth(0), triangles() | 936 | letterHeight(0), letterWidth(0), triangles() |
937 | { | 937 | { |
938 | core::map<wchar_t, u32>::Iterator it = FontTool->CharMap.getIterator(); | 938 | core::map<wchar_t, u32>::Iterator it = FontTool->CharMap.getIterator(); |
939 | 939 | ||
940 | while(!it.atEnd()) | 940 | while(!it.atEnd()) |
941 | { | 941 | { |
942 | CFontTool::SFontArea &fa = FontTool->Areas[(*it).getValue()]; | 942 | CFontTool::SFontArea &fa = FontTool->Areas[(*it).getValue()]; |
943 | 943 | ||
944 | if (fa.rectangle.getWidth() > letterWidth) | 944 | if (fa.rectangle.getWidth() > letterWidth) |
945 | letterWidth = fa.rectangle.getWidth(); | 945 | letterWidth = fa.rectangle.getWidth(); |
946 | if (fa.rectangle.getHeight() > letterHeight) | 946 | if (fa.rectangle.getHeight() > letterHeight) |
947 | letterHeight = fa.rectangle.getHeight(); | 947 | letterHeight = fa.rectangle.getHeight(); |
948 | 948 | ||
949 | it++; | 949 | it++; |
950 | } | 950 | } |
951 | 951 | ||
952 | // number of verts is one more than number of pixels because it's a grid of squares | 952 | // number of verts is one more than number of pixels because it's a grid of squares |
953 | letterWidth++; | 953 | letterWidth++; |
954 | letterHeight++; | 954 | letterHeight++; |
955 | 955 | ||
956 | // create image memory | 956 | // create image memory |
957 | imagedata.set_used(letterWidth*letterHeight); | 957 | imagedata.set_used(letterWidth*letterHeight); |
958 | 958 | ||
959 | // create vertex list, set position etc | 959 | // create vertex list, set position etc |
960 | verts.set_used(letterWidth*letterHeight); | 960 | verts.set_used(letterWidth*letterHeight); |
961 | for (s32 y=0; y<letterHeight; ++y) | 961 | for (s32 y=0; y<letterHeight; ++y) |
962 | { | 962 | { |
963 | for (s32 x=0; x<letterWidth; ++x) | 963 | for (s32 x=0; x<letterWidth; ++x) |
964 | { | 964 | { |
965 | S3DVertex &v = getVert(x,y); | 965 | S3DVertex &v = getVert(x,y); |
966 | v.Pos = core::vector3df((f32)x,(f32)y,0.0f); | 966 | v.Pos = core::vector3df((f32)x,(f32)y,0.0f); |
967 | v.TCoords.X = (f32)letterWidth / (f32)x; | 967 | v.TCoords.X = (f32)letterWidth / (f32)x; |
968 | v.TCoords.Y = (f32)letterHeight / (f32)y; | 968 | v.TCoords.Y = (f32)letterHeight / (f32)y; |
969 | v.Normal = core::vector3df(0,0,-1); | 969 | v.Normal = core::vector3df(0,0,-1); |
970 | v.Color = SColor(255,255,255,255); | 970 | v.Color = SColor(255,255,255,255); |
971 | } | 971 | } |
972 | } | 972 | } |
973 | // clear index list | 973 | // clear index list |
974 | inds.clear(); | 974 | inds.clear(); |
975 | 975 | ||
976 | // create each char in the font... | 976 | // create each char in the font... |
977 | it = FontTool->CharMap.getIterator(); | 977 | it = FontTool->CharMap.getIterator(); |
978 | while(!it.atEnd()) | 978 | while(!it.atEnd()) |
979 | { | 979 | { |
980 | addChar((*it).getKey()); | 980 | addChar((*it).getKey()); |
981 | it++; | 981 | it++; |
982 | } | 982 | } |
983 | } | 983 | } |
984 | 984 | ||
985 | ~CVectorFontTool() | 985 | ~CVectorFontTool() |
986 | { | 986 | { |
987 | if (triangulator) | 987 | if (triangulator) |
988 | delete triangulator; | 988 | delete triangulator; |
989 | } | 989 | } |
990 | 990 | ||
991 | void addChar(wchar_t thischar) | 991 | void addChar(wchar_t thischar) |
992 | { | 992 | { |
993 | const s32 area = FontTool->CharMap[thischar]; | 993 | const s32 area = FontTool->CharMap[thischar]; |
994 | const CFontTool::SFontArea &fa = FontTool->Areas[area]; | 994 | const CFontTool::SFontArea &fa = FontTool->Areas[area]; |
995 | 995 | ||
996 | const s32 img = fa.sourceimage; | 996 | const s32 img = fa.sourceimage; |
997 | const core::rect<s32>& r = fa.rectangle; | 997 | const core::rect<s32>& r = fa.rectangle; |
998 | 998 | ||
999 | // init image memory | 999 | // init image memory |
1000 | IImage *image = FontTool->currentImages[img]; | 1000 | IImage *image = FontTool->currentImages[img]; |
1001 | for (u32 i=0; i < imagedata.size(); ++i) | 1001 | for (u32 i=0; i < imagedata.size(); ++i) |
1002 | imagedata[i] = false; | 1002 | imagedata[i] = false; |
1003 | for (s32 y=r.UpperLeftCorner.Y; y < r.LowerRightCorner.Y; ++y) | 1003 | for (s32 y=r.UpperLeftCorner.Y; y < r.LowerRightCorner.Y; ++y) |
1004 | { | 1004 | { |
1005 | for (s32 x=r.UpperLeftCorner.X; x < r.LowerRightCorner.X ; ++x) | 1005 | for (s32 x=r.UpperLeftCorner.X; x < r.LowerRightCorner.X ; ++x) |
1006 | if (image->getPixel(x,y).getBlue() > 0) | 1006 | if (image->getPixel(x,y).getBlue() > 0) |
1007 | { | 1007 | { |
1008 | imagedata[letterWidth*(y-r.UpperLeftCorner.Y) +(x-r.UpperLeftCorner.X)] = true; | 1008 | imagedata[letterWidth*(y-r.UpperLeftCorner.Y) +(x-r.UpperLeftCorner.X)] = true; |
1009 | } | 1009 | } |
1010 | } | 1010 | } |
1011 | 1011 | ||
1012 | // get shape areas | 1012 | // get shape areas |
1013 | triangulator = new CGroupFinder(imagedata.pointer(), letterWidth, letterHeight, FontTool->Device ); | 1013 | triangulator = new CGroupFinder(imagedata.pointer(), letterWidth, letterHeight, FontTool->Device ); |
1014 | 1014 | ||
1015 | wprintf(L"Created character '%c' in texture %d\n", thischar, img ); | 1015 | wprintf(L"Created character '%c' in texture %d\n", thischar, img ); |
1016 | 1016 | ||
1017 | //floodfill->drawEdges(FontTool->Device, 500, 3); | 1017 | //floodfill->drawEdges(FontTool->Device, 500, 3); |
1018 | //floodfill->drawTriangles(FontTool->Device, 500,30); | 1018 | //floodfill->drawTriangles(FontTool->Device, 500,30); |
1019 | //floodfill->drawTriLines(FontTool->Device, 200,3); | 1019 | //floodfill->drawTriLines(FontTool->Device, 200,3); |
1020 | 1020 | ||
1021 | /* | 1021 | /* |
1022 | if (area==32 && map == 0) | 1022 | if (area==32 && map == 0) |
1023 | { | 1023 | { |
1024 | scene::ISceneManager *smgr = FontTool->Device->getSceneManager(); | 1024 | scene::ISceneManager *smgr = FontTool->Device->getSceneManager(); |
1025 | smgr->addCameraSceneNodeFPS(); | 1025 | smgr->addCameraSceneNodeFPS(); |
1026 | while(FontTool->Device->run()) | 1026 | while(FontTool->Device->run()) |
1027 | { | 1027 | { |
1028 | //floodfill->drawEdges(FontTool->Device, 100, 30); | 1028 | //floodfill->drawEdges(FontTool->Device, 100, 30); |
1029 | FontTool->Device->getVideoDriver()->beginScene(true, true, video::SColor(0,200,200,200)); | 1029 | FontTool->Device->getVideoDriver()->beginScene(true, true, video::SColor(0,200,200,200)); |
1030 | smgr->drawAll(); | 1030 | smgr->drawAll(); |
1031 | floodfill->drawTri3D(FontTool->Device, 100); | 1031 | floodfill->drawTri3D(FontTool->Device, 100); |
1032 | FontTool->Device->getVideoDriver()->endScene(); | 1032 | FontTool->Device->getVideoDriver()->endScene(); |
1033 | } | 1033 | } |
1034 | }*/ | 1034 | }*/ |
1035 | 1035 | ||
1036 | u32 lastind = triangles.indexes.size(); | 1036 | u32 lastind = triangles.indexes.size(); |
1037 | 1037 | ||
1038 | // loop through each shape and add it to the current character... | 1038 | // loop through each shape and add it to the current character... |
1039 | for (u32 i=0; i < triangulator->groups.size(); ++i) | 1039 | for (u32 i=0; i < triangulator->groups.size(); ++i) |
1040 | triangles += triangulator->groups[i].triangles; | 1040 | triangles += triangulator->groups[i].triangles; |
1041 | 1041 | ||
1042 | // add character details | 1042 | // add character details |
1043 | charstarts.push_back(lastind); | 1043 | charstarts.push_back(lastind); |
1044 | charlengths.push_back(triangles.indexes.size() - lastind); | 1044 | charlengths.push_back(triangles.indexes.size() - lastind); |
1045 | chars.push_back(thischar); | 1045 | chars.push_back(thischar); |
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | bool saveVectorFont(const c8 *filename, const c8 *formatname) | 1048 | bool saveVectorFont(const c8 *filename, const c8 *formatname) |
1049 | { | 1049 | { |
1050 | IrrlichtDevice *Device = FontTool->Device; | 1050 | IrrlichtDevice *Device = FontTool->Device; |
1051 | 1051 | ||
1052 | if (triangles.indexes.size() == 0) | 1052 | if (triangles.indexes.size() == 0) |
1053 | { | 1053 | { |
1054 | Device->getLogger()->log("No vector data to write, aborting."); | 1054 | Device->getLogger()->log("No vector data to write, aborting."); |
1055 | return false; | 1055 | return false; |
1056 | } | 1056 | } |
1057 | 1057 | ||
1058 | core::stringc fn = filename; | 1058 | core::stringc fn = filename; |
1059 | 1059 | ||
1060 | if (core::stringc(formatname) == core::stringc("xml")) | 1060 | if (core::stringc(formatname) == core::stringc("xml")) |
1061 | { | 1061 | { |
1062 | fn += ".xml"; | 1062 | fn += ".xml"; |
1063 | io::IXMLWriter *writer = FontTool->Device->getFileSystem()->createXMLWriter(fn.c_str()); | 1063 | io::IXMLWriter *writer = FontTool->Device->getFileSystem()->createXMLWriter(fn.c_str()); |
1064 | 1064 | ||
1065 | // header and line breaks | 1065 | // header and line breaks |
1066 | writer->writeXMLHeader(); | 1066 | writer->writeXMLHeader(); |
1067 | writer->writeLineBreak(); | 1067 | writer->writeLineBreak(); |
1068 | 1068 | ||
1069 | // write info header | 1069 | // write info header |
1070 | writer->writeElement(L"font", false, L"type", L"vector"); | 1070 | writer->writeElement(L"font", false, L"type", L"vector"); |
1071 | writer->writeLineBreak(); | 1071 | writer->writeLineBreak(); |
1072 | writer->writeLineBreak(); | 1072 | writer->writeLineBreak(); |
1073 | 1073 | ||
1074 | // write each letter | 1074 | // write each letter |
1075 | 1075 | ||
1076 | for (u32 n=0; n<chars.size(); ++n) | 1076 | for (u32 n=0; n<chars.size(); ++n) |
1077 | { | 1077 | { |
1078 | u32 i = FontTool->CharMap[chars[n]]; | 1078 | u32 i = FontTool->CharMap[chars[n]]; |
1079 | CFontTool::SFontArea &fa = FontTool->Areas[i]; | 1079 | CFontTool::SFontArea &fa = FontTool->Areas[i]; |
1080 | wchar_t c[2]; | 1080 | wchar_t c[2]; |
1081 | c[0] = chars[n]; | 1081 | c[0] = chars[n]; |
1082 | c[1] = L'\0'; | 1082 | c[1] = L'\0'; |
1083 | core::stringw area, under, over; | 1083 | core::stringw area, under, over; |
1084 | area = core::stringw(fa.rectangle.LowerRightCorner.X- | 1084 | area = core::stringw(fa.rectangle.LowerRightCorner.X- |
1085 | fa.rectangle.UpperLeftCorner.X); | 1085 | fa.rectangle.UpperLeftCorner.X); |
1086 | area += L", "; | 1086 | area += L", "; |
1087 | area += fa.rectangle.LowerRightCorner.Y- | 1087 | area += fa.rectangle.LowerRightCorner.Y- |
1088 | fa.rectangle.UpperLeftCorner.Y; | 1088 | fa.rectangle.UpperLeftCorner.Y; |
1089 | 1089 | ||
1090 | 1090 | ||
1091 | core::array<core::stringw> names; | 1091 | core::array<core::stringw> names; |
1092 | core::array<core::stringw> values; | 1092 | core::array<core::stringw> values; |
1093 | names.clear(); | 1093 | names.clear(); |
1094 | values.clear(); | 1094 | values.clear(); |
1095 | // char | 1095 | // char |
1096 | names.push_back(core::stringw(L"c")); | 1096 | names.push_back(core::stringw(L"c")); |
1097 | values.push_back(core::stringw(c)); | 1097 | values.push_back(core::stringw(c)); |
1098 | 1098 | ||
1099 | // width+height | 1099 | // width+height |
1100 | names.push_back(core::stringw(L"wh")); | 1100 | names.push_back(core::stringw(L"wh")); |
1101 | values.push_back(area); | 1101 | values.push_back(area); |
1102 | 1102 | ||
1103 | // start | 1103 | // start |
1104 | names.push_back(core::stringw(L"st")); | 1104 | names.push_back(core::stringw(L"st")); |
1105 | values.push_back(core::stringw(charstarts[n])); | 1105 | values.push_back(core::stringw(charstarts[n])); |
1106 | // length | 1106 | // length |
1107 | names.push_back(core::stringw(L"len")); | 1107 | names.push_back(core::stringw(L"len")); |
1108 | values.push_back(core::stringw(charlengths[n])); | 1108 | values.push_back(core::stringw(charlengths[n])); |
1109 | 1109 | ||
1110 | if (fa.underhang != 0) | 1110 | if (fa.underhang != 0) |
1111 | { | 1111 | { |
1112 | under = core::stringw(fa.underhang); | 1112 | under = core::stringw(fa.underhang); |
1113 | names.push_back(core::stringw(L"u")); | 1113 | names.push_back(core::stringw(L"u")); |
1114 | values.push_back(under); | 1114 | values.push_back(under); |
1115 | } | 1115 | } |
1116 | if (fa.overhang != 0) | 1116 | if (fa.overhang != 0) |
1117 | { | 1117 | { |
1118 | over = core::stringw(fa.overhang); | 1118 | over = core::stringw(fa.overhang); |
1119 | names.push_back(core::stringw(L"o")); | 1119 | names.push_back(core::stringw(L"o")); |
1120 | values.push_back(over); | 1120 | values.push_back(over); |
1121 | } | 1121 | } |
1122 | writer->writeElement(L"c", true, names, values); | 1122 | writer->writeElement(L"c", true, names, values); |
1123 | 1123 | ||
1124 | writer->writeLineBreak(); | 1124 | writer->writeLineBreak(); |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | // write vertex data | 1127 | // write vertex data |
1128 | core::stringw data, count; | 1128 | core::stringw data, count; |
1129 | data = L""; | 1129 | data = L""; |
1130 | count = core::stringw(triangles.positions.size()); | 1130 | count = core::stringw(triangles.positions.size()); |
1131 | for (u32 i=0; i<triangles.positions.size(); ++i) | 1131 | for (u32 i=0; i<triangles.positions.size(); ++i) |
1132 | { | 1132 | { |
1133 | if (i!=0) | 1133 | if (i!=0) |
1134 | data += L", "; | 1134 | data += L", "; |
1135 | data += (s32)triangles.positions[i].X; | 1135 | data += (s32)triangles.positions[i].X; |
1136 | data += L","; | 1136 | data += L","; |
1137 | data += (s32)triangles.positions[i].Y; | 1137 | data += (s32)triangles.positions[i].Y; |
1138 | } | 1138 | } |
1139 | writer->writeElement(L"Vertices", true, L"count", count.c_str(), L"data", data.c_str()); | 1139 | writer->writeElement(L"Vertices", true, L"count", count.c_str(), L"data", data.c_str()); |
1140 | writer->writeLineBreak(); | 1140 | writer->writeLineBreak(); |
1141 | 1141 | ||
1142 | // write index list | 1142 | // write index list |
1143 | data = L""; | 1143 | data = L""; |
1144 | count = core::stringw(triangles.indexes.size()); | 1144 | count = core::stringw(triangles.indexes.size()); |
1145 | for (u32 i=0; i<triangles.indexes.size(); i+=3) | 1145 | for (u32 i=0; i<triangles.indexes.size(); i+=3) |
1146 | { | 1146 | { |
1147 | if (i!=0) | 1147 | if (i!=0) |
1148 | data += L", "; | 1148 | data += L", "; |
1149 | data += triangles.indexes[i+0]; | 1149 | data += triangles.indexes[i+0]; |
1150 | data += L","; | 1150 | data += L","; |
1151 | data += triangles.indexes[i+1], | 1151 | data += triangles.indexes[i+1], |
1152 | data += L","; | 1152 | data += L","; |
1153 | data += triangles.indexes[i+2]; | 1153 | data += triangles.indexes[i+2]; |
1154 | } | 1154 | } |
1155 | 1155 | ||
1156 | writer->writeElement(L"Indices", true, L"count", count.c_str(), L"data", data.c_str()); | 1156 | writer->writeElement(L"Indices", true, L"count", count.c_str(), L"data", data.c_str()); |
1157 | writer->writeLineBreak(); | 1157 | writer->writeLineBreak(); |
1158 | 1158 | ||
1159 | writer->writeClosingTag(L"font"); | 1159 | writer->writeClosingTag(L"font"); |
1160 | 1160 | ||
1161 | writer->drop(); | 1161 | writer->drop(); |
1162 | 1162 | ||
1163 | Device->getLogger()->log("Font saved."); | 1163 | Device->getLogger()->log("Font saved."); |
1164 | return true; | 1164 | return true; |
1165 | 1165 | ||
1166 | } | 1166 | } |
1167 | else if (core::stringc(formatname) == core::stringc("bin")) | 1167 | else if (core::stringc(formatname) == core::stringc("bin")) |
1168 | { | 1168 | { |
1169 | FontTool->Device->getLogger()->log("binary fonts not supported yet, sorry"); | 1169 | FontTool->Device->getLogger()->log("binary fonts not supported yet, sorry"); |
1170 | return false; | 1170 | return false; |
1171 | } | 1171 | } |
1172 | else | 1172 | else |
1173 | { | 1173 | { |
1174 | FontTool->Device->getLogger()->log("unsupported file format, unable to save vector font"); | 1174 | FontTool->Device->getLogger()->log("unsupported file format, unable to save vector font"); |
1175 | return false; | 1175 | return false; |
1176 | } | 1176 | } |
1177 | } | 1177 | } |
1178 | 1178 | ||
1179 | S3DVertex& getVert(s32 x, s32 y) { return verts[letterWidth*y +x]; } | 1179 | S3DVertex& getVert(s32 x, s32 y) { return verts[letterWidth*y +x]; } |
1180 | 1180 | ||
1181 | core::array<S3DVertex> verts; | 1181 | core::array<S3DVertex> verts; |
1182 | core::array<u16> inds; | 1182 | core::array<u16> inds; |
1183 | core::array<bool> imagedata; | 1183 | core::array<bool> imagedata; |
1184 | 1184 | ||
1185 | core::array<s32> charstarts; // start position of each char | 1185 | core::array<s32> charstarts; // start position of each char |
1186 | core::array<s32> charlengths; // index count | 1186 | core::array<s32> charlengths; // index count |
1187 | core::array<wchar_t> chars; // letters | 1187 | core::array<wchar_t> chars; // letters |
1188 | 1188 | ||
1189 | CGroupFinder* triangulator; | 1189 | CGroupFinder* triangulator; |
1190 | CFontTool* FontTool; | 1190 | CFontTool* FontTool; |
1191 | 1191 | ||
1192 | s32 letterHeight; | 1192 | s32 letterHeight; |
1193 | s32 letterWidth; | 1193 | s32 letterWidth; |
1194 | 1194 | ||
1195 | STriangleList triangles; | 1195 | STriangleList triangles; |
1196 | }; | 1196 | }; |
1197 | 1197 | ||
1198 | #endif // __VECTOR_FONT_TOOL_INCLUDED__ | 1198 | #endif // __VECTOR_FONT_TOOL_INCLUDED__ |
1199 | 1199 | ||
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/Makefile b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/Makefile index 7444e44..b3f2731 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/Makefile +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/Makefile | |||
@@ -1,38 +1,38 @@ | |||
1 | # Makefile for Irrlicht Examples | 1 | # Makefile for Irrlicht Examples |
2 | # It's usually sufficient to change just the target name and source file list | 2 | # It's usually sufficient to change just the target name and source file list |
3 | # and be sure that CXX is set to a valid compiler | 3 | # and be sure that CXX is set to a valid compiler |
4 | Target = FontTool | 4 | Target = FontTool |
5 | Sources = CFontTool.cpp main.cpp | 5 | Sources = CFontTool.cpp main.cpp |
6 | 6 | ||
7 | # general compiler settings | 7 | # general compiler settings |
8 | CPPFLAGS = -I../../../include -I/usr/X11R6/include -I/usr/include/freetype2/ | 8 | CPPFLAGS = -I../../../include -I/usr/X11R6/include -I/usr/include/freetype2/ |
9 | CXXFLAGS = -O3 -ffast-math | 9 | CXXFLAGS = -O3 -ffast-math |
10 | #CXXFLAGS = -g -Wall | 10 | #CXXFLAGS = -g -Wall |
11 | 11 | ||
12 | #default target is Linux | 12 | #default target is Linux |
13 | all: all_linux | 13 | all: all_linux |
14 | 14 | ||
15 | ifeq ($(HOSTTYPE), x86_64) | 15 | ifeq ($(HOSTTYPE), x86_64) |
16 | LIBSELECT=64 | 16 | LIBSELECT=64 |
17 | endif | 17 | endif |
18 | 18 | ||
19 | # target specific settings | 19 | # target specific settings |
20 | all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXft | 20 | all_linux: LDFLAGS = -L/usr/X11R6/lib$(LIBSELECT) -L../../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXft |
21 | all_linux clean_linux: SYSTEM=Linux | 21 | all_linux clean_linux: SYSTEM=Linux |
22 | all_win32: LDFLAGS = -L../../../lib/Win32-gcc -lIrrlicht -lgdi32 -lopengl32 -lglu32 -lm | 22 | all_win32: LDFLAGS = -L../../../lib/Win32-gcc -lIrrlicht -lgdi32 -lopengl32 -lglu32 -lm |
23 | all_win32 clean_win32: SYSTEM=Win32-gcc | 23 | all_win32 clean_win32: SYSTEM=Win32-gcc |
24 | all_win32 clean_win32: SUF=.exe | 24 | all_win32 clean_win32: SUF=.exe |
25 | # name of the binary - only valid for targets which set SYSTEM | 25 | # name of the binary - only valid for targets which set SYSTEM |
26 | DESTPATH = ../../../bin/$(SYSTEM)/$(Target)$(SUF) | 26 | DESTPATH = ../../../bin/$(SYSTEM)/$(Target)$(SUF) |
27 | 27 | ||
28 | all_linux all_win32: | 28 | all_linux all_win32: |
29 | $(warning Building...) | 29 | $(warning Building...) |
30 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) | 30 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(Sources) -o $(DESTPATH) $(LDFLAGS) |
31 | 31 | ||
32 | clean: clean_linux clean_win32 | 32 | clean: clean_linux clean_win32 |
33 | $(warning Cleaning...) | 33 | $(warning Cleaning...) |
34 | 34 | ||
35 | clean_linux clean_win32: | 35 | clean_linux clean_win32: |
36 | @$(RM) $(DESTPATH) | 36 | @$(RM) $(DESTPATH) |
37 | 37 | ||
38 | .PHONY: all all_win32 clean clean_linux clean_win32 | 38 | .PHONY: all all_win32 clean clean_linux clean_win32 |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln index 1e24460..a5b9269 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.sln | |||
@@ -1,20 +1,20 @@ | |||
1 |  | 1 |  |
2 | Microsoft Visual Studio Solution File, Format Version 9.00 | 2 | Microsoft Visual Studio Solution File, Format Version 9.00 |
3 | # Visual C++ Express 2005 | 3 | # Visual C++ Express 2005 |
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v8.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}" | 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v8.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}" |
5 | EndProject | 5 | EndProject |
6 | Global | 6 | Global |
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
8 | Debug|Win32 = Debug|Win32 | 8 | Debug|Win32 = Debug|Win32 |
9 | Release|Win32 = Release|Win32 | 9 | Release|Win32 = Release|Win32 |
10 | EndGlobalSection | 10 | EndGlobalSection |
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
12 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32 | 12 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32 |
13 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32 | 13 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32 |
14 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32 | 14 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32 |
15 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32 | 15 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32 |
16 | EndGlobalSection | 16 | EndGlobalSection |
17 | GlobalSection(SolutionProperties) = preSolution | 17 | GlobalSection(SolutionProperties) = preSolution |
18 | HideSolutionNode = FALSE | 18 | HideSolutionNode = FALSE |
19 | EndGlobalSection | 19 | EndGlobalSection |
20 | EndGlobal | 20 | EndGlobal |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj index fcb71a1..56cc087 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v8.vcproj | |||
@@ -1,201 +1,201 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | 1 | <?xml version="1.0" encoding="Windows-1252"?> |
2 | <VisualStudioProject | 2 | <VisualStudioProject |
3 | ProjectType="Visual C++" | 3 | ProjectType="Visual C++" |
4 | Version="8.00" | 4 | Version="8.00" |
5 | Name="Font Tool" | 5 | Name="Font Tool" |
6 | ProjectGUID="{853A396E-C031-4C26-A716-5B4E176BE11D}" | 6 | ProjectGUID="{853A396E-C031-4C26-A716-5B4E176BE11D}" |
7 | Keyword="Win32Proj" | 7 | Keyword="Win32Proj" |
8 | > | 8 | > |
9 | <Platforms> | 9 | <Platforms> |
10 | <Platform | 10 | <Platform |
11 | Name="Win32" | 11 | Name="Win32" |
12 | /> | 12 | /> |
13 | </Platforms> | 13 | </Platforms> |
14 | <ToolFiles> | 14 | <ToolFiles> |
15 | </ToolFiles> | 15 | </ToolFiles> |
16 | <Configurations> | 16 | <Configurations> |
17 | <Configuration | 17 | <Configuration |
18 | Name="Debug|Win32" | 18 | Name="Debug|Win32" |
19 | OutputDirectory="Debug" | 19 | OutputDirectory="Debug" |
20 | IntermediateDirectory="Debug" | 20 | IntermediateDirectory="Debug" |
21 | ConfigurationType="1" | 21 | ConfigurationType="1" |
22 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | 22 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" |
23 | CharacterSet="2" | 23 | CharacterSet="2" |
24 | > | 24 | > |
25 | <Tool | 25 | <Tool |
26 | Name="VCPreBuildEventTool" | 26 | Name="VCPreBuildEventTool" |
27 | /> | 27 | /> |
28 | <Tool | 28 | <Tool |
29 | Name="VCCustomBuildTool" | 29 | Name="VCCustomBuildTool" |
30 | /> | 30 | /> |
31 | <Tool | 31 | <Tool |
32 | Name="VCXMLDataGeneratorTool" | 32 | Name="VCXMLDataGeneratorTool" |
33 | /> | 33 | /> |
34 | <Tool | 34 | <Tool |
35 | Name="VCWebServiceProxyGeneratorTool" | 35 | Name="VCWebServiceProxyGeneratorTool" |
36 | /> | 36 | /> |
37 | <Tool | 37 | <Tool |
38 | Name="VCMIDLTool" | 38 | Name="VCMIDLTool" |
39 | /> | 39 | /> |
40 | <Tool | 40 | <Tool |
41 | Name="VCCLCompilerTool" | 41 | Name="VCCLCompilerTool" |
42 | Optimization="0" | 42 | Optimization="0" |
43 | AdditionalIncludeDirectories="../../../include" | 43 | AdditionalIncludeDirectories="../../../include" |
44 | PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | 44 | PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" |
45 | MinimalRebuild="true" | 45 | MinimalRebuild="true" |
46 | BasicRuntimeChecks="3" | 46 | BasicRuntimeChecks="3" |
47 | RuntimeLibrary="1" | 47 | RuntimeLibrary="1" |
48 | UsePrecompiledHeader="0" | 48 | UsePrecompiledHeader="0" |
49 | WarningLevel="3" | 49 | WarningLevel="3" |
50 | Detect64BitPortabilityProblems="true" | 50 | Detect64BitPortabilityProblems="true" |
51 | DebugInformationFormat="4" | 51 | DebugInformationFormat="4" |
52 | /> | 52 | /> |
53 | <Tool | 53 | <Tool |
54 | Name="VCManagedResourceCompilerTool" | 54 | Name="VCManagedResourceCompilerTool" |
55 | /> | 55 | /> |
56 | <Tool | 56 | <Tool |
57 | Name="VCResourceCompilerTool" | 57 | Name="VCResourceCompilerTool" |
58 | /> | 58 | /> |
59 | <Tool | 59 | <Tool |
60 | Name="VCPreLinkEventTool" | 60 | Name="VCPreLinkEventTool" |
61 | /> | 61 | /> |
62 | <Tool | 62 | <Tool |
63 | Name="VCLinkerTool" | 63 | Name="VCLinkerTool" |
64 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" | 64 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" |
65 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" | 65 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" |
66 | LinkIncremental="2" | 66 | LinkIncremental="2" |
67 | GenerateDebugInformation="true" | 67 | GenerateDebugInformation="true" |
68 | ProgramDatabaseFile="$(OutDir)/TestProject.pdb" | 68 | ProgramDatabaseFile="$(OutDir)/TestProject.pdb" |
69 | SubSystem="1" | 69 | SubSystem="1" |
70 | TargetMachine="1" | 70 | TargetMachine="1" |
71 | /> | 71 | /> |
72 | <Tool | 72 | <Tool |
73 | Name="VCALinkTool" | 73 | Name="VCALinkTool" |
74 | /> | 74 | /> |
75 | <Tool | 75 | <Tool |
76 | Name="VCManifestTool" | 76 | Name="VCManifestTool" |
77 | /> | 77 | /> |
78 | <Tool | 78 | <Tool |
79 | Name="VCXDCMakeTool" | 79 | Name="VCXDCMakeTool" |
80 | /> | 80 | /> |
81 | <Tool | 81 | <Tool |
82 | Name="VCBscMakeTool" | 82 | Name="VCBscMakeTool" |
83 | /> | 83 | /> |
84 | <Tool | 84 | <Tool |
85 | Name="VCFxCopTool" | 85 | Name="VCFxCopTool" |
86 | /> | 86 | /> |
87 | <Tool | 87 | <Tool |
88 | Name="VCAppVerifierTool" | 88 | Name="VCAppVerifierTool" |
89 | /> | 89 | /> |
90 | <Tool | 90 | <Tool |
91 | Name="VCWebDeploymentTool" | 91 | Name="VCWebDeploymentTool" |
92 | /> | 92 | /> |
93 | <Tool | 93 | <Tool |
94 | Name="VCPostBuildEventTool" | 94 | Name="VCPostBuildEventTool" |
95 | /> | 95 | /> |
96 | </Configuration> | 96 | </Configuration> |
97 | <Configuration | 97 | <Configuration |
98 | Name="Release|Win32" | 98 | Name="Release|Win32" |
99 | OutputDirectory="Release" | 99 | OutputDirectory="Release" |
100 | IntermediateDirectory="Release" | 100 | IntermediateDirectory="Release" |
101 | ConfigurationType="1" | 101 | ConfigurationType="1" |
102 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | 102 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" |
103 | CharacterSet="2" | 103 | CharacterSet="2" |
104 | WholeProgramOptimization="1" | 104 | WholeProgramOptimization="1" |
105 | > | 105 | > |
106 | <Tool | 106 | <Tool |
107 | Name="VCPreBuildEventTool" | 107 | Name="VCPreBuildEventTool" |
108 | /> | 108 | /> |
109 | <Tool | 109 | <Tool |
110 | Name="VCCustomBuildTool" | 110 | Name="VCCustomBuildTool" |
111 | /> | 111 | /> |
112 | <Tool | 112 | <Tool |
113 | Name="VCXMLDataGeneratorTool" | 113 | Name="VCXMLDataGeneratorTool" |
114 | /> | 114 | /> |
115 | <Tool | 115 | <Tool |
116 | Name="VCWebServiceProxyGeneratorTool" | 116 | Name="VCWebServiceProxyGeneratorTool" |
117 | /> | 117 | /> |
118 | <Tool | 118 | <Tool |
119 | Name="VCMIDLTool" | 119 | Name="VCMIDLTool" |
120 | /> | 120 | /> |
121 | <Tool | 121 | <Tool |
122 | Name="VCCLCompilerTool" | 122 | Name="VCCLCompilerTool" |
123 | WholeProgramOptimization="true" | 123 | WholeProgramOptimization="true" |
124 | AdditionalIncludeDirectories="..\..\include" | 124 | AdditionalIncludeDirectories="..\..\include" |
125 | PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | 125 | PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" |
126 | RuntimeLibrary="0" | 126 | RuntimeLibrary="0" |
127 | UsePrecompiledHeader="0" | 127 | UsePrecompiledHeader="0" |
128 | WarningLevel="3" | 128 | WarningLevel="3" |
129 | Detect64BitPortabilityProblems="true" | 129 | Detect64BitPortabilityProblems="true" |
130 | DebugInformationFormat="3" | 130 | DebugInformationFormat="3" |
131 | /> | 131 | /> |
132 | <Tool | 132 | <Tool |
133 | Name="VCManagedResourceCompilerTool" | 133 | Name="VCManagedResourceCompilerTool" |
134 | /> | 134 | /> |
135 | <Tool | 135 | <Tool |
136 | Name="VCResourceCompilerTool" | 136 | Name="VCResourceCompilerTool" |
137 | /> | 137 | /> |
138 | <Tool | 138 | <Tool |
139 | Name="VCPreLinkEventTool" | 139 | Name="VCPreLinkEventTool" |
140 | /> | 140 | /> |
141 | <Tool | 141 | <Tool |
142 | Name="VCLinkerTool" | 142 | Name="VCLinkerTool" |
143 | OutputFile="../../bin/Win32-visualstudio/FontTool.exe" | 143 | OutputFile="../../bin/Win32-visualstudio/FontTool.exe" |
144 | LinkIncremental="1" | 144 | LinkIncremental="1" |
145 | GenerateDebugInformation="true" | 145 | GenerateDebugInformation="true" |
146 | SubSystem="1" | 146 | SubSystem="1" |
147 | OptimizeReferences="2" | 147 | OptimizeReferences="2" |
148 | EnableCOMDATFolding="2" | 148 | EnableCOMDATFolding="2" |
149 | LinkTimeCodeGeneration="1" | 149 | LinkTimeCodeGeneration="1" |
150 | TargetMachine="1" | 150 | TargetMachine="1" |
151 | /> | 151 | /> |
152 | <Tool | 152 | <Tool |
153 | Name="VCALinkTool" | 153 | Name="VCALinkTool" |
154 | /> | 154 | /> |
155 | <Tool | 155 | <Tool |
156 | Name="VCManifestTool" | 156 | Name="VCManifestTool" |
157 | /> | 157 | /> |
158 | <Tool | 158 | <Tool |
159 | Name="VCXDCMakeTool" | 159 | Name="VCXDCMakeTool" |
160 | /> | 160 | /> |
161 | <Tool | 161 | <Tool |
162 | Name="VCBscMakeTool" | 162 | Name="VCBscMakeTool" |
163 | /> | 163 | /> |
164 | <Tool | 164 | <Tool |
165 | Name="VCFxCopTool" | 165 | Name="VCFxCopTool" |
166 | /> | 166 | /> |
167 | <Tool | 167 | <Tool |
168 | Name="VCAppVerifierTool" | 168 | Name="VCAppVerifierTool" |
169 | /> | 169 | /> |
170 | <Tool | 170 | <Tool |
171 | Name="VCWebDeploymentTool" | 171 | Name="VCWebDeploymentTool" |
172 | /> | 172 | /> |
173 | <Tool | 173 | <Tool |
174 | Name="VCPostBuildEventTool" | 174 | Name="VCPostBuildEventTool" |
175 | /> | 175 | /> |
176 | </Configuration> | 176 | </Configuration> |
177 | </Configurations> | 177 | </Configurations> |
178 | <References> | 178 | <References> |
179 | </References> | 179 | </References> |
180 | <Files> | 180 | <Files> |
181 | <File | 181 | <File |
182 | RelativePath=".\CFontTool.cpp" | 182 | RelativePath=".\CFontTool.cpp" |
183 | > | 183 | > |
184 | </File> | 184 | </File> |
185 | <File | 185 | <File |
186 | RelativePath=".\CFontTool.h" | 186 | RelativePath=".\CFontTool.h" |
187 | > | 187 | > |
188 | </File> | 188 | </File> |
189 | <File | 189 | <File |
190 | RelativePath=".\CVectorFontTool.h" | 190 | RelativePath=".\CVectorFontTool.h" |
191 | > | 191 | > |
192 | </File> | 192 | </File> |
193 | <File | 193 | <File |
194 | RelativePath=".\main.cpp" | 194 | RelativePath=".\main.cpp" |
195 | > | 195 | > |
196 | </File> | 196 | </File> |
197 | </Files> | 197 | </Files> |
198 | <Globals> | 198 | <Globals> |
199 | </Globals> | 199 | </Globals> |
200 | </VisualStudioProject> | 200 | </VisualStudioProject> |
201 | 201 | ||
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln index be110b8..7120ffb 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.sln | |||
@@ -1,20 +1,20 @@ | |||
1 |  | 1 |  |
2 | Microsoft Visual Studio Solution File, Format Version 10.00 | 2 | Microsoft Visual Studio Solution File, Format Version 10.00 |
3 | # Visual C++ Express 2008 | 3 | # Visual C++ Express 2008 |
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v9.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}" | 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_v9.vcproj", "{853A396E-C031-4C26-A716-5B4E176BE11D}" |
5 | EndProject | 5 | EndProject |
6 | Global | 6 | Global |
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
8 | Debug|Win32 = Debug|Win32 | 8 | Debug|Win32 = Debug|Win32 |
9 | Release|Win32 = Release|Win32 | 9 | Release|Win32 = Release|Win32 |
10 | EndGlobalSection | 10 | EndGlobalSection |
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
12 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32 | 12 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.ActiveCfg = Debug|Win32 |
13 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32 | 13 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Debug|Win32.Build.0 = Debug|Win32 |
14 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32 | 14 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.ActiveCfg = Release|Win32 |
15 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32 | 15 | {853A396E-C031-4C26-A716-5B4E176BE11D}.Release|Win32.Build.0 = Release|Win32 |
16 | EndGlobalSection | 16 | EndGlobalSection |
17 | GlobalSection(SolutionProperties) = preSolution | 17 | GlobalSection(SolutionProperties) = preSolution |
18 | HideSolutionNode = FALSE | 18 | HideSolutionNode = FALSE |
19 | EndGlobalSection | 19 | EndGlobalSection |
20 | EndGlobal | 20 | EndGlobal |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj index 4fa1e4b..2c7f713 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_v9.vcproj | |||
@@ -1,202 +1,202 @@ | |||
1 | <?xml version="1.0" encoding="Windows-1252"?> | 1 | <?xml version="1.0" encoding="Windows-1252"?> |
2 | <VisualStudioProject | 2 | <VisualStudioProject |
3 | ProjectType="Visual C++" | 3 | ProjectType="Visual C++" |
4 | Version="9,00" | 4 | Version="9,00" |
5 | Name="Font Tool" | 5 | Name="Font Tool" |
6 | ProjectGUID="{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" | 6 | ProjectGUID="{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" |
7 | Keyword="Win32Proj" | 7 | Keyword="Win32Proj" |
8 | TargetFrameworkVersion="131072" | 8 | TargetFrameworkVersion="131072" |
9 | > | 9 | > |
10 | <Platforms> | 10 | <Platforms> |
11 | <Platform | 11 | <Platform |
12 | Name="Win32" | 12 | Name="Win32" |
13 | /> | 13 | /> |
14 | </Platforms> | 14 | </Platforms> |
15 | <ToolFiles> | 15 | <ToolFiles> |
16 | </ToolFiles> | 16 | </ToolFiles> |
17 | <Configurations> | 17 | <Configurations> |
18 | <Configuration | 18 | <Configuration |
19 | Name="Debug|Win32" | 19 | Name="Debug|Win32" |
20 | OutputDirectory="Debug" | 20 | OutputDirectory="Debug" |
21 | IntermediateDirectory="Debug" | 21 | IntermediateDirectory="Debug" |
22 | ConfigurationType="1" | 22 | ConfigurationType="1" |
23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | 23 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" |
24 | CharacterSet="2" | 24 | CharacterSet="2" |
25 | > | 25 | > |
26 | <Tool | 26 | <Tool |
27 | Name="VCPreBuildEventTool" | 27 | Name="VCPreBuildEventTool" |
28 | /> | 28 | /> |
29 | <Tool | 29 | <Tool |
30 | Name="VCCustomBuildTool" | 30 | Name="VCCustomBuildTool" |
31 | /> | 31 | /> |
32 | <Tool | 32 | <Tool |
33 | Name="VCXMLDataGeneratorTool" | 33 | Name="VCXMLDataGeneratorTool" |
34 | /> | 34 | /> |
35 | <Tool | 35 | <Tool |
36 | Name="VCWebServiceProxyGeneratorTool" | 36 | Name="VCWebServiceProxyGeneratorTool" |
37 | /> | 37 | /> |
38 | <Tool | 38 | <Tool |
39 | Name="VCMIDLTool" | 39 | Name="VCMIDLTool" |
40 | /> | 40 | /> |
41 | <Tool | 41 | <Tool |
42 | Name="VCCLCompilerTool" | 42 | Name="VCCLCompilerTool" |
43 | Optimization="0" | 43 | Optimization="0" |
44 | AdditionalIncludeDirectories="../../../include" | 44 | AdditionalIncludeDirectories="../../../include" |
45 | PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" | 45 | PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE" |
46 | MinimalRebuild="true" | 46 | MinimalRebuild="true" |
47 | BasicRuntimeChecks="3" | 47 | BasicRuntimeChecks="3" |
48 | RuntimeLibrary="1" | 48 | RuntimeLibrary="1" |
49 | UsePrecompiledHeader="0" | 49 | UsePrecompiledHeader="0" |
50 | WarningLevel="3" | 50 | WarningLevel="3" |
51 | DebugInformationFormat="4" | 51 | DebugInformationFormat="4" |
52 | /> | 52 | /> |
53 | <Tool | 53 | <Tool |
54 | Name="VCManagedResourceCompilerTool" | 54 | Name="VCManagedResourceCompilerTool" |
55 | /> | 55 | /> |
56 | <Tool | 56 | <Tool |
57 | Name="VCResourceCompilerTool" | 57 | Name="VCResourceCompilerTool" |
58 | /> | 58 | /> |
59 | <Tool | 59 | <Tool |
60 | Name="VCPreLinkEventTool" | 60 | Name="VCPreLinkEventTool" |
61 | /> | 61 | /> |
62 | <Tool | 62 | <Tool |
63 | Name="VCLinkerTool" | 63 | Name="VCLinkerTool" |
64 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" | 64 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" |
65 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" | 65 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" |
66 | LinkIncremental="2" | 66 | LinkIncremental="2" |
67 | AdditionalLibraryDirectories="../../../lib/Win32-visualstudio" | 67 | AdditionalLibraryDirectories="../../../lib/Win32-visualstudio" |
68 | GenerateDebugInformation="true" | 68 | GenerateDebugInformation="true" |
69 | ProgramDatabaseFile="$(OutDir)/TestProject.pdb" | 69 | ProgramDatabaseFile="$(OutDir)/TestProject.pdb" |
70 | SubSystem="1" | 70 | SubSystem="1" |
71 | RandomizedBaseAddress="1" | 71 | RandomizedBaseAddress="1" |
72 | DataExecutionPrevention="0" | 72 | DataExecutionPrevention="0" |
73 | TargetMachine="1" | 73 | TargetMachine="1" |
74 | /> | 74 | /> |
75 | <Tool | 75 | <Tool |
76 | Name="VCALinkTool" | 76 | Name="VCALinkTool" |
77 | /> | 77 | /> |
78 | <Tool | 78 | <Tool |
79 | Name="VCManifestTool" | 79 | Name="VCManifestTool" |
80 | /> | 80 | /> |
81 | <Tool | 81 | <Tool |
82 | Name="VCXDCMakeTool" | 82 | Name="VCXDCMakeTool" |
83 | /> | 83 | /> |
84 | <Tool | 84 | <Tool |
85 | Name="VCBscMakeTool" | 85 | Name="VCBscMakeTool" |
86 | /> | 86 | /> |
87 | <Tool | 87 | <Tool |
88 | Name="VCFxCopTool" | 88 | Name="VCFxCopTool" |
89 | /> | 89 | /> |
90 | <Tool | 90 | <Tool |
91 | Name="VCAppVerifierTool" | 91 | Name="VCAppVerifierTool" |
92 | /> | 92 | /> |
93 | <Tool | 93 | <Tool |
94 | Name="VCPostBuildEventTool" | 94 | Name="VCPostBuildEventTool" |
95 | /> | 95 | /> |
96 | </Configuration> | 96 | </Configuration> |
97 | <Configuration | 97 | <Configuration |
98 | Name="Release|Win32" | 98 | Name="Release|Win32" |
99 | OutputDirectory="Release" | 99 | OutputDirectory="Release" |
100 | IntermediateDirectory="Release" | 100 | IntermediateDirectory="Release" |
101 | ConfigurationType="1" | 101 | ConfigurationType="1" |
102 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" | 102 | InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" |
103 | CharacterSet="2" | 103 | CharacterSet="2" |
104 | WholeProgramOptimization="1" | 104 | WholeProgramOptimization="1" |
105 | > | 105 | > |
106 | <Tool | 106 | <Tool |
107 | Name="VCPreBuildEventTool" | 107 | Name="VCPreBuildEventTool" |
108 | /> | 108 | /> |
109 | <Tool | 109 | <Tool |
110 | Name="VCCustomBuildTool" | 110 | Name="VCCustomBuildTool" |
111 | /> | 111 | /> |
112 | <Tool | 112 | <Tool |
113 | Name="VCXMLDataGeneratorTool" | 113 | Name="VCXMLDataGeneratorTool" |
114 | /> | 114 | /> |
115 | <Tool | 115 | <Tool |
116 | Name="VCWebServiceProxyGeneratorTool" | 116 | Name="VCWebServiceProxyGeneratorTool" |
117 | /> | 117 | /> |
118 | <Tool | 118 | <Tool |
119 | Name="VCMIDLTool" | 119 | Name="VCMIDLTool" |
120 | /> | 120 | /> |
121 | <Tool | 121 | <Tool |
122 | Name="VCCLCompilerTool" | 122 | Name="VCCLCompilerTool" |
123 | Optimization="2" | 123 | Optimization="2" |
124 | WholeProgramOptimization="false" | 124 | WholeProgramOptimization="false" |
125 | AdditionalIncludeDirectories="../../../include" | 125 | AdditionalIncludeDirectories="../../../include" |
126 | PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" | 126 | PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE" |
127 | MinimalRebuild="true" | 127 | MinimalRebuild="true" |
128 | RuntimeLibrary="0" | 128 | RuntimeLibrary="0" |
129 | UsePrecompiledHeader="0" | 129 | UsePrecompiledHeader="0" |
130 | WarningLevel="3" | 130 | WarningLevel="3" |
131 | DebugInformationFormat="3" | 131 | DebugInformationFormat="3" |
132 | /> | 132 | /> |
133 | <Tool | 133 | <Tool |
134 | Name="VCManagedResourceCompilerTool" | 134 | Name="VCManagedResourceCompilerTool" |
135 | /> | 135 | /> |
136 | <Tool | 136 | <Tool |
137 | Name="VCResourceCompilerTool" | 137 | Name="VCResourceCompilerTool" |
138 | /> | 138 | /> |
139 | <Tool | 139 | <Tool |
140 | Name="VCPreLinkEventTool" | 140 | Name="VCPreLinkEventTool" |
141 | /> | 141 | /> |
142 | <Tool | 142 | <Tool |
143 | Name="VCLinkerTool" | 143 | Name="VCLinkerTool" |
144 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" | 144 | AdditionalOptions=" kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib" |
145 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" | 145 | OutputFile="../../../bin/Win32-visualstudio/FontTool.exe" |
146 | LinkIncremental="0" | 146 | LinkIncremental="0" |
147 | AdditionalLibraryDirectories="../../../lib/Win32-visualstudio" | 147 | AdditionalLibraryDirectories="../../../lib/Win32-visualstudio" |
148 | GenerateDebugInformation="false" | 148 | GenerateDebugInformation="false" |
149 | SubSystem="1" | 149 | SubSystem="1" |
150 | OptimizeReferences="2" | 150 | OptimizeReferences="2" |
151 | EnableCOMDATFolding="2" | 151 | EnableCOMDATFolding="2" |
152 | LinkTimeCodeGeneration="0" | 152 | LinkTimeCodeGeneration="0" |
153 | RandomizedBaseAddress="1" | 153 | RandomizedBaseAddress="1" |
154 | DataExecutionPrevention="0" | 154 | DataExecutionPrevention="0" |
155 | TargetMachine="1" | 155 | TargetMachine="1" |
156 | /> | 156 | /> |
157 | <Tool | 157 | <Tool |
158 | Name="VCALinkTool" | 158 | Name="VCALinkTool" |
159 | /> | 159 | /> |
160 | <Tool | 160 | <Tool |
161 | Name="VCManifestTool" | 161 | Name="VCManifestTool" |
162 | /> | 162 | /> |
163 | <Tool | 163 | <Tool |
164 | Name="VCXDCMakeTool" | 164 | Name="VCXDCMakeTool" |
165 | /> | 165 | /> |
166 | <Tool | 166 | <Tool |
167 | Name="VCBscMakeTool" | 167 | Name="VCBscMakeTool" |
168 | /> | 168 | /> |
169 | <Tool | 169 | <Tool |
170 | Name="VCFxCopTool" | 170 | Name="VCFxCopTool" |
171 | /> | 171 | /> |
172 | <Tool | 172 | <Tool |
173 | Name="VCAppVerifierTool" | 173 | Name="VCAppVerifierTool" |
174 | /> | 174 | /> |
175 | <Tool | 175 | <Tool |
176 | Name="VCPostBuildEventTool" | 176 | Name="VCPostBuildEventTool" |
177 | /> | 177 | /> |
178 | </Configuration> | 178 | </Configuration> |
179 | </Configurations> | 179 | </Configurations> |
180 | <References> | 180 | <References> |
181 | </References> | 181 | </References> |
182 | <Files> | 182 | <Files> |
183 | <File | 183 | <File |
184 | RelativePath=".\CFontTool.cpp" | 184 | RelativePath=".\CFontTool.cpp" |
185 | > | 185 | > |
186 | </File> | 186 | </File> |
187 | <File | 187 | <File |
188 | RelativePath=".\CFontTool.h" | 188 | RelativePath=".\CFontTool.h" |
189 | > | 189 | > |
190 | </File> | 190 | </File> |
191 | <File | 191 | <File |
192 | RelativePath=".\CVectorFontTool.h" | 192 | RelativePath=".\CVectorFontTool.h" |
193 | > | 193 | > |
194 | </File> | 194 | </File> |
195 | <File | 195 | <File |
196 | RelativePath=".\main.cpp" | 196 | RelativePath=".\main.cpp" |
197 | > | 197 | > |
198 | </File> | 198 | </File> |
199 | </Files> | 199 | </Files> |
200 | <Globals> | 200 | <Globals> |
201 | </Globals> | 201 | </Globals> |
202 | </VisualStudioProject> | 202 | </VisualStudioProject> |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln index 48651a8..55fc6c7 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.sln | |||
@@ -1,20 +1,20 @@ | |||
1 |  | 1 |  |
2 | Microsoft Visual Studio Solution File, Format Version 11.00 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 |
3 | # Visual Studio 2010 | 3 | # Visual Studio 2010 |
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc10.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" | 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc10.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" |
5 | EndProject | 5 | EndProject |
6 | Global | 6 | Global |
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
8 | Debug|Win32 = Debug|Win32 | 8 | Debug|Win32 = Debug|Win32 |
9 | Release|Win32 = Release|Win32 | 9 | Release|Win32 = Release|Win32 |
10 | EndGlobalSection | 10 | EndGlobalSection |
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
12 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32 | 12 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32 |
13 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32 | 13 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32 |
14 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32 | 14 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32 |
15 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32 | 15 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32 |
16 | EndGlobalSection | 16 | EndGlobalSection |
17 | GlobalSection(SolutionProperties) = preSolution | 17 | GlobalSection(SolutionProperties) = preSolution |
18 | HideSolutionNode = FALSE | 18 | HideSolutionNode = FALSE |
19 | EndGlobalSection | 19 | EndGlobalSection |
20 | EndGlobal | 20 | EndGlobal |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj index e1ee889..fc54796 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc10.vcxproj | |||
@@ -1,203 +1,203 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <ItemGroup Label="ProjectConfigurations"> | 3 | <ItemGroup Label="ProjectConfigurations"> |
4 | <ProjectConfiguration Include="Debug|Win32"> | 4 | <ProjectConfiguration Include="Debug|Win32"> |
5 | <Configuration>Debug</Configuration> | 5 | <Configuration>Debug</Configuration> |
6 | <Platform>Win32</Platform> | 6 | <Platform>Win32</Platform> |
7 | </ProjectConfiguration> | 7 | </ProjectConfiguration> |
8 | <ProjectConfiguration Include="Debug|x64"> | 8 | <ProjectConfiguration Include="Debug|x64"> |
9 | <Configuration>Debug</Configuration> | 9 | <Configuration>Debug</Configuration> |
10 | <Platform>x64</Platform> | 10 | <Platform>x64</Platform> |
11 | </ProjectConfiguration> | 11 | </ProjectConfiguration> |
12 | <ProjectConfiguration Include="Release|Win32"> | 12 | <ProjectConfiguration Include="Release|Win32"> |
13 | <Configuration>Release</Configuration> | 13 | <Configuration>Release</Configuration> |
14 | <Platform>Win32</Platform> | 14 | <Platform>Win32</Platform> |
15 | </ProjectConfiguration> | 15 | </ProjectConfiguration> |
16 | <ProjectConfiguration Include="Release|x64"> | 16 | <ProjectConfiguration Include="Release|x64"> |
17 | <Configuration>Release</Configuration> | 17 | <Configuration>Release</Configuration> |
18 | <Platform>x64</Platform> | 18 | <Platform>x64</Platform> |
19 | </ProjectConfiguration> | 19 | </ProjectConfiguration> |
20 | </ItemGroup> | 20 | </ItemGroup> |
21 | <PropertyGroup Label="Globals"> | 21 | <PropertyGroup Label="Globals"> |
22 | <ProjectName>FontTool</ProjectName> | 22 | <ProjectName>FontTool</ProjectName> |
23 | <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid> | 23 | <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid> |
24 | <Keyword>Win32Proj</Keyword> | 24 | <Keyword>Win32Proj</Keyword> |
25 | </PropertyGroup> | 25 | </PropertyGroup> |
26 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | 26 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
27 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | 27 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
28 | <ConfigurationType>Application</ConfigurationType> | 28 | <ConfigurationType>Application</ConfigurationType> |
29 | <CharacterSet>MultiByte</CharacterSet> | 29 | <CharacterSet>MultiByte</CharacterSet> |
30 | <WholeProgramOptimization>true</WholeProgramOptimization> | 30 | <WholeProgramOptimization>true</WholeProgramOptimization> |
31 | </PropertyGroup> | 31 | </PropertyGroup> |
32 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | 32 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
33 | <ConfigurationType>Application</ConfigurationType> | 33 | <ConfigurationType>Application</ConfigurationType> |
34 | <CharacterSet>MultiByte</CharacterSet> | 34 | <CharacterSet>MultiByte</CharacterSet> |
35 | <WholeProgramOptimization>true</WholeProgramOptimization> | 35 | <WholeProgramOptimization>true</WholeProgramOptimization> |
36 | </PropertyGroup> | 36 | </PropertyGroup> |
37 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | 37 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
38 | <ConfigurationType>Application</ConfigurationType> | 38 | <ConfigurationType>Application</ConfigurationType> |
39 | <CharacterSet>MultiByte</CharacterSet> | 39 | <CharacterSet>MultiByte</CharacterSet> |
40 | </PropertyGroup> | 40 | </PropertyGroup> |
41 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | 41 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
42 | <ConfigurationType>Application</ConfigurationType> | 42 | <ConfigurationType>Application</ConfigurationType> |
43 | <CharacterSet>MultiByte</CharacterSet> | 43 | <CharacterSet>MultiByte</CharacterSet> |
44 | </PropertyGroup> | 44 | </PropertyGroup> |
45 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 45 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
46 | <ImportGroup Label="ExtensionSettings"> | 46 | <ImportGroup Label="ExtensionSettings"> |
47 | </ImportGroup> | 47 | </ImportGroup> |
48 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | 48 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> |
49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 49 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
50 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 50 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
51 | </ImportGroup> | 51 | </ImportGroup> |
52 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | 52 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
53 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 53 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
54 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 54 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
55 | </ImportGroup> | 55 | </ImportGroup> |
56 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | 56 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> |
57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
58 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 58 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
59 | </ImportGroup> | 59 | </ImportGroup> |
60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | 60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
62 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 62 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
63 | </ImportGroup> | 63 | </ImportGroup> |
64 | <PropertyGroup Label="UserMacros" /> | 64 | <PropertyGroup Label="UserMacros" /> |
65 | <PropertyGroup> | 65 | <PropertyGroup> |
66 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | 66 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> |
67 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> | 67 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> |
68 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> | 68 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> |
69 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | 69 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> |
70 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | 70 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> |
71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> | 71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> |
72 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> | 72 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> |
73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
74 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 74 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
75 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | 75 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> |
76 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | 76 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> |
77 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | 77 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> |
78 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | 78 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> |
79 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | 79 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> |
80 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | 80 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> |
81 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | 81 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> |
82 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | 82 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> |
83 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 83 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
84 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 84 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
85 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 85 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
86 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 86 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
87 | </PropertyGroup> | 87 | </PropertyGroup> |
88 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 88 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
89 | <ClCompile> | 89 | <ClCompile> |
90 | <Optimization>Disabled</Optimization> | 90 | <Optimization>Disabled</Optimization> |
91 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 91 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
92 | <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 92 | <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
93 | <MinimalRebuild>true</MinimalRebuild> | 93 | <MinimalRebuild>true</MinimalRebuild> |
94 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 94 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
95 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | 95 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
96 | <PrecompiledHeader> | 96 | <PrecompiledHeader> |
97 | </PrecompiledHeader> | 97 | </PrecompiledHeader> |
98 | <WarningLevel>Level3</WarningLevel> | 98 | <WarningLevel>Level3</WarningLevel> |
99 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | 99 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
100 | </ClCompile> | 100 | </ClCompile> |
101 | <Link> | 101 | <Link> |
102 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 102 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
103 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> | 103 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> |
104 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 104 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
105 | <GenerateDebugInformation>true</GenerateDebugInformation> | 105 | <GenerateDebugInformation>true</GenerateDebugInformation> |
106 | <SubSystem>Console</SubSystem> | 106 | <SubSystem>Console</SubSystem> |
107 | <DataExecutionPrevention> | 107 | <DataExecutionPrevention> |
108 | </DataExecutionPrevention> | 108 | </DataExecutionPrevention> |
109 | </Link> | 109 | </Link> |
110 | </ItemDefinitionGroup> | 110 | </ItemDefinitionGroup> |
111 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 111 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
112 | <ClCompile> | 112 | <ClCompile> |
113 | <Optimization>Disabled</Optimization> | 113 | <Optimization>Disabled</Optimization> |
114 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 114 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
115 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 115 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
116 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 116 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
117 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | 117 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
118 | <PrecompiledHeader> | 118 | <PrecompiledHeader> |
119 | </PrecompiledHeader> | 119 | </PrecompiledHeader> |
120 | <WarningLevel>Level3</WarningLevel> | 120 | <WarningLevel>Level3</WarningLevel> |
121 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 121 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
122 | </ClCompile> | 122 | </ClCompile> |
123 | <Link> | 123 | <Link> |
124 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 124 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
125 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> | 125 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> |
126 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 126 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
127 | <GenerateDebugInformation>true</GenerateDebugInformation> | 127 | <GenerateDebugInformation>true</GenerateDebugInformation> |
128 | <SubSystem>Console</SubSystem> | 128 | <SubSystem>Console</SubSystem> |
129 | <DataExecutionPrevention> | 129 | <DataExecutionPrevention> |
130 | </DataExecutionPrevention> | 130 | </DataExecutionPrevention> |
131 | </Link> | 131 | </Link> |
132 | </ItemDefinitionGroup> | 132 | </ItemDefinitionGroup> |
133 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 133 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
134 | <ClCompile> | 134 | <ClCompile> |
135 | <Optimization>MaxSpeed</Optimization> | 135 | <Optimization>MaxSpeed</Optimization> |
136 | <WholeProgramOptimization>false</WholeProgramOptimization> | 136 | <WholeProgramOptimization>false</WholeProgramOptimization> |
137 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 137 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
138 | <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 138 | <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
139 | <MinimalRebuild>true</MinimalRebuild> | 139 | <MinimalRebuild>true</MinimalRebuild> |
140 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | 140 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
141 | <PrecompiledHeader> | 141 | <PrecompiledHeader> |
142 | </PrecompiledHeader> | 142 | </PrecompiledHeader> |
143 | <WarningLevel>Level3</WarningLevel> | 143 | <WarningLevel>Level3</WarningLevel> |
144 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 144 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
145 | </ClCompile> | 145 | </ClCompile> |
146 | <Link> | 146 | <Link> |
147 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 147 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
148 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> | 148 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> |
149 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 149 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
150 | <GenerateDebugInformation>false</GenerateDebugInformation> | 150 | <GenerateDebugInformation>false</GenerateDebugInformation> |
151 | <SubSystem>Console</SubSystem> | 151 | <SubSystem>Console</SubSystem> |
152 | <OptimizeReferences>true</OptimizeReferences> | 152 | <OptimizeReferences>true</OptimizeReferences> |
153 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | 153 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
154 | <LinkTimeCodeGeneration> | 154 | <LinkTimeCodeGeneration> |
155 | </LinkTimeCodeGeneration> | 155 | </LinkTimeCodeGeneration> |
156 | <DataExecutionPrevention> | 156 | <DataExecutionPrevention> |
157 | </DataExecutionPrevention> | 157 | </DataExecutionPrevention> |
158 | </Link> | 158 | </Link> |
159 | </ItemDefinitionGroup> | 159 | </ItemDefinitionGroup> |
160 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 160 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
161 | <ClCompile> | 161 | <ClCompile> |
162 | <Optimization>MaxSpeed</Optimization> | 162 | <Optimization>MaxSpeed</Optimization> |
163 | <WholeProgramOptimization>false</WholeProgramOptimization> | 163 | <WholeProgramOptimization>false</WholeProgramOptimization> |
164 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 164 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
165 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 165 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
166 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | 166 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
167 | <PrecompiledHeader> | 167 | <PrecompiledHeader> |
168 | </PrecompiledHeader> | 168 | </PrecompiledHeader> |
169 | <WarningLevel>Level3</WarningLevel> | 169 | <WarningLevel>Level3</WarningLevel> |
170 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 170 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
171 | </ClCompile> | 171 | </ClCompile> |
172 | <Link> | 172 | <Link> |
173 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 173 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
174 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> | 174 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> |
175 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 175 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
176 | <GenerateDebugInformation>false</GenerateDebugInformation> | 176 | <GenerateDebugInformation>false</GenerateDebugInformation> |
177 | <SubSystem>Console</SubSystem> | 177 | <SubSystem>Console</SubSystem> |
178 | <OptimizeReferences>true</OptimizeReferences> | 178 | <OptimizeReferences>true</OptimizeReferences> |
179 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | 179 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
180 | <LinkTimeCodeGeneration> | 180 | <LinkTimeCodeGeneration> |
181 | </LinkTimeCodeGeneration> | 181 | </LinkTimeCodeGeneration> |
182 | <DataExecutionPrevention> | 182 | <DataExecutionPrevention> |
183 | </DataExecutionPrevention> | 183 | </DataExecutionPrevention> |
184 | </Link> | 184 | </Link> |
185 | </ItemDefinitionGroup> | 185 | </ItemDefinitionGroup> |
186 | <ItemGroup> | 186 | <ItemGroup> |
187 | <ClCompile Include="CFontTool.cpp" /> | 187 | <ClCompile Include="CFontTool.cpp" /> |
188 | <ClCompile Include="main.cpp" /> | 188 | <ClCompile Include="main.cpp" /> |
189 | </ItemGroup> | 189 | </ItemGroup> |
190 | <ItemGroup> | 190 | <ItemGroup> |
191 | <ClInclude Include="CFontTool.h" /> | 191 | <ClInclude Include="CFontTool.h" /> |
192 | <ClInclude Include="CVectorFontTool.h" /> | 192 | <ClInclude Include="CVectorFontTool.h" /> |
193 | </ItemGroup> | 193 | </ItemGroup> |
194 | <ItemGroup> | 194 | <ItemGroup> |
195 | <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht10.0.vcxproj"> | 195 | <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht10.0.vcxproj"> |
196 | <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project> | 196 | <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project> |
197 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | 197 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
198 | </ProjectReference> | 198 | </ProjectReference> |
199 | </ItemGroup> | 199 | </ItemGroup> |
200 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | 200 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
201 | <ImportGroup Label="ExtensionTargets"> | 201 | <ImportGroup Label="ExtensionTargets"> |
202 | </ImportGroup> | 202 | </ImportGroup> |
203 | </Project> \ No newline at end of file | 203 | </Project> \ No newline at end of file |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln index 05b60ad..60f8d08 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.sln | |||
@@ -1,20 +1,20 @@ | |||
1 |  | 1 |  |
2 | Microsoft Visual Studio Solution File, Format Version 11.00 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 |
3 | # Visual Studio 2012 | 3 | # Visual Studio 2012 |
4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc11.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" | 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Font Tool", "irrFontTool_vc11.vcxproj", "{4D53E40F-37E3-42B1-8848-F4C6F8313A17}" |
5 | EndProject | 5 | EndProject |
6 | Global | 6 | Global |
7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution | 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution |
8 | Debug|Win32 = Debug|Win32 | 8 | Debug|Win32 = Debug|Win32 |
9 | Release|Win32 = Release|Win32 | 9 | Release|Win32 = Release|Win32 |
10 | EndGlobalSection | 10 | EndGlobalSection |
11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution | 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution |
12 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32 | 12 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.ActiveCfg = Debug|Win32 |
13 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32 | 13 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Debug|Win32.Build.0 = Debug|Win32 |
14 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32 | 14 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.ActiveCfg = Release|Win32 |
15 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32 | 15 | {4D53E40F-37E3-42B1-8848-F4C6F8313A17}.Release|Win32.Build.0 = Release|Win32 |
16 | EndGlobalSection | 16 | EndGlobalSection |
17 | GlobalSection(SolutionProperties) = preSolution | 17 | GlobalSection(SolutionProperties) = preSolution |
18 | HideSolutionNode = FALSE | 18 | HideSolutionNode = FALSE |
19 | EndGlobalSection | 19 | EndGlobalSection |
20 | EndGlobal | 20 | EndGlobal |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj index 4513cfa..ddae5b1 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/irrFontTool_vc11.vcxproj | |||
@@ -1,207 +1,207 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | 2 | <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | <ItemGroup Label="ProjectConfigurations"> | 3 | <ItemGroup Label="ProjectConfigurations"> |
4 | <ProjectConfiguration Include="Debug|Win32"> | 4 | <ProjectConfiguration Include="Debug|Win32"> |
5 | <Configuration>Debug</Configuration> | 5 | <Configuration>Debug</Configuration> |
6 | <Platform>Win32</Platform> | 6 | <Platform>Win32</Platform> |
7 | </ProjectConfiguration> | 7 | </ProjectConfiguration> |
8 | <ProjectConfiguration Include="Debug|x64"> | 8 | <ProjectConfiguration Include="Debug|x64"> |
9 | <Configuration>Debug</Configuration> | 9 | <Configuration>Debug</Configuration> |
10 | <Platform>x64</Platform> | 10 | <Platform>x64</Platform> |
11 | </ProjectConfiguration> | 11 | </ProjectConfiguration> |
12 | <ProjectConfiguration Include="Release|Win32"> | 12 | <ProjectConfiguration Include="Release|Win32"> |
13 | <Configuration>Release</Configuration> | 13 | <Configuration>Release</Configuration> |
14 | <Platform>Win32</Platform> | 14 | <Platform>Win32</Platform> |
15 | </ProjectConfiguration> | 15 | </ProjectConfiguration> |
16 | <ProjectConfiguration Include="Release|x64"> | 16 | <ProjectConfiguration Include="Release|x64"> |
17 | <Configuration>Release</Configuration> | 17 | <Configuration>Release</Configuration> |
18 | <Platform>x64</Platform> | 18 | <Platform>x64</Platform> |
19 | </ProjectConfiguration> | 19 | </ProjectConfiguration> |
20 | </ItemGroup> | 20 | </ItemGroup> |
21 | <PropertyGroup Label="Globals"> | 21 | <PropertyGroup Label="Globals"> |
22 | <ProjectName>FontTool</ProjectName> | 22 | <ProjectName>FontTool</ProjectName> |
23 | <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid> | 23 | <ProjectGuid>{4D53E40F-37E3-42B1-8848-F4C6F8313A17}</ProjectGuid> |
24 | <Keyword>Win32Proj</Keyword> | 24 | <Keyword>Win32Proj</Keyword> |
25 | </PropertyGroup> | 25 | </PropertyGroup> |
26 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | 26 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
27 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | 27 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> |
28 | <ConfigurationType>Application</ConfigurationType> | 28 | <ConfigurationType>Application</ConfigurationType> |
29 | <CharacterSet>MultiByte</CharacterSet> | 29 | <CharacterSet>MultiByte</CharacterSet> |
30 | <WholeProgramOptimization>true</WholeProgramOptimization> | 30 | <WholeProgramOptimization>true</WholeProgramOptimization> |
31 | <PlatformToolset>v110</PlatformToolset> | 31 | <PlatformToolset>v110</PlatformToolset> |
32 | </PropertyGroup> | 32 | </PropertyGroup> |
33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | 33 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> |
34 | <ConfigurationType>Application</ConfigurationType> | 34 | <ConfigurationType>Application</ConfigurationType> |
35 | <CharacterSet>MultiByte</CharacterSet> | 35 | <CharacterSet>MultiByte</CharacterSet> |
36 | <WholeProgramOptimization>true</WholeProgramOptimization> | 36 | <WholeProgramOptimization>true</WholeProgramOptimization> |
37 | <PlatformToolset>v110</PlatformToolset> | 37 | <PlatformToolset>v110</PlatformToolset> |
38 | </PropertyGroup> | 38 | </PropertyGroup> |
39 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | 39 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> |
40 | <ConfigurationType>Application</ConfigurationType> | 40 | <ConfigurationType>Application</ConfigurationType> |
41 | <CharacterSet>MultiByte</CharacterSet> | 41 | <CharacterSet>MultiByte</CharacterSet> |
42 | <PlatformToolset>v110</PlatformToolset> | 42 | <PlatformToolset>v110</PlatformToolset> |
43 | </PropertyGroup> | 43 | </PropertyGroup> |
44 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | 44 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> |
45 | <ConfigurationType>Application</ConfigurationType> | 45 | <ConfigurationType>Application</ConfigurationType> |
46 | <CharacterSet>MultiByte</CharacterSet> | 46 | <CharacterSet>MultiByte</CharacterSet> |
47 | <PlatformToolset>v110</PlatformToolset> | 47 | <PlatformToolset>v110</PlatformToolset> |
48 | </PropertyGroup> | 48 | </PropertyGroup> |
49 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | 49 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
50 | <ImportGroup Label="ExtensionSettings"> | 50 | <ImportGroup Label="ExtensionSettings"> |
51 | </ImportGroup> | 51 | </ImportGroup> |
52 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | 52 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> |
53 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 53 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
54 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 54 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
55 | </ImportGroup> | 55 | </ImportGroup> |
56 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | 56 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
58 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 58 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
59 | </ImportGroup> | 59 | </ImportGroup> |
60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | 60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> |
61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
62 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 62 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
63 | </ImportGroup> | 63 | </ImportGroup> |
64 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | 64 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
65 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 65 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
66 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 66 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
67 | </ImportGroup> | 67 | </ImportGroup> |
68 | <PropertyGroup Label="UserMacros" /> | 68 | <PropertyGroup Label="UserMacros" /> |
69 | <PropertyGroup> | 69 | <PropertyGroup> |
70 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | 70 | <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> |
71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> | 71 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> |
72 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> | 72 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> |
73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | 73 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> |
74 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> | 74 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> |
75 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> | 75 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\..\bin\Win32-VisualStudio\</OutDir> |
76 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> | 76 | <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\bin\Win64-VisualStudio\</OutDir> |
77 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 77 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
78 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 78 | <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
79 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | 79 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> |
80 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | 80 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet> |
81 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | 81 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> |
82 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | 82 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> |
83 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | 83 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> |
84 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> | 84 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" /> |
85 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | 85 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> |
86 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> | 86 | <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet> |
87 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 87 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
88 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 88 | <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
89 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | 89 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> |
90 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> | 90 | <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" /> |
91 | </PropertyGroup> | 91 | </PropertyGroup> |
92 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 92 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
93 | <ClCompile> | 93 | <ClCompile> |
94 | <Optimization>Disabled</Optimization> | 94 | <Optimization>Disabled</Optimization> |
95 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 95 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
96 | <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 96 | <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
97 | <MinimalRebuild>true</MinimalRebuild> | 97 | <MinimalRebuild>true</MinimalRebuild> |
98 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 98 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
99 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | 99 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
100 | <PrecompiledHeader> | 100 | <PrecompiledHeader> |
101 | </PrecompiledHeader> | 101 | </PrecompiledHeader> |
102 | <WarningLevel>Level3</WarningLevel> | 102 | <WarningLevel>Level3</WarningLevel> |
103 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | 103 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
104 | </ClCompile> | 104 | </ClCompile> |
105 | <Link> | 105 | <Link> |
106 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 106 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
107 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> | 107 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> |
108 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 108 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
109 | <GenerateDebugInformation>true</GenerateDebugInformation> | 109 | <GenerateDebugInformation>true</GenerateDebugInformation> |
110 | <SubSystem>Console</SubSystem> | 110 | <SubSystem>Console</SubSystem> |
111 | <DataExecutionPrevention> | 111 | <DataExecutionPrevention> |
112 | </DataExecutionPrevention> | 112 | </DataExecutionPrevention> |
113 | </Link> | 113 | </Link> |
114 | </ItemDefinitionGroup> | 114 | </ItemDefinitionGroup> |
115 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 115 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
116 | <ClCompile> | 116 | <ClCompile> |
117 | <Optimization>Disabled</Optimization> | 117 | <Optimization>Disabled</Optimization> |
118 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 118 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
119 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 119 | <PreprocessorDefinitions>WIN32;WIN64;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
120 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 120 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
121 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | 121 | <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> |
122 | <PrecompiledHeader> | 122 | <PrecompiledHeader> |
123 | </PrecompiledHeader> | 123 | </PrecompiledHeader> |
124 | <WarningLevel>Level3</WarningLevel> | 124 | <WarningLevel>Level3</WarningLevel> |
125 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 125 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
126 | </ClCompile> | 126 | </ClCompile> |
127 | <Link> | 127 | <Link> |
128 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 128 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
129 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> | 129 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> |
130 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 130 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
131 | <GenerateDebugInformation>true</GenerateDebugInformation> | 131 | <GenerateDebugInformation>true</GenerateDebugInformation> |
132 | <SubSystem>Console</SubSystem> | 132 | <SubSystem>Console</SubSystem> |
133 | <DataExecutionPrevention> | 133 | <DataExecutionPrevention> |
134 | </DataExecutionPrevention> | 134 | </DataExecutionPrevention> |
135 | </Link> | 135 | </Link> |
136 | </ItemDefinitionGroup> | 136 | </ItemDefinitionGroup> |
137 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 137 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
138 | <ClCompile> | 138 | <ClCompile> |
139 | <Optimization>MaxSpeed</Optimization> | 139 | <Optimization>MaxSpeed</Optimization> |
140 | <WholeProgramOptimization>false</WholeProgramOptimization> | 140 | <WholeProgramOptimization>false</WholeProgramOptimization> |
141 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 141 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
142 | <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 142 | <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
143 | <MinimalRebuild>true</MinimalRebuild> | 143 | <MinimalRebuild>true</MinimalRebuild> |
144 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | 144 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
145 | <PrecompiledHeader> | 145 | <PrecompiledHeader> |
146 | </PrecompiledHeader> | 146 | </PrecompiledHeader> |
147 | <WarningLevel>Level3</WarningLevel> | 147 | <WarningLevel>Level3</WarningLevel> |
148 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 148 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
149 | </ClCompile> | 149 | </ClCompile> |
150 | <Link> | 150 | <Link> |
151 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 151 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
152 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> | 152 | <OutputFile>../../../bin/Win32-visualstudio/FontTool.exe</OutputFile> |
153 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 153 | <AdditionalLibraryDirectories>../../../lib/Win32-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
154 | <GenerateDebugInformation>false</GenerateDebugInformation> | 154 | <GenerateDebugInformation>false</GenerateDebugInformation> |
155 | <SubSystem>Console</SubSystem> | 155 | <SubSystem>Console</SubSystem> |
156 | <OptimizeReferences>true</OptimizeReferences> | 156 | <OptimizeReferences>true</OptimizeReferences> |
157 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | 157 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
158 | <LinkTimeCodeGeneration> | 158 | <LinkTimeCodeGeneration> |
159 | </LinkTimeCodeGeneration> | 159 | </LinkTimeCodeGeneration> |
160 | <DataExecutionPrevention> | 160 | <DataExecutionPrevention> |
161 | </DataExecutionPrevention> | 161 | </DataExecutionPrevention> |
162 | </Link> | 162 | </Link> |
163 | </ItemDefinitionGroup> | 163 | </ItemDefinitionGroup> |
164 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 164 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
165 | <ClCompile> | 165 | <ClCompile> |
166 | <Optimization>MaxSpeed</Optimization> | 166 | <Optimization>MaxSpeed</Optimization> |
167 | <WholeProgramOptimization>false</WholeProgramOptimization> | 167 | <WholeProgramOptimization>false</WholeProgramOptimization> |
168 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 168 | <AdditionalIncludeDirectories>../../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
169 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 169 | <PreprocessorDefinitions>WIN32;WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
170 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> | 170 | <RuntimeLibrary>MultiThreaded</RuntimeLibrary> |
171 | <PrecompiledHeader> | 171 | <PrecompiledHeader> |
172 | </PrecompiledHeader> | 172 | </PrecompiledHeader> |
173 | <WarningLevel>Level3</WarningLevel> | 173 | <WarningLevel>Level3</WarningLevel> |
174 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 174 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
175 | </ClCompile> | 175 | </ClCompile> |
176 | <Link> | 176 | <Link> |
177 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> | 177 | <AdditionalOptions> kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib glu32.lib opengl32.lib gdi32.lib %(AdditionalOptions)</AdditionalOptions> |
178 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> | 178 | <OutputFile>../../../bin/Win64-visualstudio/FontTool.exe</OutputFile> |
179 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 179 | <AdditionalLibraryDirectories>../../../lib/Win64-visualstudio;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
180 | <GenerateDebugInformation>false</GenerateDebugInformation> | 180 | <GenerateDebugInformation>false</GenerateDebugInformation> |
181 | <SubSystem>Console</SubSystem> | 181 | <SubSystem>Console</SubSystem> |
182 | <OptimizeReferences>true</OptimizeReferences> | 182 | <OptimizeReferences>true</OptimizeReferences> |
183 | <EnableCOMDATFolding>true</EnableCOMDATFolding> | 183 | <EnableCOMDATFolding>true</EnableCOMDATFolding> |
184 | <LinkTimeCodeGeneration> | 184 | <LinkTimeCodeGeneration> |
185 | </LinkTimeCodeGeneration> | 185 | </LinkTimeCodeGeneration> |
186 | <DataExecutionPrevention> | 186 | <DataExecutionPrevention> |
187 | </DataExecutionPrevention> | 187 | </DataExecutionPrevention> |
188 | </Link> | 188 | </Link> |
189 | </ItemDefinitionGroup> | 189 | </ItemDefinitionGroup> |
190 | <ItemGroup> | 190 | <ItemGroup> |
191 | <ClCompile Include="CFontTool.cpp" /> | 191 | <ClCompile Include="CFontTool.cpp" /> |
192 | <ClCompile Include="main.cpp" /> | 192 | <ClCompile Include="main.cpp" /> |
193 | </ItemGroup> | 193 | </ItemGroup> |
194 | <ItemGroup> | 194 | <ItemGroup> |
195 | <ClInclude Include="CFontTool.h" /> | 195 | <ClInclude Include="CFontTool.h" /> |
196 | <ClInclude Include="CVectorFontTool.h" /> | 196 | <ClInclude Include="CVectorFontTool.h" /> |
197 | </ItemGroup> | 197 | </ItemGroup> |
198 | <ItemGroup> | 198 | <ItemGroup> |
199 | <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht11.0.vcxproj"> | 199 | <ProjectReference Include="..\..\..\source\Irrlicht\Irrlicht11.0.vcxproj"> |
200 | <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project> | 200 | <Project>{e08e042a-6c45-411b-92be-3cc31331019f}</Project> |
201 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | 201 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> |
202 | </ProjectReference> | 202 | </ProjectReference> |
203 | </ItemGroup> | 203 | </ItemGroup> |
204 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | 204 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
205 | <ImportGroup Label="ExtensionTargets"> | 205 | <ImportGroup Label="ExtensionTargets"> |
206 | </ImportGroup> | 206 | </ImportGroup> |
207 | </Project> \ No newline at end of file | 207 | </Project> \ No newline at end of file |
diff --git a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/main.cpp b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/main.cpp index 9e9e87f..1170bcc 100644 --- a/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/main.cpp +++ b/libraries/irrlicht-1.8/tools/IrrFontTool/newFontTool/main.cpp | |||
@@ -1,493 +1,493 @@ | |||
1 | /* | 1 | /* |
2 | Tool for creating Irrlicht bitmap+vector fonts, | 2 | Tool for creating Irrlicht bitmap+vector fonts, |
3 | started by Gaz Davidson in December 2006 | 3 | started by Gaz Davidson in December 2006 |
4 | 4 | ||
5 | Due to my laziness and Microsoft's unituitive API, surragate pairs and | 5 | Due to my laziness and Microsoft's unituitive API, surragate pairs and |
6 | nonspacing diacritical marks are not supported! | 6 | nonspacing diacritical marks are not supported! |
7 | 7 | ||
8 | Linux bitmap font support added by Neil Burlock Oct 2008 | 8 | Linux bitmap font support added by Neil Burlock Oct 2008 |
9 | Note: Xft/Freetype2 is used to render the fonts under X11. Anti-aliasing | 9 | Note: Xft/Freetype2 is used to render the fonts under X11. Anti-aliasing |
10 | is controlled by the system and cannot be overriden by an application, | 10 | is controlled by the system and cannot be overriden by an application, |
11 | so fonts that are rendered will be aliased or anti-aliased depending | 11 | so fonts that are rendered will be aliased or anti-aliased depending |
12 | on the system that they are created on. | 12 | on the system that they are created on. |
13 | 13 | ||
14 | */ | 14 | */ |
15 | 15 | ||
16 | 16 | ||
17 | #include <irrlicht.h> | 17 | #include <irrlicht.h> |
18 | #include <iostream> | 18 | #include <iostream> |
19 | 19 | ||
20 | #include "CFontTool.h" | 20 | #include "CFontTool.h" |
21 | #include "CVectorFontTool.h" | 21 | #include "CVectorFontTool.h" |
22 | #include "ITexture.h" | 22 | #include "ITexture.h" |
23 | 23 | ||
24 | using namespace irr; | 24 | using namespace irr; |
25 | using namespace gui; | 25 | using namespace gui; |
26 | 26 | ||
27 | #pragma comment(lib, "Irrlicht.lib") | 27 | #pragma comment(lib, "Irrlicht.lib") |
28 | 28 | ||
29 | const s32 texturesizes[] = {128, 256, 512, 1024, 2048, 4096, 0}; | 29 | const s32 texturesizes[] = {128, 256, 512, 1024, 2048, 4096, 0}; |
30 | 30 | ||
31 | const wchar_t *fileformats[] = { L"bmp", L"ppm", 0 }; // bitmap font formats | 31 | const wchar_t *fileformats[] = { L"bmp", L"ppm", 0 }; // bitmap font formats |
32 | const wchar_t *alphafileformats[] = { L"png", L"tga", 0 }; // bitmap font formats which support alpha channels | 32 | const wchar_t *alphafileformats[] = { L"png", L"tga", 0 }; // bitmap font formats which support alpha channels |
33 | const wchar_t *vectorfileformats[] = { L"xml", L"bin", 0 }; // file formats for vector fonts | 33 | const wchar_t *vectorfileformats[] = { L"xml", L"bin", 0 }; // file formats for vector fonts |
34 | 34 | ||
35 | const wchar_t *warntext = L"Legal Notice\n" | 35 | const wchar_t *warntext = L"Legal Notice\n" |
36 | L"------------\n\n" | 36 | L"------------\n\n" |
37 | L"When making bitmap and vector fonts, you should consider the potential legal " | 37 | L"When making bitmap and vector fonts, you should consider the potential legal " |
38 | L"issues with redistributing the fonts with your software; this tool basically " | 38 | L"issues with redistributing the fonts with your software; this tool basically " |
39 | L"copies font data and some authors might not like this!\n" | 39 | L"copies font data and some authors might not like this!\n" |
40 | L"If you purchased fonts or they came with an application or your OS, you'll have" | 40 | L"If you purchased fonts or they came with an application or your OS, you'll have" |
41 | L"to check the license to see what restrictions are placed on making derivative works.\n\n" | 41 | L"to check the license to see what restrictions are placed on making derivative works.\n\n" |
42 | L"PD and the OFL\n" | 42 | L"PD and the OFL\n" |
43 | L"--------------\n\n" | 43 | L"--------------\n\n" |
44 | L"You'll find lots of fonts on the web listed as Public Domain, you can do what you like " | 44 | L"You'll find lots of fonts on the web listed as Public Domain, you can do what you like " |
45 | L"with these.\n" | 45 | L"with these.\n" |
46 | L"Many fonts are released under the Open Font License, which is a 'viral' open source " | 46 | L"Many fonts are released under the Open Font License, which is a 'viral' open source " |
47 | L"license like the GPL. It's worth reading the license here: http://scripts.sil.org/OFL\n" | 47 | L"license like the GPL. It's worth reading the license here: http://scripts.sil.org/OFL\n" |
48 | L"The most important restrictions are- you must include the original font's license, you " | 48 | L"The most important restrictions are- you must include the original font's license, you " |
49 | L"can't stop your users from using or distributing the font, the font must have a " | 49 | L"can't stop your users from using or distributing the font, the font must have a " |
50 | L"different name the original.\n\n" | 50 | L"different name the original.\n\n" |
51 | L"Some free fonts can be found here- www.openfontlibrary.org\n" | 51 | L"Some free fonts can be found here- www.openfontlibrary.org\n" |
52 | L"http://savannah.nongnu.org/projects/freefont/"; | 52 | L"http://savannah.nongnu.org/projects/freefont/"; |
53 | 53 | ||
54 | const wchar_t *helptext = L"This tool creates bitmap fonts for the Irrlicht Engine\n\n" | 54 | const wchar_t *helptext = L"This tool creates bitmap fonts for the Irrlicht Engine\n\n" |
55 | 55 | ||
56 | L"First select a character encoding from the list, then choose the font, " | 56 | L"First select a character encoding from the list, then choose the font, " |
57 | L"size, and whether you'd like bold, italic, antialiasing and an alpha channel. " | 57 | L"size, and whether you'd like bold, italic, antialiasing and an alpha channel. " |
58 | L"In Windows, antialiasing will be ignored for small fonts\n\n" | 58 | L"In Windows, antialiasing will be ignored for small fonts\n\n" |
59 | 59 | ||
60 | L"Then select a texture width and height. If the output exceeds this then more than " | 60 | L"Then select a texture width and height. If the output exceeds this then more than " |
61 | L"one image will be created. You can use the scrollbar at the top of the screen to " | 61 | L"one image will be created. You can use the scrollbar at the top of the screen to " |
62 | L"preview them. Most modern graphics cards will support up to 2048x2048, " | 62 | L"preview them. Most modern graphics cards will support up to 2048x2048, " |
63 | L"keep in mind that more images means worse performance when drawing text!\n\n" | 63 | L"keep in mind that more images means worse performance when drawing text!\n\n" |
64 | 64 | ||
65 | L"If you want a vector font rather than a bitmap font, check the vector box. " | 65 | L"If you want a vector font rather than a bitmap font, check the vector box. " |
66 | L"Vector fonts are stored in system memory while bitmap fonts are in video ram\n\n" | 66 | L"Vector fonts are stored in system memory while bitmap fonts are in video ram\n\n" |
67 | 67 | ||
68 | L"Click create to preview your font, this may take lots of time and memory " | 68 | L"Click create to preview your font, this may take lots of time and memory " |
69 | L"when making a font with a lot of characters, please be patient!\n\n" | 69 | L"when making a font with a lot of characters, please be patient!\n\n" |
70 | 70 | ||
71 | L"Now you're ready to give your font a name, select a format and click save.\n\n" | 71 | L"Now you're ready to give your font a name, select a format and click save.\n\n" |
72 | L"To load your font in Irrlicht, simply use env->getFont(\"Myfont.xml\");\n\n" | 72 | L"To load your font in Irrlicht, simply use env->getFont(\"Myfont.xml\");\n\n" |
73 | 73 | ||
74 | L"That's all, have fun :-)"; | 74 | L"That's all, have fun :-)"; |
75 | 75 | ||
76 | #ifdef _IRR_WINDOWS_ | 76 | #ifdef _IRR_WINDOWS_ |
77 | const wchar_t *completeText = L"Font created"; | 77 | const wchar_t *completeText = L"Font created"; |
78 | #else | 78 | #else |
79 | const wchar_t *completeText = L"Font created\n\n" | 79 | const wchar_t *completeText = L"Font created\n\n" |
80 | L"Please note that anti-aliasing under X11 is controlled by the system " | 80 | L"Please note that anti-aliasing under X11 is controlled by the system " |
81 | L"configuration, so if your system is set to use anti-aliasing, then so " | 81 | L"configuration, so if your system is set to use anti-aliasing, then so " |
82 | L"will any fonts you create with FontTool"; | 82 | L"will any fonts you create with FontTool"; |
83 | #endif | 83 | #endif |
84 | 84 | ||
85 | enum MYGUI | 85 | enum MYGUI |
86 | { | 86 | { |
87 | MYGUI_CHARSET = 100, | 87 | MYGUI_CHARSET = 100, |
88 | MYGUI_FONTNAME, | 88 | MYGUI_FONTNAME, |
89 | MYGUI_SIZE, | 89 | MYGUI_SIZE, |
90 | MYGUI_TEXWIDTH, | 90 | MYGUI_TEXWIDTH, |
91 | MYGUI_TEXHEIGHT, | 91 | MYGUI_TEXHEIGHT, |
92 | MYGUI_BOLD, | 92 | MYGUI_BOLD, |
93 | MYGUI_ITALIC, | 93 | MYGUI_ITALIC, |
94 | MYGUI_ANTIALIAS, | 94 | MYGUI_ANTIALIAS, |
95 | MYGUI_ALPHA, | 95 | MYGUI_ALPHA, |
96 | MYGUI_VECTOR, | 96 | MYGUI_VECTOR, |
97 | MYGUI_FILENAME, | 97 | MYGUI_FILENAME, |
98 | MYGUI_FORMAT, | 98 | MYGUI_FORMAT, |
99 | MYGUI_CREATE, | 99 | MYGUI_CREATE, |
100 | MYGUI_SAVE, | 100 | MYGUI_SAVE, |
101 | MYGUI_IMAGE, | 101 | MYGUI_IMAGE, |
102 | MYGUI_CURRENTIMAGE, | 102 | MYGUI_CURRENTIMAGE, |
103 | MYGUI_HELPBUTTON | 103 | MYGUI_HELPBUTTON |
104 | }; | 104 | }; |
105 | 105 | ||
106 | 106 | ||
107 | // event reciever | 107 | // event reciever |
108 | class MyEventReceiver : public IEventReceiver | 108 | class MyEventReceiver : public IEventReceiver |
109 | { | 109 | { |
110 | public: | 110 | public: |
111 | 111 | ||
112 | MyEventReceiver(IrrlichtDevice* device, CFontTool*& fonttool, CVectorFontTool* &vectool) : | 112 | MyEventReceiver(IrrlichtDevice* device, CFontTool*& fonttool, CVectorFontTool* &vectool) : |
113 | Device(device), FontTool(fonttool), VecTool(vectool) | 113 | Device(device), FontTool(fonttool), VecTool(vectool) |
114 | { | 114 | { |
115 | device->setEventReceiver(this); | 115 | device->setEventReceiver(this); |
116 | } | 116 | } |
117 | 117 | ||
118 | virtual bool OnEvent(const SEvent &event) | 118 | virtual bool OnEvent(const SEvent &event) |
119 | { | 119 | { |
120 | if (event.EventType == EET_GUI_EVENT) | 120 | if (event.EventType == EET_GUI_EVENT) |
121 | { | 121 | { |
122 | s32 id = event.GUIEvent.Caller->getID(); | 122 | s32 id = event.GUIEvent.Caller->getID(); |
123 | IGUIEnvironment* env = Device->getGUIEnvironment(); | 123 | IGUIEnvironment* env = Device->getGUIEnvironment(); |
124 | 124 | ||
125 | switch(event.GUIEvent.EventType) | 125 | switch(event.GUIEvent.EventType) |
126 | { | 126 | { |
127 | case EGET_SCROLL_BAR_CHANGED: | 127 | case EGET_SCROLL_BAR_CHANGED: |
128 | if (id == MYGUI_CURRENTIMAGE) | 128 | if (id == MYGUI_CURRENTIMAGE) |
129 | { | 129 | { |
130 | IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true); | 130 | IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true); |
131 | s32 i = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); | 131 | s32 i = ((IGUIScrollBar*)event.GUIEvent.Caller)->getPos(); |
132 | img->setImage(FontTool->currentTextures[i]); | 132 | img->setImage(FontTool->currentTextures[i]); |
133 | 133 | ||
134 | return true; | 134 | return true; |
135 | } | 135 | } |
136 | break; | 136 | break; |
137 | case EGET_COMBO_BOX_CHANGED: | 137 | case EGET_COMBO_BOX_CHANGED: |
138 | if (id == MYGUI_CHARSET) | 138 | if (id == MYGUI_CHARSET) |
139 | { | 139 | { |
140 | IGUIComboBox* cbo = (IGUIComboBox*)event.GUIEvent.Caller; | 140 | IGUIComboBox* cbo = (IGUIComboBox*)event.GUIEvent.Caller; |
141 | FontTool->selectCharSet(cbo->getSelected()); | 141 | FontTool->selectCharSet(cbo->getSelected()); |
142 | // rebuild font list | 142 | // rebuild font list |
143 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true); | 143 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true); |
144 | cbo->clear(); | 144 | cbo->clear(); |
145 | for (u32 i=0; i < FontTool->FontNames.size(); ++i) | 145 | for (u32 i=0; i < FontTool->FontNames.size(); ++i) |
146 | cbo->addItem(FontTool->FontNames[i].c_str()); | 146 | cbo->addItem(FontTool->FontNames[i].c_str()); |
147 | return true; | 147 | return true; |
148 | } | 148 | } |
149 | break; | 149 | break; |
150 | case EGET_CHECKBOX_CHANGED: | 150 | case EGET_CHECKBOX_CHANGED: |
151 | if (id == MYGUI_VECTOR) | 151 | if (id == MYGUI_VECTOR) |
152 | { | 152 | { |
153 | IGUICheckBox* chk = (IGUICheckBox*)event.GUIEvent.Caller; | 153 | IGUICheckBox* chk = (IGUICheckBox*)event.GUIEvent.Caller; |
154 | 154 | ||
155 | IGUIComboBox *cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); | 155 | IGUIComboBox *cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); |
156 | cbo->clear(); | 156 | cbo->clear(); |
157 | 157 | ||
158 | if (chk->isChecked() && VecTool) | 158 | if (chk->isChecked() && VecTool) |
159 | { | 159 | { |
160 | // vector formats | 160 | // vector formats |
161 | for (s32 i=0; fileformats[i] != 0; ++i) | 161 | for (s32 i=0; fileformats[i] != 0; ++i) |
162 | cbo->addItem( core::stringw(vectorfileformats[i]).c_str()); | 162 | cbo->addItem( core::stringw(vectorfileformats[i]).c_str()); |
163 | 163 | ||
164 | } | 164 | } |
165 | else | 165 | else |
166 | { | 166 | { |
167 | 167 | ||
168 | // bitmap formats | 168 | // bitmap formats |
169 | if (!FontTool->UseAlphaChannel) | 169 | if (!FontTool->UseAlphaChannel) |
170 | { | 170 | { |
171 | // add non-alpha formats | 171 | // add non-alpha formats |
172 | for (s32 i=0; fileformats[i] != 0; ++i) | 172 | for (s32 i=0; fileformats[i] != 0; ++i) |
173 | cbo->addItem( core::stringw(fileformats[i]).c_str()); | 173 | cbo->addItem( core::stringw(fileformats[i]).c_str()); |
174 | } | 174 | } |
175 | // add formats which support alpha | 175 | // add formats which support alpha |
176 | for (s32 i=0; alphafileformats[i] != 0; ++i) | 176 | for (s32 i=0; alphafileformats[i] != 0; ++i) |
177 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); | 177 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); |
178 | } | 178 | } |
179 | 179 | ||
180 | } | 180 | } |
181 | break; | 181 | break; |
182 | 182 | ||
183 | case EGET_BUTTON_CLICKED: | 183 | case EGET_BUTTON_CLICKED: |
184 | 184 | ||
185 | if (id == MYGUI_CREATE) | 185 | if (id == MYGUI_CREATE) |
186 | { | 186 | { |
187 | // create the font with the params | 187 | // create the font with the params |
188 | IGUIComboBox* cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_CHARSET, true); | 188 | IGUIComboBox* cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_CHARSET, true); |
189 | int charset = cbo->getSelected(); | 189 | int charset = cbo->getSelected(); |
190 | 190 | ||
191 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true); | 191 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FONTNAME,true); |
192 | int fontname = cbo->getSelected(); | 192 | int fontname = cbo->getSelected(); |
193 | 193 | ||
194 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_SIZE,true); | 194 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_SIZE,true); |
195 | int fontsize = cbo->getSelected(); | 195 | int fontsize = cbo->getSelected(); |
196 | 196 | ||
197 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXWIDTH,true); | 197 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXWIDTH,true); |
198 | int texwidth = cbo->getSelected(); | 198 | int texwidth = cbo->getSelected(); |
199 | 199 | ||
200 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXHEIGHT,true); | 200 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_TEXHEIGHT,true); |
201 | int texheight = cbo->getSelected(); | 201 | int texheight = cbo->getSelected(); |
202 | 202 | ||
203 | IGUICheckBox* chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_BOLD,true); | 203 | IGUICheckBox* chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_BOLD,true); |
204 | bool bold = chk->isChecked(); | 204 | bool bold = chk->isChecked(); |
205 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ITALIC,true); | 205 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ITALIC,true); |
206 | bool italic = chk->isChecked(); | 206 | bool italic = chk->isChecked(); |
207 | 207 | ||
208 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ALPHA,true); | 208 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ALPHA,true); |
209 | bool alpha = chk->isChecked(); | 209 | bool alpha = chk->isChecked(); |
210 | 210 | ||
211 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ANTIALIAS,true); | 211 | chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_ANTIALIAS,true); |
212 | bool aa = chk->isChecked(); | 212 | bool aa = chk->isChecked(); |
213 | 213 | ||
214 | // vector fonts disabled | 214 | // vector fonts disabled |
215 | //chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); | 215 | //chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); |
216 | bool vec = false;//chk->isChecked(); | 216 | bool vec = false;//chk->isChecked(); |
217 | 217 | ||
218 | FontTool->makeBitmapFont(fontname, charset, FontTool->FontSizes[fontsize], texturesizes[texwidth], texturesizes[texheight], bold, italic, aa, alpha); | 218 | FontTool->makeBitmapFont(fontname, charset, FontTool->FontSizes[fontsize], texturesizes[texwidth], texturesizes[texheight], bold, italic, aa, alpha); |
219 | 219 | ||
220 | IGUIScrollBar* scrl = (IGUIScrollBar*)env->getRootGUIElement()->getElementFromId(MYGUI_CURRENTIMAGE,true); | 220 | IGUIScrollBar* scrl = (IGUIScrollBar*)env->getRootGUIElement()->getElementFromId(MYGUI_CURRENTIMAGE,true); |
221 | scrl->setMax(FontTool->currentTextures.size() == 0 ? 0 : FontTool->currentTextures.size()-1); | 221 | scrl->setMax(FontTool->currentTextures.size() == 0 ? 0 : FontTool->currentTextures.size()-1); |
222 | 222 | ||
223 | if (FontTool->currentTextures.size() > 0) | 223 | if (FontTool->currentTextures.size() > 0) |
224 | { | 224 | { |
225 | IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true); | 225 | IGUIImage* img = (IGUIImage*)env->getRootGUIElement()->getElementFromId(MYGUI_IMAGE,true); |
226 | img->setImage(FontTool->currentTextures[0]); | 226 | img->setImage(FontTool->currentTextures[0]); |
227 | scrl->setPos(0); | 227 | scrl->setPos(0); |
228 | } | 228 | } |
229 | 229 | ||
230 | // make sure users pick a file format that supports alpha channel | 230 | // make sure users pick a file format that supports alpha channel |
231 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); | 231 | cbo = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); |
232 | cbo->clear(); | 232 | cbo->clear(); |
233 | 233 | ||
234 | if (vec) | 234 | if (vec) |
235 | { | 235 | { |
236 | // add vector formats | 236 | // add vector formats |
237 | for (s32 i=0; fileformats[i] != 0; ++i) | 237 | for (s32 i=0; fileformats[i] != 0; ++i) |
238 | cbo->addItem( core::stringw(vectorfileformats[i]).c_str()); | 238 | cbo->addItem( core::stringw(vectorfileformats[i]).c_str()); |
239 | } | 239 | } |
240 | else | 240 | else |
241 | { | 241 | { |
242 | if (!alpha) | 242 | if (!alpha) |
243 | { | 243 | { |
244 | // add non-alpha formats | 244 | // add non-alpha formats |
245 | for (s32 i=0; fileformats[i] != 0; ++i) | 245 | for (s32 i=0; fileformats[i] != 0; ++i) |
246 | cbo->addItem( core::stringw(fileformats[i]).c_str()); | 246 | cbo->addItem( core::stringw(fileformats[i]).c_str()); |
247 | } | 247 | } |
248 | // add formats which support alpha | 248 | // add formats which support alpha |
249 | for (s32 i=0; alphafileformats[i] != 0; ++i) | 249 | for (s32 i=0; alphafileformats[i] != 0; ++i) |
250 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); | 250 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); |
251 | } | 251 | } |
252 | if (VecTool) | 252 | if (VecTool) |
253 | { | 253 | { |
254 | delete VecTool; | 254 | delete VecTool; |
255 | VecTool = 0; | 255 | VecTool = 0; |
256 | } | 256 | } |
257 | if (vec) | 257 | if (vec) |
258 | { | 258 | { |
259 | VecTool = new CVectorFontTool(FontTool); | 259 | VecTool = new CVectorFontTool(FontTool); |
260 | } | 260 | } |
261 | 261 | ||
262 | /* Message box letting the user know the process is complete */ | 262 | /* Message box letting the user know the process is complete */ |
263 | env->addMessageBox(L"Create", completeText); | 263 | env->addMessageBox(L"Create", completeText); |
264 | 264 | ||
265 | return true; | 265 | return true; |
266 | } | 266 | } |
267 | 267 | ||
268 | if (id == MYGUI_SAVE) | 268 | if (id == MYGUI_SAVE) |
269 | { | 269 | { |
270 | IGUIEditBox *edt = (IGUIEditBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FILENAME,true); | 270 | IGUIEditBox *edt = (IGUIEditBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FILENAME,true); |
271 | core::stringc name = edt->getText(); | 271 | core::stringc name = edt->getText(); |
272 | 272 | ||
273 | IGUIComboBox *fmt = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); | 273 | IGUIComboBox *fmt = (IGUIComboBox*)env->getRootGUIElement()->getElementFromId(MYGUI_FORMAT,true); |
274 | core::stringc format = fmt->getItem(fmt->getSelected()); | 274 | core::stringc format = fmt->getItem(fmt->getSelected()); |
275 | 275 | ||
276 | // vector fonts disabled | 276 | // vector fonts disabled |
277 | IGUICheckBox *chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); | 277 | IGUICheckBox *chk = (IGUICheckBox*)env->getRootGUIElement()->getElementFromId(MYGUI_VECTOR,true); |
278 | bool vec = false; // chk->isChecked(); | 278 | bool vec = false; // chk->isChecked(); |
279 | 279 | ||
280 | if (vec && VecTool) | 280 | if (vec && VecTool) |
281 | VecTool->saveVectorFont(name.c_str(), format.c_str()); | 281 | VecTool->saveVectorFont(name.c_str(), format.c_str()); |
282 | else | 282 | else |
283 | FontTool->saveBitmapFont(name.c_str(), format.c_str()); | 283 | FontTool->saveBitmapFont(name.c_str(), format.c_str()); |
284 | 284 | ||
285 | return true; | 285 | return true; |
286 | } | 286 | } |
287 | 287 | ||
288 | if (id == MYGUI_HELPBUTTON) | 288 | if (id == MYGUI_HELPBUTTON) |
289 | { | 289 | { |
290 | env->addMessageBox(L"Irrlicht Unicode Font Tool", helptext); | 290 | env->addMessageBox(L"Irrlicht Unicode Font Tool", helptext); |
291 | return true; | 291 | return true; |
292 | } | 292 | } |
293 | 293 | ||
294 | break; | 294 | break; |
295 | } | 295 | } |
296 | } | 296 | } |
297 | 297 | ||
298 | return false; | 298 | return false; |
299 | } | 299 | } |
300 | 300 | ||
301 | IrrlichtDevice* Device; | 301 | IrrlichtDevice* Device; |
302 | CFontTool* FontTool; | 302 | CFontTool* FontTool; |
303 | CVectorFontTool* VecTool; | 303 | CVectorFontTool* VecTool; |
304 | 304 | ||
305 | }; | 305 | }; |
306 | 306 | ||
307 | void createGUI(IrrlichtDevice* device, CFontTool* fc) | 307 | void createGUI(IrrlichtDevice* device, CFontTool* fc) |
308 | { | 308 | { |
309 | gui::IGUIEnvironment *env = device->getGUIEnvironment(); | 309 | gui::IGUIEnvironment *env = device->getGUIEnvironment(); |
310 | 310 | ||
311 | // change transparency of skin | 311 | // change transparency of skin |
312 | for (s32 i=0; i<gui::EGDC_COUNT ; ++i) | 312 | for (s32 i=0; i<gui::EGDC_COUNT ; ++i) |
313 | { | 313 | { |
314 | video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i); | 314 | video::SColor col = env->getSkin()->getColor((gui::EGUI_DEFAULT_COLOR)i); |
315 | col.setAlpha(255); | 315 | col.setAlpha(255); |
316 | env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col); | 316 | env->getSkin()->setColor((gui::EGUI_DEFAULT_COLOR)i, col); |
317 | } | 317 | } |
318 | 318 | ||
319 | IGUIWindow *win = env->addWindow( core::rect<s32>(10,10,200,500), false, L"Font Creator"); | 319 | IGUIWindow *win = env->addWindow( core::rect<s32>(10,10,200,500), false, L"Font Creator"); |
320 | win->getCloseButton()->setVisible(false); | 320 | win->getCloseButton()->setVisible(false); |
321 | 321 | ||
322 | s32 xs=10,xp=xs, yp=30, h=20; | 322 | s32 xs=10,xp=xs, yp=30, h=20; |
323 | 323 | ||
324 | env->addStaticText(L"Charset", core::rect<s32>(xp,yp,50,yp+h),false,false, win); | 324 | env->addStaticText(L"Charset", core::rect<s32>(xp,yp,50,yp+h),false,false, win); |
325 | 325 | ||
326 | xp+=60; | 326 | xp+=60; |
327 | 327 | ||
328 | // charset combo | 328 | // charset combo |
329 | gui::IGUIComboBox* cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_CHARSET); | 329 | gui::IGUIComboBox* cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_CHARSET); |
330 | for (u32 i=0; i < fc->CharSets.size(); ++i) | 330 | for (u32 i=0; i < fc->CharSets.size(); ++i) |
331 | cbo->addItem(fc->CharSets[i].c_str()); | 331 | cbo->addItem(fc->CharSets[i].c_str()); |
332 | 332 | ||
333 | yp += (s32)(h*1.5f); | 333 | yp += (s32)(h*1.5f); |
334 | xp = xs; | 334 | xp = xs; |
335 | 335 | ||
336 | env->addStaticText(L"Font", core::rect<s32>(xp,yp,50,yp+h),false,false, win); | 336 | env->addStaticText(L"Font", core::rect<s32>(xp,yp,50,yp+h),false,false, win); |
337 | 337 | ||
338 | xp+=60; | 338 | xp+=60; |
339 | 339 | ||
340 | // font name combo | 340 | // font name combo |
341 | cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_FONTNAME); | 341 | cbo = env->addComboBox( core::rect<s32>(xp,yp,180,yp+h),win, MYGUI_FONTNAME); |
342 | for (u32 i=0; i < fc->FontNames.size(); ++i) | 342 | for (u32 i=0; i < fc->FontNames.size(); ++i) |
343 | cbo->addItem(fc->FontNames[i].c_str()); | 343 | cbo->addItem(fc->FontNames[i].c_str()); |
344 | 344 | ||
345 | yp += (s32)(h*1.5f); | 345 | yp += (s32)(h*1.5f); |
346 | xp = xs; | 346 | xp = xs; |
347 | 347 | ||
348 | env->addStaticText(L"Size", core::rect<s32>(xp,yp,50,yp+h),false,false, win); | 348 | env->addStaticText(L"Size", core::rect<s32>(xp,yp,50,yp+h),false,false, win); |
349 | 349 | ||
350 | xp += 60; | 350 | xp += 60; |
351 | 351 | ||
352 | // font size combo | 352 | // font size combo |
353 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SIZE); | 353 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SIZE); |
354 | for (s32 i=0; fc->FontSizes[i] != 0; ++i) | 354 | for (s32 i=0; fc->FontSizes[i] != 0; ++i) |
355 | cbo->addItem( ((core::stringw(fc->FontSizes[i])) + L"px").c_str()); | 355 | cbo->addItem( ((core::stringw(fc->FontSizes[i])) + L"px").c_str()); |
356 | 356 | ||
357 | xp = xs; | 357 | xp = xs; |
358 | yp += (s32)(h*1.5f); | 358 | yp += (s32)(h*1.5f); |
359 | 359 | ||
360 | // bold checkbox | 360 | // bold checkbox |
361 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_BOLD, L"Bold"); | 361 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_BOLD, L"Bold"); |
362 | 362 | ||
363 | xp += 45; | 363 | xp += 45; |
364 | 364 | ||
365 | // italic checkbox | 365 | // italic checkbox |
366 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ITALIC, L"Italic"); | 366 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ITALIC, L"Italic"); |
367 | 367 | ||
368 | xp += 45; | 368 | xp += 45; |
369 | 369 | ||
370 | // AA checkbox | 370 | // AA checkbox |
371 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ANTIALIAS, L"AA"); | 371 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ANTIALIAS, L"AA"); |
372 | 372 | ||
373 | xp +=40; | 373 | xp +=40; |
374 | 374 | ||
375 | // Alpha checkbox | 375 | // Alpha checkbox |
376 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ALPHA, L"Alpha"); | 376 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_ALPHA, L"Alpha"); |
377 | 377 | ||
378 | xp = xs; | 378 | xp = xs; |
379 | yp += (s32)(h*1.5f); | 379 | yp += (s32)(h*1.5f); |
380 | 380 | ||
381 | /* | 381 | /* |
382 | // vector fonts can't be loaded yet | 382 | // vector fonts can't be loaded yet |
383 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+200,yp+h),win, MYGUI_VECTOR, L"Vector Font"); | 383 | env->addCheckBox(false, core::rect<s32>(xp,yp,xp+200,yp+h),win, MYGUI_VECTOR, L"Vector Font"); |
384 | */ | 384 | */ |
385 | 385 | ||
386 | yp += (s32)(h*1.5f); | 386 | yp += (s32)(h*1.5f); |
387 | 387 | ||
388 | env->addStaticText(L"Max Width:", core::rect<s32>(xp,yp,50,yp+h),false,false, win); | 388 | env->addStaticText(L"Max Width:", core::rect<s32>(xp,yp,50,yp+h),false,false, win); |
389 | 389 | ||
390 | xp += 60; | 390 | xp += 60; |
391 | 391 | ||
392 | // texture widths | 392 | // texture widths |
393 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXWIDTH); | 393 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXWIDTH); |
394 | for (s32 i=0; texturesizes[i] != 0; ++i) | 394 | for (s32 i=0; texturesizes[i] != 0; ++i) |
395 | cbo->addItem( ((core::stringw(texturesizes[i])) + L" wide").c_str()); | 395 | cbo->addItem( ((core::stringw(texturesizes[i])) + L" wide").c_str()); |
396 | 396 | ||
397 | xp=xs; | 397 | xp=xs; |
398 | yp += (s32)(h*1.5f); | 398 | yp += (s32)(h*1.5f); |
399 | 399 | ||
400 | env->addStaticText(L"Max Height:", core::rect<s32>(xp,yp,60,yp+h),false,false, win); | 400 | env->addStaticText(L"Max Height:", core::rect<s32>(xp,yp,60,yp+h),false,false, win); |
401 | 401 | ||
402 | xp += 60; | 402 | xp += 60; |
403 | 403 | ||
404 | // texture height | 404 | // texture height |
405 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXHEIGHT); | 405 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_TEXHEIGHT); |
406 | for (s32 i=0; texturesizes[i] != 0; ++i) | 406 | for (s32 i=0; texturesizes[i] != 0; ++i) |
407 | cbo->addItem( ((core::stringw(texturesizes[i])) + L" tall").c_str()); | 407 | cbo->addItem( ((core::stringw(texturesizes[i])) + L" tall").c_str()); |
408 | 408 | ||
409 | // file name | 409 | // file name |
410 | xp = xs; | 410 | xp = xs; |
411 | yp += (s32)(h*1.5f); | 411 | yp += (s32)(h*1.5f); |
412 | env->addStaticText(L"Filename", core::rect<s32>(xp,yp,60,yp+h),false,false, win); | 412 | env->addStaticText(L"Filename", core::rect<s32>(xp,yp,60,yp+h),false,false, win); |
413 | xp += 60; | 413 | xp += 60; |
414 | env->addEditBox(L"myfont",core::rect<s32>(xp,yp,xp+70,yp+h), true, win, MYGUI_FILENAME); | 414 | env->addEditBox(L"myfont",core::rect<s32>(xp,yp,xp+70,yp+h), true, win, MYGUI_FILENAME); |
415 | 415 | ||
416 | // file format | 416 | // file format |
417 | xp = xs; | 417 | xp = xs; |
418 | yp += (s32)(h*1.5f); | 418 | yp += (s32)(h*1.5f); |
419 | env->addStaticText(L"File Format", core::rect<s32>(xp,yp,60,yp+h),false,false, win); | 419 | env->addStaticText(L"File Format", core::rect<s32>(xp,yp,60,yp+h),false,false, win); |
420 | xp += 60; | 420 | xp += 60; |
421 | 421 | ||
422 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_FORMAT); | 422 | cbo = env->addComboBox( core::rect<s32>(xp,yp,xp+70,yp+h),win, MYGUI_FORMAT); |
423 | for (s32 i=0; fileformats[i] != 0; ++i) | 423 | for (s32 i=0; fileformats[i] != 0; ++i) |
424 | cbo->addItem( core::stringw(fileformats[i]).c_str()); | 424 | cbo->addItem( core::stringw(fileformats[i]).c_str()); |
425 | for (s32 i=0; alphafileformats[i] != 0; ++i) | 425 | for (s32 i=0; alphafileformats[i] != 0; ++i) |
426 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); | 426 | cbo->addItem( core::stringw(alphafileformats[i]).c_str()); |
427 | 427 | ||
428 | xp = xs; | 428 | xp = xs; |
429 | yp += h*2; | 429 | yp += h*2; |
430 | 430 | ||
431 | // create button | 431 | // create button |
432 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_CREATE, L"Create"); | 432 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_CREATE, L"Create"); |
433 | 433 | ||
434 | xp += 60; | 434 | xp += 60; |
435 | 435 | ||
436 | // save button | 436 | // save button |
437 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SAVE, L"Save"); | 437 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_SAVE, L"Save"); |
438 | 438 | ||
439 | xp += 60; | 439 | xp += 60; |
440 | 440 | ||
441 | // help button | 441 | // help button |
442 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_HELPBUTTON, L"Help"); | 442 | env->addButton( core::rect<s32>(xp,yp,xp+50,yp+h),win, MYGUI_HELPBUTTON, L"Help"); |
443 | 443 | ||
444 | // font image | 444 | // font image |
445 | gui::IGUIImage *img = env->addImage(0, core::position2d<s32>(0,0), true,0, MYGUI_IMAGE); | 445 | gui::IGUIImage *img = env->addImage(0, core::position2d<s32>(0,0), true,0, MYGUI_IMAGE); |
446 | img->setRelativePosition(core::rect<s32>(0,20,800,600)); | 446 | img->setRelativePosition(core::rect<s32>(0,20,800,600)); |
447 | 447 | ||
448 | // font scrollbar | 448 | // font scrollbar |
449 | IGUIScrollBar *scrl= env->addScrollBar(true,core::rect<s32>(0,0,800,20),0, MYGUI_CURRENTIMAGE); | 449 | IGUIScrollBar *scrl= env->addScrollBar(true,core::rect<s32>(0,0,800,20),0, MYGUI_CURRENTIMAGE); |
450 | scrl->setMax(0); | 450 | scrl->setMax(0); |
451 | scrl->setSmallStep(1); | 451 | scrl->setSmallStep(1); |
452 | 452 | ||
453 | yp += h*3; | 453 | yp += h*3; |
454 | 454 | ||
455 | env->getRootGUIElement()->bringToFront(win); | 455 | env->getRootGUIElement()->bringToFront(win); |
456 | win->setRelativePosition( core::rect<s32>(10,10,200,yp)); | 456 | win->setRelativePosition( core::rect<s32>(10,10,200,yp)); |
457 | } | 457 | } |
458 | 458 | ||
459 | int main() | 459 | int main() |
460 | { | 460 | { |
461 | IrrlichtDevice* device =createDevice(video::EDT_OPENGL, core::dimension2du(800, 600)); | 461 | IrrlichtDevice* device =createDevice(video::EDT_OPENGL, core::dimension2du(800, 600)); |
462 | video::IVideoDriver* driver = device->getVideoDriver(); | 462 | video::IVideoDriver* driver = device->getVideoDriver(); |
463 | scene::ISceneManager* smgr = device->getSceneManager(); | 463 | scene::ISceneManager* smgr = device->getSceneManager(); |
464 | gui::IGUIEnvironment *env = device->getGUIEnvironment(); | 464 | gui::IGUIEnvironment *env = device->getGUIEnvironment(); |
465 | 465 | ||
466 | // create font tool | 466 | // create font tool |
467 | CFontTool *fc = new CFontTool(device); | 467 | CFontTool *fc = new CFontTool(device); |
468 | CVectorFontTool *vc = 0; | 468 | CVectorFontTool *vc = 0; |
469 | 469 | ||
470 | IEventReceiver *events = new MyEventReceiver(device,fc,vc); | 470 | IEventReceiver *events = new MyEventReceiver(device,fc,vc); |
471 | 471 | ||
472 | createGUI(device, fc); | 472 | createGUI(device, fc); |
473 | 473 | ||
474 | while(device->run()) | 474 | while(device->run()) |
475 | { | 475 | { |
476 | if (device->isWindowActive()) | 476 | if (device->isWindowActive()) |
477 | { | 477 | { |
478 | 478 | ||
479 | driver->beginScene(true, true, video::SColor(0,200,200,200)); | 479 | driver->beginScene(true, true, video::SColor(0,200,200,200)); |
480 | smgr->drawAll(); | 480 | smgr->drawAll(); |
481 | env->drawAll(); | 481 | env->drawAll(); |
482 | driver->endScene(); | 482 | driver->endScene(); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | // drop the font tool and resources | 486 | // drop the font tool and resources |
487 | fc->drop(); | 487 | fc->drop(); |
488 | 488 | ||
489 | device->drop(); | 489 | device->drop(); |
490 | 490 | ||
491 | return 0; | 491 | return 0; |
492 | } | 492 | } |
493 | 493 | ||