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