//============================================================================= //============================================================================= void UTBRendererBatcher::LoadDefaultResources() { g_tb_lng->Load("resources/language/lng_en.tb.txt"); // Load the default skin, and override skin that contains the graphics specific to the demo. g_tb_skin->Load("resources/default_skin/skin.tb.txt", "demo01/skin/skin.tb.txt"); // **README** // - define TB_FONT_RENDERER_FREETYPE in tb_config.h for non-demo #ifdef TB_FONT_RENDERER_TBBF void register_tbbf_font_renderer(); register_tbbf_font_renderer(); #endif #ifdef TB_FONT_RENDERER_STB void register_stb_font_renderer(); register_stb_font_renderer(); #endif #ifdef TB_FONT_RENDERER_FREETYPE void register_freetype_font_renderer(); register_freetype_font_renderer(); #endif // Add fonts we can use to the font manager. #if defined(TB_FONT_RENDERER_STB) || defined(TB_FONT_RENDERER_FREETYPE) g_font_manager->AddFontInfo("resources/vera.ttf", "Vera"); #endif #ifdef TB_FONT_RENDERER_TBBF g_font_manager->AddFontInfo("resources/default_font/segoe_white_with_shadow.tb.txt", "Segoe"); g_font_manager->AddFontInfo("fonts/neon.tb.txt", "Neon"); g_font_manager->AddFontInfo("fonts/orangutang.tb.txt", "Orangutang"); g_font_manager->AddFontInfo("fonts/orange.tb.txt", "Orange"); #endif // Set the default font description for widgets to one of the fonts we just added TBFontDescription fd; #ifdef TB_FONT_RENDERER_TBBF fd.SetID(TBIDC("Segoe")); #else fd.SetID(TBIDC("Vera")); #endif fd.SetSize(g_tb_skin->GetDimensionConverter()->DpToPx(14)); g_font_manager->SetDefaultFontDescription(fd); // Create the font now. TBFontFace *font = g_font_manager->CreateFontFace(g_font_manager->GetDefaultFontDescription()); // Render some glyphs in one go now since we know we are going to use them. It would work fine // without this since glyphs are rendered when needed, but with some extra updating of the glyph bitmap. if ( font ) { font->RenderGlyphs(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~•·åäöÅÄÖ"); } root_.SetSkinBg(TBIDC("background")); TBWidgetsAnimationManager::Init(); }
int app_main() { application = new DemoApplication(); ApplicationBackend *application_backend = ApplicationBackend::Create(application, 1280, 700, "Demo"); if (!application_backend) return 1; tb_core_init(application_backend->GetRenderer(), "resources/language/lng_en.tb.txt"); // Load the default skin, and override skin that contains the graphics specific to the demo. g_tb_skin->Load("resources/default_skin/skin.tb.txt", "Demo/demo01/skin/skin.tb.txt"); // Register font renderers. #ifdef TB_FONT_RENDERER_TBBF void register_tbbf_font_renderer(); register_tbbf_font_renderer(); #endif #ifdef TB_FONT_RENDERER_STB void register_stb_font_renderer(); register_stb_font_renderer(); #endif #ifdef TB_FONT_RENDERER_FREETYPE void register_freetype_font_renderer(); register_freetype_font_renderer(); #endif // Add fonts we can use to the font manager. #if defined(TB_FONT_RENDERER_STB) || defined(TB_FONT_RENDERER_FREETYPE) g_font_manager->AddFontInfo("resources/vera.ttf", "Vera"); #endif #ifdef TB_FONT_RENDERER_TBBF g_font_manager->AddFontInfo("resources/default_font/segoe_white_with_shadow.tb.txt", "Segoe"); g_font_manager->AddFontInfo("Demo/fonts/neon.tb.txt", "Neon"); g_font_manager->AddFontInfo("Demo/fonts/orangutang.tb.txt", "Orangutang"); g_font_manager->AddFontInfo("Demo/fonts/orange.tb.txt", "Orange"); #endif // Set the default font description for widgets to one of the fonts we just added TBFontDescription fd; #ifdef TB_FONT_RENDERER_TBBF fd.SetID(TBIDC("Segoe")); #else fd.SetID(TBIDC("Vera")); #endif fd.SetSize(g_tb_skin->GetDimensionConverter()->DpToPx(14)); g_font_manager->SetDefaultFontDescription(fd); // Create the font now. TBFontFace *font = g_font_manager->CreateFontFace(g_font_manager->GetDefaultFontDescription()); // Render some glyphs in one go now since we know we are going to use them. It would work fine // without this since glyphs are rendered when needed, but with some extra updating of the glyph bitmap. if (font) font->RenderGlyphs(" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~•·åäöÅÄÖ"); // Give the root widget a background skin application->GetRoot()->SetSkinBg(TBIDC("background")); application->Init(); application->Run(); application->ShutDown(); delete application; return 0; }