mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Update enum/color names to match C# naming convention (#224)
This commit is contained in:
@ -52,7 +52,7 @@ class CodepointsLoading
|
||||
);
|
||||
|
||||
// Set bilinear scale filter for better font scaling
|
||||
SetTextureFilter(font.Texture, TextureFilter.TEXTURE_FILTER_BILINEAR);
|
||||
SetTextureFilter(font.Texture, TextureFilter.Bilinear);
|
||||
|
||||
bool showFontAtlas = false;
|
||||
|
||||
@ -64,7 +64,7 @@ class CodepointsLoading
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Space))
|
||||
{
|
||||
showFontAtlas = !showFontAtlas;
|
||||
}
|
||||
@ -74,31 +74,31 @@ class CodepointsLoading
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawRectangle(0, 0, GetScreenWidth(), 70, Color.BLACK);
|
||||
DrawText($"Total codepoints contained in provided text: {codepoints.Count}", 10, 10, 20, Color.GREEN);
|
||||
DrawRectangle(0, 0, GetScreenWidth(), 70, Color.Black);
|
||||
DrawText($"Total codepoints contained in provided text: {codepoints.Count}", 10, 10, 20, Color.Green);
|
||||
DrawText(
|
||||
$"Total codepoints required for font atlas (duplicates excluded): {codepointsNoDuplicates.Length}",
|
||||
10,
|
||||
40,
|
||||
20,
|
||||
Color.GREEN
|
||||
Color.Green
|
||||
);
|
||||
|
||||
if (showFontAtlas)
|
||||
{
|
||||
// Draw generated font texture atlas containing provided codepoints
|
||||
DrawTexture(font.Texture, 150, 100, Color.BLACK);
|
||||
DrawRectangleLines(150, 100, font.Texture.Width, font.Texture.Height, Color.BLACK);
|
||||
DrawTexture(font.Texture, 150, 100, Color.Black);
|
||||
DrawRectangleLines(150, 100, font.Texture.Width, font.Texture.Height, Color.Black);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Draw provided text with laoded font, containing all required codepoint glyphs
|
||||
DrawTextEx(font, text, new Vector2(160, 110), 48, 5, Color.BLACK);
|
||||
DrawTextEx(font, text, new Vector2(160, 110), 48, 5, Color.Black);
|
||||
}
|
||||
|
||||
DrawText("Press SPACE to toggle font atlas view!", 10, GetScreenHeight() - 30, 20, Color.GRAY);
|
||||
DrawText("Press SPACE to toggle font atlas view!", 10, GetScreenHeight() - 30, 20, Color.Gray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -45,8 +45,8 @@ public class FontFilters
|
||||
Vector2 textSize = new(0.0f, 0.0f);
|
||||
|
||||
// Setup texture scaling filter
|
||||
SetTextureFilter(font.Texture, TextureFilter.TEXTURE_FILTER_POINT);
|
||||
TextureFilter currentFontFilter = TextureFilter.TEXTURE_FILTER_POINT;
|
||||
SetTextureFilter(font.Texture, TextureFilter.Point);
|
||||
TextureFilter currentFontFilter = TextureFilter.Point;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
@ -59,30 +59,30 @@ public class FontFilters
|
||||
fontSize += GetMouseWheelMove() * 4.0f;
|
||||
|
||||
// Choose font texture filter method
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ONE))
|
||||
if (IsKeyPressed(KeyboardKey.One))
|
||||
{
|
||||
SetTextureFilter(font.Texture, TextureFilter.TEXTURE_FILTER_POINT);
|
||||
currentFontFilter = TextureFilter.TEXTURE_FILTER_POINT;
|
||||
SetTextureFilter(font.Texture, TextureFilter.Point);
|
||||
currentFontFilter = TextureFilter.Point;
|
||||
}
|
||||
else if (IsKeyPressed(KeyboardKey.KEY_TWO))
|
||||
else if (IsKeyPressed(KeyboardKey.Two))
|
||||
{
|
||||
SetTextureFilter(font.Texture, TextureFilter.TEXTURE_FILTER_BILINEAR);
|
||||
currentFontFilter = TextureFilter.TEXTURE_FILTER_BILINEAR;
|
||||
SetTextureFilter(font.Texture, TextureFilter.Bilinear);
|
||||
currentFontFilter = TextureFilter.Bilinear;
|
||||
}
|
||||
else if (IsKeyPressed(KeyboardKey.KEY_THREE))
|
||||
else if (IsKeyPressed(KeyboardKey.Three))
|
||||
{
|
||||
// NOTE: Trilinear filter won't be noticed on 2D drawing
|
||||
SetTextureFilter(font.Texture, TextureFilter.TEXTURE_FILTER_TRILINEAR);
|
||||
currentFontFilter = TextureFilter.TEXTURE_FILTER_TRILINEAR;
|
||||
SetTextureFilter(font.Texture, TextureFilter.Trilinear);
|
||||
currentFontFilter = TextureFilter.Trilinear;
|
||||
}
|
||||
|
||||
textSize = MeasureTextEx(font, msg, fontSize, 0);
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_LEFT))
|
||||
if (IsKeyDown(KeyboardKey.Left))
|
||||
{
|
||||
fontPosition.X -= 10;
|
||||
}
|
||||
else if (IsKeyDown(KeyboardKey.KEY_RIGHT))
|
||||
else if (IsKeyDown(KeyboardKey.Right))
|
||||
{
|
||||
fontPosition.X += 10;
|
||||
}
|
||||
@ -104,29 +104,29 @@ public class FontFilters
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Use mouse wheel to change font size", 20, 20, 10, Color.GRAY);
|
||||
DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, Color.GRAY);
|
||||
DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, Color.GRAY);
|
||||
DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, Color.DARKGRAY);
|
||||
DrawText("Use mouse wheel to change font size", 20, 20, 10, Color.Gray);
|
||||
DrawText("Use KEY_RIGHT and KEY_LEFT to move text", 20, 40, 10, Color.Gray);
|
||||
DrawText("Use 1, 2, 3 to change texture filter", 20, 60, 10, Color.Gray);
|
||||
DrawText("Drop a new TTF font for dynamic loading", 20, 80, 10, Color.DarkGray);
|
||||
|
||||
DrawTextEx(font, msg, fontPosition, fontSize, 0, Color.BLACK);
|
||||
DrawTextEx(font, msg, fontPosition, fontSize, 0, Color.Black);
|
||||
|
||||
DrawRectangle(0, screenHeight - 80, screenWidth, 80, Color.LIGHTGRAY);
|
||||
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, Color.GRAY);
|
||||
DrawRectangle(0, screenHeight - 80, screenWidth, 80, Color.LightGray);
|
||||
DrawText("CURRENT TEXTURE FILTER:", 250, 400, 20, Color.Gray);
|
||||
|
||||
if (currentFontFilter == TextureFilter.TEXTURE_FILTER_POINT)
|
||||
if (currentFontFilter == TextureFilter.Point)
|
||||
{
|
||||
DrawText("POINT", 570, 400, 20, Color.BLACK);
|
||||
DrawText("POINT", 570, 400, 20, Color.Black);
|
||||
}
|
||||
else if (currentFontFilter == TextureFilter.TEXTURE_FILTER_POINT)
|
||||
else if (currentFontFilter == TextureFilter.Point)
|
||||
{
|
||||
DrawText("BILINEAR", 570, 400, 20, Color.BLACK);
|
||||
DrawText("BILINEAR", 570, 400, 20, Color.Black);
|
||||
}
|
||||
else if (currentFontFilter == TextureFilter.TEXTURE_FILTER_TRILINEAR)
|
||||
else if (currentFontFilter == TextureFilter.Trilinear)
|
||||
{
|
||||
DrawText("TRILINEAR", 570, 400, 20, Color.BLACK);
|
||||
DrawText("TRILINEAR", 570, 400, 20, Color.Black);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
@ -57,7 +57,7 @@ public class FontLoading
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyDown(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyDown(KeyboardKey.Space))
|
||||
{
|
||||
useTtf = true;
|
||||
}
|
||||
@ -70,19 +70,19 @@ public class FontLoading
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Hold SPACE to use TTF generated font", 20, 20, 20, Color.LIGHTGRAY);
|
||||
DrawText("Hold SPACE to use TTF generated font", 20, 20, 20, Color.LightGray);
|
||||
|
||||
if (!useTtf)
|
||||
{
|
||||
DrawTextEx(fontBm, msg, new Vector2(20.0f, 100.0f), fontBm.BaseSize, 2, Color.MAROON);
|
||||
DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, Color.GRAY);
|
||||
DrawTextEx(fontBm, msg, new Vector2(20.0f, 100.0f), fontBm.BaseSize, 2, Color.Maroon);
|
||||
DrawText("Using BMFont (Angelcode) imported", 20, GetScreenHeight() - 30, 20, Color.Gray);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextEx(fontTtf, msg, new Vector2(20.0f, 100.0f), fontTtf.BaseSize, 2, Color.LIME);
|
||||
DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, Color.GRAY);
|
||||
DrawTextEx(fontTtf, msg, new Vector2(20.0f, 100.0f), fontTtf.BaseSize, 2, Color.Lime);
|
||||
DrawText("Using TTF font generated", 20, GetScreenHeight() - 30, 20, Color.Gray);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
@ -41,7 +41,7 @@ public class FontSdf
|
||||
|
||||
// Loading font data from memory data
|
||||
// Parameters > font size: 16, no chars array provided (0), chars count: 95 (autogenerate chars array)
|
||||
fontDefault.Glyphs = LoadFontData(fileData, (int)fileSize, 16, null, 95, FontType.FONT_DEFAULT);
|
||||
fontDefault.Glyphs = LoadFontData(fileData, (int)fileSize, 16, null, 95, FontType.Default);
|
||||
// Parameters > chars count: 95, font size: 16, chars padding in image: 4 px, pack method: 0 (default)
|
||||
Image atlas = GenImageFontAtlas(fontDefault.Glyphs, &fontDefault.Recs, 95, 16, 4, 0);
|
||||
fontDefault.Texture = LoadTextureFromImage(atlas);
|
||||
@ -52,7 +52,7 @@ public class FontSdf
|
||||
fontSDF.BaseSize = 16;
|
||||
fontSDF.GlyphCount = 95;
|
||||
// Parameters > font size: 16, no chars array provided (0), chars count: 0 (defaults to 95)
|
||||
fontSDF.Glyphs = LoadFontData(fileData, (int)fileSize, 16, null, 0, FontType.FONT_SDF);
|
||||
fontSDF.Glyphs = LoadFontData(fileData, (int)fileSize, 16, null, 0, FontType.Sdf);
|
||||
// Parameters > chars count: 95, font size: 16, chars padding in image: 0 px, pack method: 1 (Skyline algorythm)
|
||||
atlas = GenImageFontAtlas(fontSDF.Glyphs, &fontSDF.Recs, 95, 16, 0, 1);
|
||||
fontSDF.Texture = LoadTextureFromImage(atlas);
|
||||
@ -64,7 +64,7 @@ public class FontSdf
|
||||
// Load SDF required shader (we use default vertex shader)
|
||||
Shader shader = LoadShader(null, "resources/shaders/glsl330/sdf.fs");
|
||||
// Required for SDF font
|
||||
SetTextureFilter(fontSDF.Texture, TextureFilter.TEXTURE_FILTER_BILINEAR);
|
||||
SetTextureFilter(fontSDF.Texture, TextureFilter.Bilinear);
|
||||
|
||||
Vector2 fontPosition = new(40, screenHeight / 2 - 50);
|
||||
Vector2 textSize = new(0.0f);
|
||||
@ -87,7 +87,7 @@ public class FontSdf
|
||||
fontSize = 6;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyDown(KeyboardKey.Space))
|
||||
{
|
||||
currentFont = 1;
|
||||
}
|
||||
@ -112,37 +112,37 @@ public class FontSdf
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
if (currentFont == 1)
|
||||
{
|
||||
// NOTE: SDF fonts require a custom SDf shader to compute fragment color
|
||||
BeginShaderMode(shader);
|
||||
DrawTextEx(fontSDF, msg, fontPosition, fontSize, 0, Color.BLACK);
|
||||
DrawTextEx(fontSDF, msg, fontPosition, fontSize, 0, Color.Black);
|
||||
EndShaderMode();
|
||||
|
||||
DrawTexture(fontSDF.Texture, 10, 10, Color.BLACK);
|
||||
DrawTexture(fontSDF.Texture, 10, 10, Color.Black);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawTextEx(fontDefault, msg, fontPosition, fontSize, 0, Color.BLACK);
|
||||
DrawTexture(fontDefault.Texture, 10, 10, Color.BLACK);
|
||||
DrawTextEx(fontDefault, msg, fontPosition, fontSize, 0, Color.Black);
|
||||
DrawTexture(fontDefault.Texture, 10, 10, Color.Black);
|
||||
}
|
||||
|
||||
if (currentFont == 1)
|
||||
{
|
||||
DrawText("SDF!", 320, 20, 80, Color.RED);
|
||||
DrawText("SDF!", 320, 20, 80, Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("default font", 315, 40, 30, Color.GRAY);
|
||||
DrawText("default font", 315, 40, 30, Color.Gray);
|
||||
}
|
||||
|
||||
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, Color.DARKGRAY);
|
||||
DrawText($"RENDER SIZE: {fontSize:2F}", GetScreenWidth() - 240, 50, 20, Color.DARKGRAY);
|
||||
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, Color.DARKGRAY);
|
||||
DrawText("FONT SIZE: 16.0", GetScreenWidth() - 240, 20, 20, Color.DarkGray);
|
||||
DrawText($"RENDER SIZE: {fontSize:2F}", GetScreenWidth() - 240, 50, 20, Color.DarkGray);
|
||||
DrawText("Use MOUSE WHEEL to SCALE TEXT!", GetScreenWidth() - 240, 90, 10, Color.DarkGray);
|
||||
|
||||
DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, Color.MAROON);
|
||||
DrawText("PRESS SPACE to USE SDF FONT VERSION!", 340, GetScreenHeight() - 30, 20, Color.Maroon);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -72,11 +72,11 @@ public class FontSpritefont
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawTextEx(font1, msg1, fontPosition1, font1.BaseSize, -3, Color.WHITE);
|
||||
DrawTextEx(font2, msg2, fontPosition2, font2.BaseSize, -2, Color.WHITE);
|
||||
DrawTextEx(font3, msg3, fontPosition3, font3.BaseSize, 2, Color.WHITE);
|
||||
DrawTextEx(font1, msg1, fontPosition1, font1.BaseSize, -3, Color.White);
|
||||
DrawTextEx(font2, msg2, fontPosition2, font2.BaseSize, -2, Color.White);
|
||||
DrawTextEx(font3, msg3, fontPosition3, font3.BaseSize, 2, Color.White);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -42,12 +42,12 @@ public class FormatText
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText($"Score: {score}", 200, 80, 20, Color.RED);
|
||||
DrawText($"HiScore: {hiscore}", 200, 120, 20, Color.GREEN);
|
||||
DrawText($"Lives: {lives}", 200, 160, 40, Color.BLUE);
|
||||
DrawText($"Elapsed Time: {GetFrameTime() * 1000} ms", 200, 220, 20, Color.BLACK);
|
||||
DrawText($"Score: {score}", 200, 80, 20, Color.Red);
|
||||
DrawText($"HiScore: {hiscore}", 200, 120, 20, Color.Green);
|
||||
DrawText($"Lives: {lives}", 200, 160, 40, Color.Blue);
|
||||
DrawText($"Elapsed Time: {GetFrameTime() * 1000} ms", 200, 220, 20, Color.Black);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
@ -55,7 +55,7 @@ public class InputBox
|
||||
if (mouseOnText)
|
||||
{
|
||||
// Set the window's cursor to the I-Beam
|
||||
SetMouseCursor(MouseCursor.MOUSE_CURSOR_IBEAM);
|
||||
SetMouseCursor(MouseCursor.IBeam);
|
||||
|
||||
// Check if more characters have been pressed on the same frame
|
||||
int key = GetCharPressed();
|
||||
@ -73,7 +73,7 @@ public class InputBox
|
||||
key = GetCharPressed();
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_BACKSPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Backspace))
|
||||
{
|
||||
letterCount -= 1;
|
||||
if (letterCount < 0)
|
||||
@ -85,7 +85,7 @@ public class InputBox
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMouseCursor(MouseCursor.MOUSE_CURSOR_DEFAULT);
|
||||
SetMouseCursor(MouseCursor.Default);
|
||||
}
|
||||
|
||||
if (mouseOnText)
|
||||
@ -101,10 +101,10 @@ public class InputBox
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, Color.GRAY);
|
||||
DrawRectangleRec(textBox, Color.LIGHTGRAY);
|
||||
DrawText("PLACE MOUSE OVER INPUT BOX!", 240, 140, 20, Color.Gray);
|
||||
DrawRectangleRec(textBox, Color.LightGray);
|
||||
|
||||
if (mouseOnText)
|
||||
{
|
||||
@ -113,7 +113,7 @@ public class InputBox
|
||||
(int)textBox.Y,
|
||||
(int)textBox.Width,
|
||||
(int)textBox.Height,
|
||||
Color.RED
|
||||
Color.Red
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -123,12 +123,12 @@ public class InputBox
|
||||
(int)textBox.Y,
|
||||
(int)textBox.Width,
|
||||
(int)textBox.Height,
|
||||
Color.DARKGRAY
|
||||
Color.DarkGray
|
||||
);
|
||||
}
|
||||
|
||||
DrawText(new string(name), (int)textBox.X + 5, (int)textBox.Y + 8, 40, Color.MAROON);
|
||||
DrawText($"INPUT CHARS: {letterCount}/{MaxInputChars}", 315, 250, 20, Color.DARKGRAY);
|
||||
DrawText(new string(name), (int)textBox.X + 5, (int)textBox.Y + 8, 40, Color.Maroon);
|
||||
DrawText($"INPUT CHARS: {letterCount}/{MaxInputChars}", 315, 250, 20, Color.DarkGray);
|
||||
|
||||
if (mouseOnText)
|
||||
{
|
||||
@ -142,13 +142,13 @@ public class InputBox
|
||||
(int)textBox.X + 8 + MeasureText(new string(name), 40),
|
||||
(int)textBox.Y + 12,
|
||||
40,
|
||||
Color.MAROON
|
||||
Color.Maroon
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("Press BACKSPACE to delete chars...", 230, 300, 20, Color.GRAY);
|
||||
DrawText("Press BACKSPACE to delete chars...", 230, 300, 20, Color.Gray);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,14 +69,14 @@ public class RaylibFonts
|
||||
positions[7].Y -= 8;
|
||||
|
||||
Color[] colors = new Color[MaxFonts] {
|
||||
Color.MAROON,
|
||||
Color.ORANGE,
|
||||
Color.DARKGREEN,
|
||||
Color.DARKBLUE,
|
||||
Color.DARKPURPLE,
|
||||
Color.LIME,
|
||||
Color.GOLD,
|
||||
Color.RED
|
||||
Color.Maroon,
|
||||
Color.Orange,
|
||||
Color.DarkGreen,
|
||||
Color.DarkBlue,
|
||||
Color.DarkPurple,
|
||||
Color.Lime,
|
||||
Color.Gold,
|
||||
Color.Red
|
||||
};
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
@ -91,10 +91,10 @@ public class RaylibFonts
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("free fonts included with raylib", 250, 20, 20, Color.DARKGRAY);
|
||||
DrawLine(220, 50, 590, 50, Color.DARKGRAY);
|
||||
DrawText("free fonts included with raylib", 250, 20, 20, Color.DarkGray);
|
||||
DrawLine(220, 50, 590, 50, Color.DarkGray);
|
||||
|
||||
for (int i = 0; i < MaxFonts; i++)
|
||||
{
|
||||
|
@ -37,7 +37,7 @@ public class RectangleBounds
|
||||
const int maxHeight = screenHeight - 160;
|
||||
|
||||
Vector2 lastMouse = new(0.0f, 0.0f);
|
||||
Color borderColor = Color.MAROON;
|
||||
Color borderColor = Color.Maroon;
|
||||
Font font = GetFontDefault();
|
||||
|
||||
SetTargetFPS(60);
|
||||
@ -48,7 +48,7 @@ public class RectangleBounds
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Space))
|
||||
{
|
||||
wordWrap = !wordWrap;
|
||||
}
|
||||
@ -58,17 +58,17 @@ public class RectangleBounds
|
||||
// Check if the mouse is inside the container and toggle border color
|
||||
if (CheckCollisionPointRec(mouse, container))
|
||||
{
|
||||
borderColor = ColorAlpha(Color.MAROON, 0.4f);
|
||||
borderColor = ColorAlpha(Color.Maroon, 0.4f);
|
||||
}
|
||||
else if (!resizing)
|
||||
{
|
||||
borderColor = Color.MAROON;
|
||||
borderColor = Color.Maroon;
|
||||
}
|
||||
|
||||
// Container resizing logic
|
||||
if (resizing)
|
||||
{
|
||||
if (IsMouseButtonReleased(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonReleased(MouseButton.Left))
|
||||
{
|
||||
resizing = false;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class RectangleBounds
|
||||
else
|
||||
{
|
||||
// Check if we're resizing
|
||||
if (IsMouseButtonDown(MouseButton.MOUSE_LEFT_BUTTON) && CheckCollisionPointRec(mouse, resizer))
|
||||
if (IsMouseButtonDown(MouseButton.Left) && CheckCollisionPointRec(mouse, resizer))
|
||||
{
|
||||
resizing = true;
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class RectangleBounds
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
// Draw container border
|
||||
DrawRectangleLinesEx(container, 3, borderColor);
|
||||
@ -111,28 +111,28 @@ public class RectangleBounds
|
||||
20.0f,
|
||||
2.0f,
|
||||
wordWrap,
|
||||
Color.GRAY
|
||||
Color.Gray
|
||||
);
|
||||
|
||||
DrawRectangleRec(resizer, borderColor);
|
||||
|
||||
// Draw bottom info
|
||||
DrawRectangle(0, screenHeight - 54, screenWidth, 54, Color.GRAY);
|
||||
DrawRectangleRec(new Rectangle(382, screenHeight - 34, 12, 12), Color.MAROON);
|
||||
DrawRectangle(0, screenHeight - 54, screenWidth, 54, Color.Gray);
|
||||
DrawRectangleRec(new Rectangle(382, screenHeight - 34, 12, 12), Color.Maroon);
|
||||
|
||||
DrawText("Word Wrap: ", 313, screenHeight - 115, 20, Color.BLACK);
|
||||
DrawText("Word Wrap: ", 313, screenHeight - 115, 20, Color.Black);
|
||||
|
||||
if (wordWrap)
|
||||
{
|
||||
DrawText("ON", 447, screenHeight - 115, 20, Color.RED);
|
||||
DrawText("ON", 447, screenHeight - 115, 20, Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("OFF", 447, screenHeight - 115, 20, Color.BLACK);
|
||||
DrawText("OFF", 447, screenHeight - 115, 20, Color.Black);
|
||||
}
|
||||
|
||||
DrawText("Press [SPACE] to toggle word wrap", 218, screenHeight - 86, 20, Color.GRAY);
|
||||
DrawText("Click hold & drag the to resize the container", 155, screenHeight - 38, 20, Color.RAYWHITE);
|
||||
DrawText("Press [SPACE] to toggle word wrap", 218, screenHeight - 86, 20, Color.Gray);
|
||||
DrawText("Click hold & drag the to resize the container", 155, screenHeight - 38, 20, Color.RayWhite);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
@ -157,7 +157,7 @@ public class RectangleBounds
|
||||
Color tint
|
||||
)
|
||||
{
|
||||
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, Color.WHITE, Color.WHITE);
|
||||
DrawTextBoxedSelectable(font, text, rec, fontSize, spacing, wordWrap, tint, 0, 0, Color.White, Color.White);
|
||||
}
|
||||
|
||||
// Draw text using font inside rectangle limits with support for text selection
|
||||
|
@ -35,7 +35,7 @@ public class WritingAnim
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyDown(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyDown(KeyboardKey.Space))
|
||||
{
|
||||
framesCounter += 8;
|
||||
}
|
||||
@ -44,7 +44,7 @@ public class WritingAnim
|
||||
framesCounter += 1;
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER))
|
||||
if (IsKeyPressed(KeyboardKey.Enter))
|
||||
{
|
||||
framesCounter = 0;
|
||||
}
|
||||
@ -53,12 +53,12 @@ public class WritingAnim
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText(message.SubText(0, framesCounter / 10), 210, 160, 20, Color.MAROON);
|
||||
DrawText(message.SubText(0, framesCounter / 10), 210, 160, 20, Color.Maroon);
|
||||
|
||||
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, Color.LIGHTGRAY);
|
||||
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, Color.LIGHTGRAY);
|
||||
DrawText("PRESS [ENTER] to RESTART!", 240, 260, 20, Color.LightGray);
|
||||
DrawText("PRESS [SPACE] to SPEED UP!", 239, 300, 20, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user