From fc5b4a76366b865ac3497cf8776db003f30d1825 Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Mon, 22 Jul 2013 16:42:41 +0300 Subject: [PATCH] [graphics] function to get density by name --- graphics/defines.cpp | 5 +++++ graphics/defines.hpp | 3 +++ 2 files changed, 8 insertions(+) diff --git a/graphics/defines.cpp b/graphics/defines.cpp index 827df1e45a..ee79844a1d 100644 --- a/graphics/defines.cpp +++ b/graphics/defines.cpp @@ -68,6 +68,11 @@ namespace graphics return FindSecondByFirst(s_density, density); } + void convert(char const * name, EDensity & density) + { + density = static_cast(FindFirstBySecond(s_density, name, EqualStrings())); + } + string const resourcePath(string const & name, EDensity d) { return my::JoinFoldersToPath(string("resources-") + convert(d), name); diff --git a/graphics/defines.hpp b/graphics/defines.hpp index a31ed1b0a5..b3654399bd 100644 --- a/graphics/defines.hpp +++ b/graphics/defines.hpp @@ -19,6 +19,9 @@ namespace graphics /// get density name char const * convert(EDensity density); + /// get density from name + void convert(char const * name, EDensity & density); + /// get resource name for specified density string const resourcePath(string const & name, EDensity density);