2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-06-30 19:03:42 -04:00

Removed FormatText + SubText change

- Using built in string.Format instead of FormatText.
- SubText changed to extension method for a string that uses Substring and a bound limit.
This commit is contained in:
2018-10-25 17:21:47 +01:00
parent 696a9cf14a
commit 67d5628fe3
18 changed files with 52 additions and 65 deletions

View File

@ -49,9 +49,8 @@ public partial class text_bmfont_unordered
ClearBackground(RAYWHITE);
DrawText("Font name: PixAntiqua", 40, 50, 20, GRAY);
//TODO: Uncomment this code when FormatText is fixed.
// DrawText(FormatText("Font base size: %i", font.baseSize), 40, 80, 20, GRAY);
// DrawText(FormatText("Font chars number: %i", font.charsCount), 40, 110, 20, GRAY);
DrawText(string.Format("Font base size: {0}", font.baseSize), 40, 80, 20, GRAY);
DrawText(string.Format("Font chars number: {0}", font.charsCount), 40, 110, 20, GRAY);
DrawTextEx(font, msg, new Vector2(40, 180), font.baseSize, 0, MAROON);

View File

@ -111,7 +111,7 @@ public partial class text_font_sdf
else DrawText("default font", 315, 40, 30, GRAY);
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, DARKGRAY);
DrawText(FormatText("RENDER SIZE: %02.02f", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY);
DrawText(string.Format("RENDER SIZE: {0:00.00}", fontSize), GetScreenWidth() - 240, 50, 20, DARKGRAY);
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, DARKGRAY);
DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, MAROON);

View File

@ -44,14 +44,14 @@ public partial class text_format_text
BeginDrawing();
ClearBackground(RAYWHITE);
DrawText(string.Format("Score: {0:00000000}", score), 200, 80, 20, RED);
DrawText(FormatText("Score: %08i", score), 200, 80, 20, RED);
DrawText(string.Format("HiScore: {0:00000000}", hiscore), 200, 120, 20, GREEN);
DrawText(FormatText("HiScore: %08i", hiscore), 200, 120, 20, GREEN);
DrawText(string.Format("Lives: {0:00}", lives), 200, 160, 40, BLUE);
DrawText(FormatText("Lives: %02i", lives), 200, 160, 40, BLUE);
DrawText(FormatText("Elapsed Time: %02.02f ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
DrawText(string.Format("Elapsed Time: {0:00.00} ms", GetFrameTime()*1000), 200, 220, 20, BLACK);
EndDrawing();
//----------------------------------------------------------------------------------

View File

@ -84,7 +84,7 @@ public partial class text_input_box
DrawText(name.ToString(), (int)textBox.x + 5, (int)textBox.y + 8, 40, MAROON);
DrawText(FormatText("INPUT CHARS: %i/%i", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY);
DrawText(string.Format("INPUT CHARS: {0}/{1}", letterCount, MAX_INPUT_CHARS), 315, 250, 20, DARKGRAY);
if (mouseOnText)
{

View File

@ -111,8 +111,8 @@ public partial class text_ttf_loading
//DrawRectangleLines(fontPosition.x, fontPosition.y, textSize.x, textSize.y, RED);
DrawRectangle(0, screenHeight - 80, screenWidth, 80, LIGHTGRAY);
DrawText(FormatText("Font size: %02.02f", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
DrawText(FormatText("Text size: [%02.02f, %02.02f]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
DrawText(string.Format("Font size: {0:00.00}", fontSize), 20, screenHeight - 50, 10, DARKGRAY);
DrawText(string.Format("Text size: [{0:00.00}, {1:00.00}]", textSize.x, textSize.y), 20, screenHeight - 30, 10, DARKGRAY);
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, GRAY);
if (currentFontFilter == 0) DrawText("POINT", 570, 400, 20, BLACK);

View File

@ -48,7 +48,7 @@ public partial class text_writing_anim
ClearBackground(RAYWHITE);
DrawText(SubText(message, 0, framesCounter/10), 210, 160, 20, MAROON);
DrawText(message.SubText(0, framesCounter/10), 210, 160, 20, MAROON);
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, LIGHTGRAY);
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, LIGHTGRAY);