mirror of
https://github.com/wiiu-env/WiiUPluginLoaderBackend.git
synced 2024-11-22 04:39:17 +01:00
Truncate the headline in config menu
This commit is contained in:
parent
80d577b1dd
commit
f6d8e850d2
@ -367,7 +367,7 @@ void ConfigUtils::displayMenu() {
|
||||
|
||||
// draw top bar
|
||||
DrawUtils::setFontSize(24);
|
||||
DrawUtils::print(16, 6 + 24, currentConfig->config->getName().c_str());
|
||||
DrawUtils::print(16, 6 + 24, StringTools::truncate(currentConfig->config->getName(), 45).c_str());
|
||||
DrawUtils::setFontSize(18);
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, currentConfig->version.c_str(), true);
|
||||
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
||||
@ -490,7 +490,7 @@ void ConfigUtils::displayMenu() {
|
||||
auto headline = string_format("%s - %s", currentConfig->config->getName().c_str(), currentCategory->getName().c_str());
|
||||
// draw top bar
|
||||
DrawUtils::setFontSize(24);
|
||||
DrawUtils::print(16, 6 + 24, headline.c_str());
|
||||
DrawUtils::print(16, 6 + 24, StringTools::truncate(headline, 45).c_str());
|
||||
DrawUtils::drawRectFilled(8, 8 + 24 + 4, SCREEN_WIDTH - 8 * 2, 3, COLOR_BLACK);
|
||||
DrawUtils::setFontSize(18);
|
||||
DrawUtils::print(SCREEN_WIDTH - 16, 8 + 24, currentConfig->version.c_str(), true);
|
||||
|
@ -30,6 +30,17 @@
|
||||
#include <utils/StringTools.h>
|
||||
#include <wut_types.h>
|
||||
|
||||
std::string StringTools::truncate(const std::string &str, size_t width, bool show_ellipsis) {
|
||||
if (str.length() > width - 3) {
|
||||
if (show_ellipsis) {
|
||||
return str.substr(0, width - 3) + "...";
|
||||
} else {
|
||||
return str.substr(0, width - 3);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
int32_t StringTools::strtokcmp(const char *string, const char *compare, const char *separator) {
|
||||
if (!string || !compare)
|
||||
return -1;
|
||||
|
@ -50,8 +50,9 @@ std::string string_format(const std::string &format, Args... args) {
|
||||
|
||||
class StringTools {
|
||||
public:
|
||||
static int32_t strtokcmp(const char *string, const char *compare, const char *separator);
|
||||
static std::string truncate(const std::string &str, size_t width, bool show_ellipsis = true);
|
||||
|
||||
static int32_t strtokcmp(const char *string, const char *compare, const char *separator);
|
||||
|
||||
static const char *FullpathToFilename(const char *path) {
|
||||
if (!path)
|
||||
|
Loading…
Reference in New Issue
Block a user