Watch
2
0
Fork
You've already forked raylib-cs
0

chore: rebase to main with translation ports

This commit is contained in:
tiger tiger tiger 2026-07-17 07:49:07 +02:00
commit 8024c6ac40
134 changed files with 15456 additions and 10650 deletions

View file

@ -1,11 +1,15 @@
/*******************************************************************************************
*
* raylib [shapes] example - Cubic-bezier lines
* raylib [shapes] example - lines bezier
*
* This example has been created using raylib 1.7 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
* Example complexity rating: [] 1/4
*
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
* Example originally created with raylib 1.7, last time updated with raylib 1.7
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2017-2025 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@ -14,54 +18,110 @@ using static Raylib_cs.Raylib;
namespace Examples.Shapes;
public class LinesBezier
public partial class LinesBezier : IExample
{
private const int screenWidth = 800;
private const int screenHeight = 450;
public string Name => "Shapes / Lines Bezier";
public string Title => "raylib [shapes] example - lines bezier";
public ConfigFlags ConfigFlags => ConfigFlags.Msaa4xHint;
private Vector2 startPoint;
private Vector2 endPoint;
private bool moveStartPoint;
private bool moveEndPoint;
public void Init()
{
startPoint = new(30, 30);
endPoint = new(screenWidth - 30, screenHeight - 30);
moveStartPoint = false;
moveEndPoint = false;
}
public void Update()
{
// Update
//----------------------------------------------------------------------------------
var mouse = GetMousePosition();
if (CheckCollisionPointCircle(mouse, startPoint, 10.0f) && IsMouseButtonDown(MouseButton.Left))
{
moveStartPoint = true;
}
else if (CheckCollisionPointCircle(mouse, endPoint, 10.0f) && IsMouseButtonDown(MouseButton.Left))
{
moveEndPoint = true;
}
if (moveStartPoint)
{
startPoint = mouse;
if (IsMouseButtonReleased(MouseButton.Left))
{
moveStartPoint = false;
}
}
if (moveEndPoint)
{
endPoint = mouse;
if (IsMouseButtonReleased(MouseButton.Left))
{
moveEndPoint = false;
}
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(Color.RayWhite);
DrawText("MOVE START-END POINTS WITH MOUSE", 15, 20, 20, Color.Gray);
// Draw line Cubic Bezier, in-out interpolation (easing), no control points
DrawLineBezier(startPoint, endPoint, 4.0f, Color.Blue);
// Draw start-end spline circles with some details
DrawCircleV(startPoint, CheckCollisionPointCircle(mouse, startPoint, 10.0f) ? 14.0f : 8.0f, moveStartPoint ? Color.Red : Color.Blue);
DrawCircleV(endPoint, CheckCollisionPointCircle(mouse, endPoint, 10.0f) ? 14.0f : 8.0f, moveEndPoint ? Color.Red : Color.Blue);
EndDrawing();
//----------------------------------------------------------------------------------
}
public void Unload()
{
}
public static int Main()
{
// Initialization
//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
SetConfigFlags(ConfigFlags.Msaa4xHint);
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - cubic-bezier lines");
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - lines bezier");
Vector2 start = new(0, 0);
Vector2 end = new(screenWidth, screenHeight);
SetTargetFPS(60);
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
var game = new LinesBezier();
game.Init();
// Main game loop
while (!WindowShouldClose())
while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
if (IsMouseButtonDown(MouseButton.Left))
{
start = GetMousePosition();
}
else if (IsMouseButtonDown(MouseButton.Right))
{
end = GetMousePosition();
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(Color.RayWhite);
DrawText("USE MOUSE LEFT-RIGHT CLICK to DEFINE LINE START and END POINTS", 15, 20, 20, Color.Gray);
DrawLineBezier(start, end, 2.0f, Color.Red);
EndDrawing();
//----------------------------------------------------------------------------------
game.Update();
}
game.Unload();
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow();
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;