summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/10-font/font.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/bgfx/examples/10-font/font.cpp')
-rw-r--r--3rdparty/bgfx/examples/10-font/font.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/3rdparty/bgfx/examples/10-font/font.cpp b/3rdparty/bgfx/examples/10-font/font.cpp
index 97111e1b175..a15cef4baae 100644
--- a/3rdparty/bgfx/examples/10-font/font.cpp
+++ b/3rdparty/bgfx/examples/10-font/font.cpp
@@ -14,6 +14,9 @@
#include "font/text_buffer_manager.h"
#include "entry/input.h"
+#include <iconfontheaders/icons_font_awesome.h>
+#include <iconfontheaders/icons_kenney.h>
+
#include <stdio.h>
#include <wchar.h>
@@ -105,10 +108,12 @@ int _main_(int _argc, char** _argv)
}
TrueTypeHandle fontAwesomeTtf = loadTtf(fontManager, "font/fontawesome-webfont.ttf");
+ TrueTypeHandle fontKenneyTtf = loadTtf(fontManager, "font/kenney-icon-font.ttf");
// This font doesn't have any preloaded glyph's but the truetype file
// is loaded so glyph will be generated as needed.
FontHandle fontAwesome72 = fontManager->createFontByPixelSize(fontAwesomeTtf, 0, 72);
+ FontHandle fontKenney64 = fontManager->createFontByPixelSize(fontKenneyTtf, 0, 64);
TrueTypeHandle visitorTtf = loadTtf(fontManager, "font/visitor1.ttf");
@@ -160,7 +165,24 @@ int _main_(int _argc, char** _argv)
textBufferManager->appendText(staticText, fonts[0], L"dog\n");
textBufferManager->setStyle(staticText, STYLE_NORMAL);
- textBufferManager->appendText(staticText, fontAwesome72, L"\xf011 \xf02e \xf061 \xf087 \xf0d9 \xf099 \xf05c \xf021 \xf113\n");
+ textBufferManager->appendText(staticText, fontAwesome72,
+ " " ICON_FA_POWER_OFF
+ " " ICON_FA_TWITTER_SQUARE
+ " " ICON_FA_CERTIFICATE
+ " " ICON_FA_FLOPPY_O
+ " " ICON_FA_GITHUB
+ " " ICON_FA_GITHUB_ALT
+ "\n"
+ );
+ textBufferManager->appendText(staticText, fontKenney64,
+ " " ICON_KI_COMPUTER
+ " " ICON_KI_JOYSTICK
+ " " ICON_KI_EXLAMATION
+ " " ICON_KI_STAR
+ " " ICON_KI_BUTTON_START
+ " " ICON_KI_DOWNLOAD
+ "\n"
+ );
// Create a transient buffer for real-time data.
TextBufferHandle transientText = textBufferManager->createTextBuffer(FONT_TYPE_ALPHA, BufferType::Transient);
@@ -242,10 +264,12 @@ int _main_(int _argc, char** _argv)
bgfx::frame();
}
+ fontManager->destroyTtf(fontKenneyTtf);
fontManager->destroyTtf(fontAwesomeTtf);
fontManager->destroyTtf(visitorTtf);
// Destroy the fonts.
+ fontManager->destroyFont(fontKenney64);
fontManager->destroyFont(fontAwesome72);
fontManager->destroyFont(visitor10);
for (uint32_t ii = 0; ii < numFonts; ++ii)