mirror of
				https://github.com/ciphervance/supercell-wx.git
				synced 2025-10-31 11:00:06 +00:00 
			
		
		
		
	Use dynamically sized ImGui fonts
This commit is contained in:
		
							parent
							
								
									dc96e3e3ad
								
							
						
					
					
						commit
						c82b9753c6
					
				
					 12 changed files with 89 additions and 88 deletions
				
			
		|  | @ -1,6 +1,5 @@ | |||
| #include <scwx/qt/gl/draw/placefile_text.hpp> | ||||
| #include <scwx/qt/manager/font_manager.hpp> | ||||
| #include <scwx/qt/manager/placefile_manager.hpp> | ||||
| #include <scwx/qt/settings/text_settings.hpp> | ||||
| #include <scwx/qt/util/maplibre.hpp> | ||||
| #include <scwx/qt/util/tooltip.hpp> | ||||
|  | @ -62,8 +61,12 @@ public: | |||
|    std::vector<std::shared_ptr<const gr::Placefile::TextDrawItem>> textList_ {}; | ||||
|    std::vector<std::shared_ptr<const gr::Placefile::TextDrawItem>> newList_ {}; | ||||
| 
 | ||||
|    std::vector<std::shared_ptr<types::ImGuiFont>> fonts_ {}; | ||||
|    std::vector<std::shared_ptr<types::ImGuiFont>> newFonts_ {}; | ||||
|    std::vector<std::pair<std::shared_ptr<types::ImGuiFont>, | ||||
|                          units::font_size::pixels<int>>> | ||||
|       fonts_ {}; | ||||
|    std::vector<std::pair<std::shared_ptr<types::ImGuiFont>, | ||||
|                          units::font_size::pixels<int>>> | ||||
|       newFonts_ {}; | ||||
| }; | ||||
| 
 | ||||
| PlacefileText::PlacefileText(const std::string& placefileName) : | ||||
|  | @ -159,7 +162,8 @@ void PlacefileText::Impl::RenderTextDrawItem( | |||
|       std::size_t fontNumber = std::clamp<std::size_t>(di->fontNumber_, 0, 8); | ||||
| 
 | ||||
|       // Set the font for the drop shadow and text
 | ||||
|       ImGui::PushFont(fonts_[fontNumber]->font(), 0.0f); | ||||
|       ImGui::PushFont(fonts_[fontNumber].first->font(), | ||||
|                       fonts_[fontNumber].second.value()); | ||||
| 
 | ||||
|       if (settings::TextSettings::Instance() | ||||
|              .placefile_text_drop_shadow_enabled() | ||||
|  | @ -261,9 +265,7 @@ void PlacefileText::StartText() | |||
|    p->newList_.clear(); | ||||
| } | ||||
| 
 | ||||
| void PlacefileText::SetFonts( | ||||
|    const boost::unordered_flat_map<std::size_t, | ||||
|                                    std::shared_ptr<types::ImGuiFont>>& fonts) | ||||
| void PlacefileText::SetFonts(const manager::PlacefileManager::FontMap& fonts) | ||||
| { | ||||
|    auto defaultFont = manager::FontManager::Instance().GetImGuiFont( | ||||
|       types::FontCategory::Default); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Dan Paulat
						Dan Paulat