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

@ -61,7 +61,7 @@ public partial class core_input_gamepad
if (IsGamepadAvailable(GAMEPAD_PLAYER1))
{
DrawText(FormatText("GP1: %s", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
DrawText(string.Format("GP1: {0}", GetGamepadName(GAMEPAD_PLAYER1)), 10, 10, 10, BLACK);
if (IsGamepadName(GAMEPAD_PLAYER1, XBOX360_NAME_ID))
{
@ -108,8 +108,8 @@ public partial class core_input_gamepad
DrawRectangle(170, 30, 15, (int)(((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)) / 2.0f) * 70), RED);
DrawRectangle(604, 30, 15, (int)(((1.0f + GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)) / 2.0f) * 70), RED);
//DrawText(FormatText("Xbox axis LT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
//DrawText(FormatText("Xbox axis RT: %02.02f", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
//DrawText(string.Format("Xbox axis LT: {0:00.00}", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_LT)), 10, 40, 10, BLACK);
//DrawText(string.Format("Xbox axis RT: {0:00.00}", GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_XBOX_AXIS_RT)), 10, 60, 10, BLACK);
}
else if (IsGamepadName(GAMEPAD_PLAYER1, PS3_NAME_ID))
{
@ -157,21 +157,21 @@ public partial class core_input_gamepad
DrawRectangle(169, 48, 15, (int)(((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_L2)) / 2.0f) * 70), RED);
DrawRectangle(611, 48, 15, (int)(((1.0f - GetGamepadAxisMovement(GAMEPAD_PLAYER1, GAMEPAD_PS3_AXIS_R2)) / 2.0f) * 70), RED);
}
else
{
else
{
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, GRAY);
// TODO: Draw generic gamepad
}
DrawText(FormatText("DETECTED AXIS [%i]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
DrawText(string.Format("DETECTED AXIS [{0}]:", GetGamepadAxisCount(GAMEPAD_PLAYER1)), 10, 50, 10, MAROON);
for (int i = 0; i < GetGamepadAxisCount(GAMEPAD_PLAYER1); i++)
{
DrawText(FormatText("AXIS %i: %.02f", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20 * i, 10, DARKGRAY);
DrawText(string.Format("AXIS {0}: {0:0.02}", i, GetGamepadAxisMovement(GAMEPAD_PLAYER1, i)), 20, 70 + 20 * i, 10, DARKGRAY);
}
if (GetGamepadButtonPressed() != -1) DrawText(FormatText("DETECTED BUTTON: %i", GetGamepadButtonPressed()), 10, 430, 10, RED);
if (GetGamepadButtonPressed() != -1) DrawText(string.Format("DETECTED BUTTON: {0}", GetGamepadButtonPressed()), 10, 430, 10, RED);
else DrawText("DETECTED BUTTON: NONE", 10, 430, 10, GRAY);
}
else

View File

@ -47,7 +47,7 @@ public partial class core_mouse_wheel
DrawRectangle(screenWidth/2 - 40, boxPositionY, 80, 80, MAROON);
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, GRAY);
//DrawText(FormatText("Box position Y: %03i", boxPositionY), 10, 40, 20, LIGHTGRAY);
DrawText(string.Format("Box position Y: {0:000}", boxPositionY), 10, 40, 20, LIGHTGRAY);
DrawText($"Box position Y: {boxPositionY}", 10, 40, 20, LIGHTGRAY);
EndDrawing();

View File

@ -54,8 +54,7 @@ public partial class core_random_values
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, MAROON);
//DrawText(FormatText("%i", randValue), 360, 180, 80, LIGHTGRAY);
DrawText($"{randValue}", 360, 180, 80, LIGHTGRAY);
DrawText(string.Format("{0}", randValue), 360, 180, 80, LIGHTGRAY);
EndDrawing();
//----------------------------------------------------------------------------------

View File

@ -66,13 +66,10 @@ public partial class core_storage_values
ClearBackground(RAYWHITE);
// DrawText(FormatText("SCORE: %i", score), 280, 130, 40, MAROON);
DrawText($"SCORE: {score}", 280, 130, 40, MAROON);
// DrawText(FormatText("HI-SCORE: %i", hiscore), 210, 200, 50, BLACK);
DrawText($"HI-SCORE: {hiscore}", 210, 200, 50, BLACK);
DrawText(string.Format("SCORE: {0}", score), 280, 130, 40, MAROON);
DrawText(string.Format("HI-SCORE: {0}", hiscore), 210, 200, 50, BLACK);
// DrawText(FormatText("frames: %i", framesCounter), 10, 10, 20, LIME);
DrawText($"frames: {framesCounter}", 10, 10, 20, LIME);
DrawText(string.Format("frames: {0}", framesCounter), 10, 10, 20, LIME);
DrawText("Press R to generate random numbers", 220, 40, 20, LIGHTGRAY);
DrawText("Press ENTER to SAVE values", 250, 310, 20, LIGHTGRAY);