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

Initial example update

- Updating examples with new changes.
This commit is contained in:
2019-02-11 11:30:02 +00:00
parent f4ef94d63f
commit a01efa4a09
45 changed files with 419 additions and 389 deletions

View File

@ -55,7 +55,7 @@ public partial class text_font_sdf
// Load SDF required shader (we use default vertex shader)
Shader shader = LoadShader(null, "resources/shaders/sdf.fs");
SetTextureFilter(fontSDF.texture, (int)FILTER_BILINEAR); // Required for SDF font
SetTextureFilter(fontSDF.texture, TextureFilterMode.FILTER_BILINEAR); // Required for SDF font
Vector2 fontPosition = new Vector2( 40, screenHeight/2 - 50 );
Vector2 textSize = new Vector2( 0.0f );
@ -74,7 +74,7 @@ public partial class text_font_sdf
if (fontSize < 6) fontSize = 6;
if (IsKeyDown(KEY_SPACE)) currentFont = 1;
if (IsKeyDown(KeyboardKey.KEY_SPACE)) currentFont = 1;
else currentFont = 0;
if (currentFont == 0) textSize = MeasureTextEx(fontDefault, msg, fontSize, 0);

View File

@ -57,7 +57,7 @@ public partial class text_input_box
letterCount++;
}
if (IsKeyPressed(KEY_BACKSPACE))
if (IsKeyPressed(KeyboardKey.KEY_BACKSPACE))
{
letterCount--;
if (letterCount < 0) letterCount = 0;
@ -109,7 +109,7 @@ public partial class text_input_box
}
// Check if any key is pressed
// NOTE: We limit keys check to keys between 32 (KEY_SPACE) and 126
// NOTE: We limit keys check to keys between 32 (KeyboardKey.KEY_SPACE) and 126
bool IsAnyKeyPressed()
{
bool keyPressed = false;

View File

@ -40,7 +40,7 @@ public partial class text_ttf_loading
Vector2 fontPosition = new Vector2( 40, screenHeight/2 - 80 );
Vector2 textSize;
SetTextureFilter(font.texture, (int)FILTER_POINT);
SetTextureFilter(font.texture, TextureFilterMode.FILTER_POINT);
int currentFontFilter = 0; // FILTER_POINT
// NOTE: Drag and drop support only available for desktop platforms: Windows, Linux, OSX
@ -57,27 +57,27 @@ public partial class text_ttf_loading
fontSize += GetMouseWheelMove()*4.0f;
// Choose font texture filter method
if (IsKeyPressed(KEY_ONE))
if (IsKeyPressed(KeyboardKey.KEY_ONE))
{
SetTextureFilter(font.texture, (int)FILTER_POINT);
SetTextureFilter(font.texture, TextureFilterMode.FILTER_POINT);
currentFontFilter = 0;
}
else if (IsKeyPressed(KEY_TWO))
else if (IsKeyPressed(KeyboardKey.KEY_TWO))
{
SetTextureFilter(font.texture, (int)FILTER_BILINEAR);
SetTextureFilter(font.texture, TextureFilterMode.FILTER_BILINEAR);
currentFontFilter = 1;
}
else if (IsKeyPressed(KEY_THREE))
else if (IsKeyPressed(KeyboardKey.KEY_THREE))
{
// NOTE: Trilinear filter won't be noticed on 2D drawing
SetTextureFilter(font.texture, (int)FILTER_TRILINEAR);
SetTextureFilter(font.texture, TextureFilterMode.FILTER_TRILINEAR);
currentFontFilter = 2;
}
textSize = MeasureTextEx(font, msg, fontSize, 0);
if (IsKeyDown(KEY_LEFT)) fontPosition.x -= 10;
else if (IsKeyDown(KEY_RIGHT)) fontPosition.x += 10;
if (IsKeyDown(KeyboardKey.KEY_LEFT)) fontPosition.x -= 10;
else if (IsKeyDown(KeyboardKey.KEY_RIGHT)) fontPosition.x += 10;
// Load a dropped TTF file dynamically (at current fontSize)
if (IsFileDropped())

View File

@ -36,10 +36,10 @@ public partial class text_writing_anim
{
// Update
//----------------------------------------------------------------------------------
if (IsKeyDown(KEY_SPACE)) framesCounter += 8;
if (IsKeyDown(KeyboardKey.KEY_SPACE)) framesCounter += 8;
else framesCounter++;
if (IsKeyPressed(KEY_ENTER)) framesCounter = 0;
if (IsKeyPressed(KeyboardKey.KEY_ENTER)) framesCounter = 0;
//----------------------------------------------------------------------------------
// Draw