SplashScreen::SplashScreen(ViewManager& vm, specter::ViewResources& res) : ModalWindow(res, vm.rootView(), specter::RectangleConstraint(SPLASH_WIDTH * res.pixelFactor(), SPLASH_HEIGHT * res.pixelFactor())), m_vm(vm), m_textColor(res.themeData().uiText()), m_textColorClear(m_textColor), m_newString(m_vm.translateOr("new_project", "New Project")), m_newProjBind(*this), m_openString(m_vm.translateOr("open_project", "Open Project")), m_openProjBind(*this), m_extractString(m_vm.translateOr("extract_game", "Extract Game")), m_extractProjBind(*this) { if (GIT_COMMIT_DATE[0] != '\0' && GIT_COMMIT_HASH[0] != '\0' && GIT_BRANCH[0] != '\0') { m_buildInfoStr = hecl::Format("%s: %s\n%s: %s\n%s: %s", vm.translateOr("branch", "Branch").c_str(), GIT_BRANCH, vm.translateOr("commit", "Commit").c_str(), GIT_COMMIT_HASH, vm.translateOr("date", "Date").c_str(), GIT_COMMIT_DATE); } m_openProjBind.m_openRecentMenuRoot.m_text = vm.translateOr("recent_projects", "Recent Projects"); m_textColorClear[3] = 0.0; commitResources(res); }
Menu::ItemView::ItemView(ViewResources& res, Menu& menu, std::string_view text, size_t idx, IMenuNode* node) : View(res, menu), m_menu(menu), m_idx(idx), m_node(node) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); return true; }); m_textView.reset(new specter::TextView(res, *this, res.m_mainFont)); m_textView->typesetGlyphs(text, res.themeData().uiText()); }
Menu::Menu(ViewResources& res, View& parentView, IMenuNode* rootNode) : View(res, parentView) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); m_vertsBinding.init(ctx, res, 8, m_viewVertBlockBuf); return true; }); m_headText.reset(new TextView(res, *this, res.m_mainFont)); m_scroll.m_view.reset(new ScrollView(res, *this, ScrollView::Style::ThinIndicator)); m_content.reset(new ContentView(res, *this)); m_scroll.m_view->setContentView(m_content.get()); reset(rootNode); }
Menu::ContentView::ContentView(ViewResources& res, Menu& menu) : View(res, menu), m_menu(menu) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); m_hlVertsBinding.init(ctx, res, 4, m_viewVertBlockBuf); return true; }); m_hlVerts[0].m_color = res.themeData().button1Hover(); m_hlVerts[1].m_color = res.themeData().button2Hover(); m_hlVerts[2].m_color = res.themeData().button1Hover(); m_hlVerts[3].m_color = res.themeData().button2Hover(); }
ScrollView::ScrollView(ViewResources& res, View& parentView, Style style) : View(res, parentView), m_style(style), m_sideButtonBind(*this, rootView().viewManager()) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); m_vertsBinding.init(ctx, res, 4, m_viewVertBlockBuf); return true; }); if (style == Style::SideButtons) { m_sideButtons[0].m_view.reset(new Button(res, *this, &m_sideButtonBind, "<")); m_sideButtons[1].m_view.reset(new Button(res, *this, &m_sideButtonBind, ">")); } }
IconView::IconView(ViewResources& res, View& parentView, Icon& icon) : View(res, parentView) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); m_vertexBinding.init(ctx, res, 4, m_viewVertBlockBuf, icon.m_tex); return true; }); TexShaderVert verts[] = { {{0, 1, 0}, icon.m_uvCoords[0]}, {{0, 0, 0}, icon.m_uvCoords[1]}, {{1, 1, 0}, icon.m_uvCoords[2]}, {{1, 0, 0}, icon.m_uvCoords[3]}, }; m_vertexBinding.load<decltype(verts)>(verts); setBackground(zeus::skBlue); }
MultiLineTextView::MultiLineTextView(ViewResources& res, View& parentView, const FontAtlas& font, TextView::Alignment align, size_t lineCapacity, float lineHeight) : View(res, parentView), m_viewSystem(res), m_fontAtlas(font), m_align(align), m_lineCapacity(lineCapacity), m_lineHeight(lineHeight) { commitResources(res, [&](boo::IGraphicsDataFactory::Context& ctx) -> bool { buildResources(ctx, res); return true; }); }