mirror of
https://github.com/DarkStore-3DS/Universal-Core.git
synced 2026-07-02 16:59:05 +00:00
Use const reference for text
This commit is contained in:
@@ -190,7 +190,7 @@ Result Gui::reinit(CFG_Region fontRegion) {
|
|||||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||||
int flags: (Optional) C2D text flags to use.
|
int flags: (Optional) C2D text flags to use.
|
||||||
*/
|
*/
|
||||||
void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
void Gui::DrawStringCentered(float x, float y, float size, u32 color, const std::string &Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
||||||
Gui::DrawString(x +(currentScreen ? 200 : 160), y, size, color, Text, maxWidth, maxHeight, fnt, flags | C2D_AlignCenter);
|
Gui::DrawString(x +(currentScreen ? 200 : 160), y, size, color, Text, maxWidth, maxHeight, fnt, flags | C2D_AlignCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ void Gui::DrawStringCentered(float x, float y, float size, u32 color, std::strin
|
|||||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||||
int flags: (Optional) C2D text flags to use.
|
int flags: (Optional) C2D text flags to use.
|
||||||
*/
|
*/
|
||||||
void Gui::DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
void Gui::DrawString(float x, float y, float size, u32 color, const std::string &Text, int maxWidth, int maxHeight, C2D_Font fnt, int flags) {
|
||||||
C2D_Text c2d_text;
|
C2D_Text c2d_text;
|
||||||
|
|
||||||
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
||||||
@@ -259,7 +259,7 @@ void Gui::DrawString(float x, float y, float size, u32 color, std::string Text,
|
|||||||
std::string Text: The Text.
|
std::string Text: The Text.
|
||||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||||
*/
|
*/
|
||||||
float Gui::GetStringWidth(float size, std::string Text, C2D_Font fnt) {
|
float Gui::GetStringWidth(float size, const std::string &Text, C2D_Font fnt) {
|
||||||
float width = 0;
|
float width = 0;
|
||||||
|
|
||||||
if (fnt) GetStringSize(size, &width, NULL, Text, fnt);
|
if (fnt) GetStringSize(size, &width, NULL, Text, fnt);
|
||||||
@@ -277,7 +277,7 @@ float Gui::GetStringWidth(float size, std::string Text, C2D_Font fnt) {
|
|||||||
std::string Text: The Text.
|
std::string Text: The Text.
|
||||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||||
*/
|
*/
|
||||||
void Gui::GetStringSize(float size, float *width, float *height, std::string Text, C2D_Font fnt) {
|
void Gui::GetStringSize(float size, float *width, float *height, const std::string &Text, C2D_Font fnt) {
|
||||||
C2D_Text c2d_text;
|
C2D_Text c2d_text;
|
||||||
|
|
||||||
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
if (fnt) C2D_TextFontParse(&c2d_text, fnt, TextBuf, Text.c_str());
|
||||||
@@ -294,11 +294,11 @@ void Gui::GetStringSize(float size, float *width, float *height, std::string Tex
|
|||||||
std::string Text: The Text.
|
std::string Text: The Text.
|
||||||
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
C2D_Font fnt: (Optional) The wanted C2D_Font. Is nullptr by default.
|
||||||
*/
|
*/
|
||||||
float Gui::GetStringHeight(float size, std::string Text, C2D_Font fnt) {
|
float Gui::GetStringHeight(float size, const std::string &Text, C2D_Font fnt) {
|
||||||
float height = 0;
|
float height = 0;
|
||||||
|
|
||||||
if (fnt) GetStringSize(size, NULL, &height, Text.c_str(), fnt);
|
if (fnt) GetStringSize(size, NULL, &height, Text, fnt);
|
||||||
else GetStringSize(size, NULL, &height, Text.c_str());
|
else GetStringSize(size, NULL, &height, Text);
|
||||||
|
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ namespace Gui {
|
|||||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||||
int flags: C2D text flags to use. (Optional!)
|
int flags: C2D text flags to use. (Optional!)
|
||||||
*/
|
*/
|
||||||
void DrawStringCentered(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
void DrawStringCentered(float x, float y, float size, u32 color, const std::string &Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Draws a String.
|
Draws a String.
|
||||||
@@ -136,7 +136,7 @@ namespace Gui {
|
|||||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||||
flags: C2D text flags to use.
|
flags: C2D text flags to use.
|
||||||
*/
|
*/
|
||||||
void DrawString(float x, float y, float size, u32 color, std::string Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
void DrawString(float x, float y, float size, u32 color, const std::string &Text, int maxWidth = 0, int maxHeight = 0, C2D_Font fnt = nullptr, int flags = 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the width of a String.
|
Get the width of a String.
|
||||||
@@ -145,7 +145,7 @@ namespace Gui {
|
|||||||
Text: The Text where the width should be getted from.
|
Text: The Text where the width should be getted from.
|
||||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||||
*/
|
*/
|
||||||
float GetStringWidth(float size, std::string Text, C2D_Font fnt = nullptr);
|
float GetStringWidth(float size, const std::string &Text, C2D_Font fnt = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the size of a String.
|
Get the size of a String.
|
||||||
@@ -156,7 +156,7 @@ namespace Gui {
|
|||||||
Text: The Text where the size should be getted from.
|
Text: The Text where the size should be getted from.
|
||||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||||
*/
|
*/
|
||||||
void GetStringSize(float size, float *width, float *height, std::string Text, C2D_Font fnt = nullptr);
|
void GetStringSize(float size, float *width, float *height, const std::string &Text, C2D_Font fnt = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Get the height of a String.
|
Get the height of a String.
|
||||||
@@ -165,7 +165,7 @@ namespace Gui {
|
|||||||
Text: The Text where the height should be getted from.
|
Text: The Text where the height should be getted from.
|
||||||
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
fnt: The Font which should be used. Uses SystemFont by default. (Optional!)
|
||||||
*/
|
*/
|
||||||
float GetStringHeight(float size, std::string Text, C2D_Font fnt = nullptr);
|
float GetStringHeight(float size, const std::string &Text, C2D_Font fnt = nullptr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Draw a Rectangle.
|
Draw a Rectangle.
|
||||||
|
|||||||
Reference in New Issue
Block a user