mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-06-30 19:03:42 -04:00
Update/merge examples back into main repo (#192)
This commit is contained in:
81
Examples/Shapes/BasicShapes.cs
Normal file
81
Examples/Shapes/BasicShapes.cs
Normal file
@ -0,0 +1,81 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - Draw basic shapes 2d (rectangle, circle, line...)
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class BasicShapes
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - basic shapes drawing");
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawText("some basic shapes available on raylib", 20, 20, 20, Color.DARKGRAY);
|
||||
|
||||
DrawLine(18, 42, screenWidth - 18, 42, Color.BLACK);
|
||||
|
||||
DrawCircle(screenWidth / 4, 120, 35, Color.DARKBLUE);
|
||||
DrawCircleGradient(screenWidth / 4, 220, 60, Color.GREEN, Color.SKYBLUE);
|
||||
DrawCircleLines(screenWidth / 4, 340, 80, Color.DARKBLUE);
|
||||
|
||||
DrawRectangle(screenWidth / 4 * 2 - 60, 100, 120, 60, Color.RED);
|
||||
DrawRectangleGradientH(screenWidth / 4 * 2 - 90, 170, 180, 130, Color.MAROON, Color.GOLD);
|
||||
DrawRectangleLines(screenWidth / 4 * 2 - 40, 320, 80, 60, Color.ORANGE);
|
||||
|
||||
DrawTriangle(
|
||||
new Vector2(screenWidth / 4 * 3, 80),
|
||||
new Vector2(screenWidth / 4 * 3 - 60, 150),
|
||||
new Vector2(screenWidth / 4 * 3 + 60, 150), Color.VIOLET
|
||||
);
|
||||
|
||||
DrawTriangleLines(
|
||||
new Vector2(screenWidth / 4 * 3, 160),
|
||||
new Vector2(screenWidth / 4 * 3 - 20, 230),
|
||||
new Vector2(screenWidth / 4 * 3 + 20, 230), Color.DARKBLUE
|
||||
);
|
||||
|
||||
DrawPoly(new Vector2(screenWidth / 4 * 3, 320), 6, 80, 0, Color.BROWN);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
96
Examples/Shapes/BouncingBall.cs
Normal file
96
Examples/Shapes/BouncingBall.cs
Normal file
@ -0,0 +1,96 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - bouncing ball
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class BouncingBall
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - bouncing ball");
|
||||
|
||||
Vector2 ballPosition = new(GetScreenWidth() / 2, GetScreenHeight() / 2);
|
||||
Vector2 ballSpeed = new(5.0f, 4.0f);
|
||||
int ballRadius = 20;
|
||||
|
||||
bool pause = false;
|
||||
int framesCounter = 0;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//----------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//-----------------------------------------------------
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
{
|
||||
pause = !pause;
|
||||
}
|
||||
|
||||
if (!pause)
|
||||
{
|
||||
ballPosition.X += ballSpeed.X;
|
||||
ballPosition.Y += ballSpeed.Y;
|
||||
|
||||
// Check walls collision for bouncing
|
||||
if ((ballPosition.X >= (GetScreenWidth() - ballRadius)) || (ballPosition.X <= ballRadius))
|
||||
{
|
||||
ballSpeed.X *= -1.0f;
|
||||
}
|
||||
if ((ballPosition.Y >= (GetScreenHeight() - ballRadius)) || (ballPosition.Y <= ballRadius))
|
||||
{
|
||||
ballSpeed.Y *= -1.0f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
framesCounter += 1;
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//-----------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawCircleV(ballPosition, ballRadius, Color.MAROON);
|
||||
DrawText("PRESS SPACE to PAUSE BALL MOVEMENT", 10, GetScreenHeight() - 25, 20, Color.LIGHTGRAY);
|
||||
|
||||
// On pause, we draw a blinking message
|
||||
if (pause && ((framesCounter / 30) % 2) == 0)
|
||||
{
|
||||
DrawText("PAUSED", 350, 200, 30, Color.GRAY);
|
||||
}
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//-----------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//---------------------------------------------------------
|
||||
CloseWindow();
|
||||
//----------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
138
Examples/Shapes/CollisionArea.cs
Normal file
138
Examples/Shapes/CollisionArea.cs
Normal file
@ -0,0 +1,138 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - collision area
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class CollisionArea
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//---------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - collision area");
|
||||
|
||||
// Box A: Moving box
|
||||
Rectangle boxA = new(10, GetScreenHeight() / 2 - 50, 200, 100);
|
||||
int boxASpeedX = 4;
|
||||
|
||||
// Box B: Mouse moved box
|
||||
Rectangle boxB = new(GetScreenWidth() / 2 - 30, GetScreenHeight() / 2 - 30, 60, 60);
|
||||
Rectangle boxCollision = new();
|
||||
|
||||
int screenUpperLimit = 40;
|
||||
|
||||
// Movement pause
|
||||
bool pause = false;
|
||||
bool collision = false;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//----------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//-----------------------------------------------------
|
||||
// Move box if not paused
|
||||
if (!pause)
|
||||
{
|
||||
boxA.X += boxASpeedX;
|
||||
}
|
||||
|
||||
// Bounce box on x screen limits
|
||||
if (((boxA.X + boxA.Width) >= GetScreenWidth()) || (boxA.X <= 0))
|
||||
{
|
||||
boxASpeedX *= -1;
|
||||
}
|
||||
|
||||
// Update player-controlled-box (box02)
|
||||
boxB.X = GetMouseX() - boxB.Width / 2;
|
||||
boxB.Y = GetMouseY() - boxB.Height / 2;
|
||||
|
||||
// Make sure Box B does not go out of move area limits
|
||||
if ((boxB.X + boxB.Width) >= GetScreenWidth())
|
||||
{
|
||||
boxB.X = GetScreenWidth() - boxB.Width;
|
||||
}
|
||||
else if (boxB.X <= 0)
|
||||
{
|
||||
boxB.X = 0;
|
||||
}
|
||||
|
||||
if ((boxB.Y + boxB.Height) >= GetScreenHeight())
|
||||
{
|
||||
boxB.Y = GetScreenHeight() - boxB.Height;
|
||||
}
|
||||
else if (boxB.Y <= screenUpperLimit)
|
||||
{
|
||||
boxB.Y = screenUpperLimit;
|
||||
}
|
||||
|
||||
// Check boxes collision
|
||||
collision = CheckCollisionRecs(boxA, boxB);
|
||||
|
||||
// Get collision rectangle (only on collision)
|
||||
if (collision)
|
||||
{
|
||||
boxCollision = GetCollisionRec(boxA, boxB);
|
||||
}
|
||||
|
||||
// Pause Box A movement
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
{
|
||||
pause = !pause;
|
||||
}
|
||||
//-----------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//-----------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawRectangle(0, 0, screenWidth, screenUpperLimit, collision ? Color.RED : Color.BLACK);
|
||||
|
||||
DrawRectangleRec(boxA, Color.GOLD);
|
||||
DrawRectangleRec(boxB, Color.BLUE);
|
||||
|
||||
if (collision)
|
||||
{
|
||||
// Draw collision area
|
||||
DrawRectangleRec(boxCollision, Color.LIME);
|
||||
|
||||
// Draw collision message
|
||||
int cx = GetScreenWidth() / 2 - MeasureText("COLLISION!", 20) / 2;
|
||||
int cy = screenUpperLimit / 2 - 10;
|
||||
DrawText("COLLISION!", cx, cy, 20, Color.BLACK);
|
||||
|
||||
// Draw collision area
|
||||
string text = $"Collision Area: {(int)boxCollision.Width * (int)boxCollision.Height}";
|
||||
DrawText(text, GetScreenWidth() / 2 - 100, screenUpperLimit + 10, 20, Color.BLACK);
|
||||
}
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//-----------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//---------------------------------------------------------
|
||||
CloseWindow();
|
||||
//----------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
169
Examples/Shapes/ColorsPalette.cs
Normal file
169
Examples/Shapes/ColorsPalette.cs
Normal file
@ -0,0 +1,169 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - Colors palette
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class ColorsPalette
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - colors palette");
|
||||
|
||||
Color[] colors = new[]
|
||||
{
|
||||
Color.DARKGRAY,
|
||||
Color.MAROON,
|
||||
Color.ORANGE,
|
||||
Color.DARKGREEN,
|
||||
Color.DARKBLUE,
|
||||
Color.DARKPURPLE,
|
||||
Color.DARKBROWN,
|
||||
Color.GRAY,
|
||||
Color.RED,
|
||||
Color.GOLD,
|
||||
Color.LIME,
|
||||
Color.BLUE,
|
||||
Color.VIOLET,
|
||||
Color.BROWN,
|
||||
Color.LIGHTGRAY,
|
||||
Color.PINK,
|
||||
Color.YELLOW,
|
||||
Color.GREEN,
|
||||
Color.SKYBLUE,
|
||||
Color.PURPLE,
|
||||
Color.BEIGE
|
||||
};
|
||||
|
||||
string[] colorNames = new[]
|
||||
{
|
||||
"DARKGRAY",
|
||||
"MAROON",
|
||||
"ORANGE",
|
||||
"DARKGREEN",
|
||||
"DARKBLUE",
|
||||
"DARKPURPLE",
|
||||
"DARKBROWN",
|
||||
"GRAY",
|
||||
"RED",
|
||||
"GOLD",
|
||||
"LIME",
|
||||
"BLUE",
|
||||
"VIOLET",
|
||||
"BROWN",
|
||||
"LIGHTGRAY",
|
||||
"PINK",
|
||||
"YELLOW",
|
||||
"GREEN",
|
||||
"SKYBLUE",
|
||||
"PURPLE",
|
||||
"BEIGE"
|
||||
};
|
||||
|
||||
// Rectangles array
|
||||
Rectangle[] colorsRecs = new Rectangle[colors.Length];
|
||||
|
||||
// Fills colorsRecs data (for every rectangle)
|
||||
for (int i = 0; i < colorsRecs.Length; i++)
|
||||
{
|
||||
colorsRecs[i].X = 20 + 100 * (i % 7) + 10 * (i % 7);
|
||||
colorsRecs[i].Y = 80 + 100 * (i / 7) + 10 * (i / 7);
|
||||
colorsRecs[i].Width = 100;
|
||||
colorsRecs[i].Height = 100;
|
||||
}
|
||||
|
||||
// Color state: 0-DEFAULT, 1-MOUSE_HOVER
|
||||
int[] colorState = new int[colors.Length];
|
||||
|
||||
Vector2 mousePoint = new(0.0f, 0.0f);
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
mousePoint = GetMousePosition();
|
||||
|
||||
for (int i = 0; i < colors.Length; i++)
|
||||
{
|
||||
if (CheckCollisionPointRec(mousePoint, colorsRecs[i]))
|
||||
{
|
||||
colorState[i] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
colorState[i] = 0;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawText("raylib colors palette", 28, 42, 20, Color.BLACK);
|
||||
DrawText(
|
||||
"press SPACE to see all colors",
|
||||
GetScreenWidth() - 180,
|
||||
GetScreenHeight() - 40,
|
||||
10,
|
||||
Color.GRAY
|
||||
);
|
||||
|
||||
// Draw all rectangles
|
||||
for (int i = 0; i < colorsRecs.Length; i++)
|
||||
{
|
||||
DrawRectangleRec(colorsRecs[i], ColorAlpha(colors[i], colorState[i] != 0 ? 0.6f : 1.0f));
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_SPACE) || colorState[i] != 0)
|
||||
{
|
||||
DrawRectangle(
|
||||
(int)colorsRecs[i].X,
|
||||
(int)(colorsRecs[i].Y + colorsRecs[i].Height - 26),
|
||||
(int)colorsRecs[i].Width,
|
||||
20,
|
||||
Color.BLACK
|
||||
);
|
||||
DrawRectangleLinesEx(colorsRecs[i], 6, ColorAlpha(Color.BLACK, 0.3f));
|
||||
DrawText(
|
||||
colorNames[i],
|
||||
(int)(colorsRecs[i].X + colorsRecs[i].Width - MeasureText(colorNames[i], 10) - 12),
|
||||
(int)(colorsRecs[i].Y + colorsRecs[i].Height - 20),
|
||||
10,
|
||||
colors[i]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
95
Examples/Shapes/DrawCircleSector.cs
Normal file
95
Examples/Shapes/DrawCircleSector.cs
Normal file
@ -0,0 +1,95 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - draw circle sector (with gui options)
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2018 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class DrawCircleSector
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw circle sector");
|
||||
|
||||
Vector2 center = new((GetScreenWidth() - 300) / 2, GetScreenHeight() / 2);
|
||||
|
||||
float outerRadius = 180.0f;
|
||||
int startAngle = 0;
|
||||
int endAngle = 180;
|
||||
int segments = 0;
|
||||
int minSegments = 4;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// NOTE: All variables update happens inside GUI control functions
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawLine(500, 0, 500, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.6f));
|
||||
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.3f));
|
||||
|
||||
DrawCircleSector(center, outerRadius, startAngle, endAngle, segments, ColorAlpha(Color.MAROON, 0.3f));
|
||||
DrawCircleSectorLines(
|
||||
center,
|
||||
outerRadius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
segments,
|
||||
ColorAlpha(Color.MAROON, 0.6f)
|
||||
);
|
||||
|
||||
// Draw GUI controls
|
||||
//------------------------------------------------------------------------------
|
||||
/*startAngle = GuiSliderBar(new Rectangle( 600, 40, 120, 20), "StartAngle", startAngle, 0, 720, true );
|
||||
endAngle = GuiSliderBar(new Rectangle( 600, 70, 120, 20), "EndAngle", endAngle, 0, 720, true);
|
||||
|
||||
outerRadius = GuiSliderBar(new Rectangle( 600, 140, 120, 20), "Radius", outerRadius, 0, 200, true);
|
||||
segments = GuiSliderBar(new Rectangle( 600, 170, 120, 20), "Segments", segments, 0, 100, true);*/
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
minSegments = (int)MathF.Ceiling((endAngle - startAngle) / 90);
|
||||
Color color = (segments >= minSegments) ? Color.MAROON : Color.DARKGRAY;
|
||||
DrawText($"MODE: {((segments >= minSegments) ? "MANUAL" : "AUTO")}", 600, 270, 10, color);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
105
Examples/Shapes/DrawRectangleRounded.cs
Normal file
105
Examples/Shapes/DrawRectangleRounded.cs
Normal file
@ -0,0 +1,105 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - draw rectangle rounded (with gui options)
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2018 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class DrawRectangleRounded
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw rectangle rounded");
|
||||
|
||||
float roundness = 0.2f;
|
||||
int width = 400;
|
||||
int height = 200;
|
||||
int segments = 0;
|
||||
int lineThick = 10;
|
||||
|
||||
bool drawRect = false;
|
||||
bool drawRoundedRect = false;
|
||||
bool drawRoundedLines = true;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
Rectangle rec = new(
|
||||
(GetScreenWidth() - width - 250) / 2.0f,
|
||||
(GetScreenHeight() - height) / 2.0f,
|
||||
(float)width,
|
||||
(float)height
|
||||
);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawLine(560, 0, 560, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.6f));
|
||||
DrawRectangle(560, 0, GetScreenWidth() - 500, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.3f));
|
||||
|
||||
if (drawRect)
|
||||
{
|
||||
DrawRectangleRec(rec, ColorAlpha(Color.GOLD, 0.6f));
|
||||
}
|
||||
if (drawRoundedRect)
|
||||
{
|
||||
DrawRectangleRounded(rec, roundness, segments, ColorAlpha(Color.MAROON, 0.2f));
|
||||
}
|
||||
if (drawRoundedLines)
|
||||
{
|
||||
DrawRectangleRoundedLines(rec, roundness, segments, (float)lineThick, ColorAlpha(Color.MAROON, 0.4f));
|
||||
}
|
||||
|
||||
// Draw GUI controls
|
||||
//------------------------------------------------------------------------------
|
||||
/*width = GuiSliderBar(new Rectangle( 640, 40, 105, 20 ), "Width", width, 0, GetScreenWidth() - 300, true );
|
||||
height = GuiSliderBar(new Rectangle( 640, 70, 105, 20 ), "Height", height, 0, GetScreenHeight() - 50, true);
|
||||
roundness = GuiSliderBar(new Rectangle( 640, 140, 105, 20 ), "Roundness", roundness, 0.0f, 1.0f, true);
|
||||
lineThick = GuiSliderBar(new Rectangle( 640, 170, 105, 20 ), "Thickness", lineThick, 0, 20, true);
|
||||
segments = GuiSliderBar(new Rectangle( 640, 240, 105, 20), "Segments", segments, 0, 60, true);
|
||||
|
||||
drawRoundedRect = GuiCheckBox(new Rectangle( 640, 320, 20, 20 ), "DrawRoundedRect", drawRoundedRect);
|
||||
drawRoundedLines = GuiCheckBox(new Rectangle( 640, 350, 20, 20 ), "DrawRoundedLines", drawRoundedLines);
|
||||
drawRect = GuiCheckBox(new Rectangle( 640, 380, 20, 20), "DrawRect", drawRect);*/
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
string text = $"MODE: {((segments >= 4) ? "MANUAL" : "AUTO")}";
|
||||
DrawText(text, 640, 280, 10, (segments >= 4) ? Color.MAROON : Color.DARKGRAY);
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
132
Examples/Shapes/DrawRing.cs
Normal file
132
Examples/Shapes/DrawRing.cs
Normal file
@ -0,0 +1,132 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - draw ring (with gui options)
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2018 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class DrawRing
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - draw ring");
|
||||
|
||||
Vector2 center = new((GetScreenWidth() - 300) / 2, GetScreenHeight() / 2);
|
||||
|
||||
float innerRadius = 80.0f;
|
||||
float outerRadius = 190.0f;
|
||||
|
||||
int startAngle = 0;
|
||||
int endAngle = 360;
|
||||
int segments = 0;
|
||||
int minSegments = 4;
|
||||
|
||||
bool drawRing = true;
|
||||
bool drawRingLines = false;
|
||||
bool drawCircleLines = false;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// NOTE: All variables update happens inside GUI control functions
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawLine(500, 0, 500, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.6f));
|
||||
DrawRectangle(500, 0, GetScreenWidth() - 500, GetScreenHeight(), ColorAlpha(Color.LIGHTGRAY, 0.3f));
|
||||
|
||||
if (drawRing)
|
||||
{
|
||||
DrawRing(
|
||||
center,
|
||||
innerRadius,
|
||||
outerRadius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
segments,
|
||||
ColorAlpha(Color.MAROON, 0.3f)
|
||||
);
|
||||
}
|
||||
if (drawRingLines)
|
||||
{
|
||||
DrawRingLines(
|
||||
center,
|
||||
innerRadius,
|
||||
outerRadius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
segments,
|
||||
ColorAlpha(Color.BLACK, 0.4f)
|
||||
);
|
||||
}
|
||||
if (drawCircleLines)
|
||||
{
|
||||
DrawCircleSectorLines(
|
||||
center,
|
||||
outerRadius,
|
||||
startAngle,
|
||||
endAngle,
|
||||
segments,
|
||||
ColorAlpha(Color.BLACK, 0.4f)
|
||||
);
|
||||
}
|
||||
|
||||
// Draw GUI controls
|
||||
//------------------------------------------------------------------------------
|
||||
/*startAngle = GuiSliderBar(new Rectangle( 600, 40, 120, 20 ), "StartAngle", startAngle, -450, 450, true);
|
||||
endAngle = GuiSliderBar(new Rectangle( 600, 70, 120, 20 ), "EndAngle", endAngle, -450, 450, true);
|
||||
|
||||
innerRadius = GuiSliderBar(new Rectangle( 600, 140, 120, 20 ), "InnerRadius", innerRadius, 0, 100, true);
|
||||
outerRadius = GuiSliderBar(new Rectangle( 600, 170, 120, 20 ), "OuterRadius", outerRadius, 0, 200, true);
|
||||
|
||||
segments = GuiSliderBar(new Rectangle( 600, 240, 120, 20 ), "Segments", segments, 0, 100, true);
|
||||
|
||||
drawRing = GuiCheckBox(new Rectangle( 600, 320, 20, 20 ), "Draw Ring", drawRing);
|
||||
drawRingLines = GuiCheckBox(new Rectangle( 600, 350, 20, 20 ), "Draw RingLines", drawRingLines);
|
||||
drawCircleLines = GuiCheckBox(new Rectangle( 600, 380, 20, 20 ), "Draw CircleLines", drawCircleLines);*/
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
minSegments = (int)MathF.Ceiling((endAngle - startAngle) / 90);
|
||||
Color color = (segments >= minSegments) ? Color.MAROON : Color.DARKGRAY;
|
||||
DrawText($"MODE: {((segments >= minSegments) ? "MANUAL" : "AUTO")}", 600, 270, 10, color);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
126
Examples/Shapes/EasingsBallAnim.cs
Normal file
126
Examples/Shapes/EasingsBallAnim.cs
Normal file
@ -0,0 +1,126 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - easings ball anim
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class EasingsBallAnim
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings ball anim");
|
||||
|
||||
// Ball variable value to be animated with easings
|
||||
int ballPositionX = -100;
|
||||
int ballRadius = 20;
|
||||
float ballAlpha = 0.0f;
|
||||
|
||||
int state = 0;
|
||||
int framesCounter = 0;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (state == 0) // Move ball position X with easing
|
||||
{
|
||||
framesCounter += 1;
|
||||
ballPositionX = (int)Easings.EaseElasticOut(framesCounter, -100, screenWidth / 2 + 100, 120);
|
||||
|
||||
if (framesCounter >= 120)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
// Increase ball radius with easing
|
||||
else if (state == 1)
|
||||
{
|
||||
framesCounter += 1;
|
||||
ballRadius = (int)Easings.EaseElasticIn(framesCounter, 20, 500, 200);
|
||||
|
||||
if (framesCounter >= 200)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
// Change ball alpha with easing (background color blending)
|
||||
else if (state == 2)
|
||||
{
|
||||
framesCounter += 1;
|
||||
ballAlpha = Easings.EaseCubicOut(framesCounter, 0.0f, 1.0f, 200);
|
||||
|
||||
if (framesCounter >= 200)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 3;
|
||||
}
|
||||
}
|
||||
// Reset state to play again
|
||||
else if (state == 3)
|
||||
{
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER))
|
||||
{
|
||||
// Reset required variables to play again
|
||||
ballPositionX = -100;
|
||||
ballRadius = 20;
|
||||
ballAlpha = 0.0f;
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_R))
|
||||
{
|
||||
framesCounter = 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
if (state >= 2)
|
||||
{
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.GREEN);
|
||||
}
|
||||
|
||||
DrawCircle(ballPositionX, 200, ballRadius, ColorAlpha(Color.RED, 1.0f - ballAlpha));
|
||||
|
||||
if (state == 3)
|
||||
{
|
||||
DrawText("PRESS [ENTER] TO PLAY AGAIN!", 240, 200, 20, Color.BLACK);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
144
Examples/Shapes/EasingsBoxAnim.cs
Normal file
144
Examples/Shapes/EasingsBoxAnim.cs
Normal file
@ -0,0 +1,144 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - easings box anim
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class EasingsBoxAnim
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings box anim");
|
||||
|
||||
// Box variables to be animated with easings
|
||||
Rectangle rec = new(GetScreenWidth() / 2, -100, 100, 100);
|
||||
float rotation = 0.0f;
|
||||
float alpha = 1.0f;
|
||||
|
||||
int state = 0;
|
||||
int framesCounter = 0;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
switch (state)
|
||||
{
|
||||
// Move box down to center of screen
|
||||
case 0:
|
||||
framesCounter += 1;
|
||||
|
||||
// NOTE: Remember that 3rd parameter of easing function refers to
|
||||
// desired value variation, do not confuse it with expected final value!
|
||||
rec.Y = Easings.EaseElasticOut(framesCounter, -100, GetScreenHeight() / 2 + 100, 120);
|
||||
|
||||
if (framesCounter >= 120)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 1;
|
||||
}
|
||||
break;
|
||||
// Scale box to an horizontal bar
|
||||
case 1:
|
||||
framesCounter += 1;
|
||||
rec.Height = Easings.EaseBounceOut(framesCounter, 100, -90, 120);
|
||||
rec.Width = Easings.EaseBounceOut(framesCounter, 100, GetScreenWidth(), 120);
|
||||
|
||||
if (framesCounter >= 120)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 2;
|
||||
}
|
||||
break;
|
||||
// Rotate horizontal bar rectangle
|
||||
case 2:
|
||||
framesCounter += 1;
|
||||
rotation = Easings.EaseQuadOut(framesCounter, 0.0f, 270.0f, 240);
|
||||
|
||||
if (framesCounter >= 240)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 3;
|
||||
}
|
||||
break;
|
||||
// Increase bar size to fill all screen
|
||||
case 3:
|
||||
framesCounter += 1;
|
||||
rec.Height = Easings.EaseCircOut(framesCounter, 10, GetScreenWidth(), 120);
|
||||
|
||||
if (framesCounter >= 120)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 4;
|
||||
}
|
||||
break;
|
||||
// Fade out animation
|
||||
case 4:
|
||||
framesCounter++;
|
||||
alpha = Easings.EaseSineOut(framesCounter, 1.0f, -1.0f, 160);
|
||||
|
||||
if (framesCounter >= 160)
|
||||
{
|
||||
framesCounter = 0;
|
||||
state = 5;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Reset animation at any moment
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
{
|
||||
rec = new Rectangle(GetScreenWidth() / 2, -100, 100, 100);
|
||||
rotation = 0.0f;
|
||||
alpha = 1.0f;
|
||||
state = 0;
|
||||
framesCounter = 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawRectanglePro(
|
||||
rec,
|
||||
new Vector2(rec.Width / 2, rec.Height / 2),
|
||||
rotation,
|
||||
ColorAlpha(Color.BLACK, alpha)
|
||||
);
|
||||
DrawText("PRESS [SPACE] TO RESET BOX ANIMATION!", 10, GetScreenHeight() - 25, 20, Color.LIGHTGRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
140
Examples/Shapes/EasingsRectangleArray.cs
Normal file
140
Examples/Shapes/EasingsRectangleArray.cs
Normal file
@ -0,0 +1,140 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - easings rectangle array
|
||||
*
|
||||
* NOTE: This example requires 'easings.h' library, provided on raylib/src. Just copy
|
||||
* the library to same directory as example or make sure it's available on include path.
|
||||
*
|
||||
* This example has been created using raylib 2.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class EasingsRectangleArray
|
||||
{
|
||||
public const int RecsWidth = 50;
|
||||
public const int RecsHeight = 50;
|
||||
public const int MaxRecsX = 800 / RecsWidth;
|
||||
public const int MaxRecsY = 450 / RecsHeight;
|
||||
|
||||
// At 60 fps = 4 seconds
|
||||
public const int PlayTimeInFrames = 240;
|
||||
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings rectangle array");
|
||||
|
||||
Rectangle[] recs = new Rectangle[MaxRecsX * MaxRecsY];
|
||||
|
||||
for (int y = 0; y < MaxRecsY; y++)
|
||||
{
|
||||
for (int x = 0; x < MaxRecsX; x++)
|
||||
{
|
||||
recs[y * MaxRecsX + x].X = RecsWidth / 2 + RecsWidth * x;
|
||||
recs[y * MaxRecsX + x].Y = RecsHeight / 2 + RecsHeight * y;
|
||||
recs[y * MaxRecsX + x].Width = RecsWidth;
|
||||
recs[y * MaxRecsX + x].Height = RecsHeight;
|
||||
}
|
||||
}
|
||||
|
||||
float rotation = 0.0f;
|
||||
int framesCounter = 0;
|
||||
|
||||
// Rectangles animation state: 0-Playing, 1-Finished
|
||||
int state = 0;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (state == 0)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
for (int i = 0; i < MaxRecsX * MaxRecsY; i++)
|
||||
{
|
||||
recs[i].Height = Easings.EaseCircOut(framesCounter, RecsHeight, -RecsHeight, PlayTimeInFrames);
|
||||
recs[i].Width = Easings.EaseCircOut(framesCounter, RecsWidth, -RecsWidth, PlayTimeInFrames);
|
||||
|
||||
if (recs[i].Height < 0)
|
||||
{
|
||||
recs[i].Height = 0;
|
||||
}
|
||||
if (recs[i].Width < 0)
|
||||
{
|
||||
recs[i].Width = 0;
|
||||
}
|
||||
|
||||
// Finish playing
|
||||
if ((recs[i].Height == 0) && (recs[i].Width == 0))
|
||||
{
|
||||
state = 1;
|
||||
}
|
||||
rotation = Easings.EaseLinearIn(framesCounter, 0.0f, 360.0f, PlayTimeInFrames);
|
||||
}
|
||||
}
|
||||
else if ((state == 1) && IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
{
|
||||
// When animation has finished, press space to restart
|
||||
framesCounter = 0;
|
||||
|
||||
for (int i = 0; i < MaxRecsX * MaxRecsY; i++)
|
||||
{
|
||||
recs[i].Height = RecsHeight;
|
||||
recs[i].Width = RecsWidth;
|
||||
}
|
||||
|
||||
state = 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
for (int i = 0; i < MaxRecsX * MaxRecsY; i++)
|
||||
{
|
||||
DrawRectanglePro(
|
||||
recs[i],
|
||||
new Vector2(recs[i].Width / 2, recs[i].Height / 2),
|
||||
rotation,
|
||||
Color.RED
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (state == 1)
|
||||
{
|
||||
DrawText("PRESS [SPACE] TO PLAY AGAIN!", 240, 200, 20, Color.GRAY);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
108
Examples/Shapes/FollowingEyes.cs
Normal file
108
Examples/Shapes/FollowingEyes.cs
Normal file
@ -0,0 +1,108 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - following eyes
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013-2019 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class FollowingEyes
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - following eyes");
|
||||
|
||||
Vector2 scleraLeftPosition = new(GetScreenWidth() / 2 - 100, GetScreenHeight() / 2);
|
||||
Vector2 scleraRightPosition = new(GetScreenWidth() / 2 + 100, GetScreenHeight() / 2);
|
||||
float scleraRadius = 80;
|
||||
|
||||
Vector2 irisLeftPosition = new(GetScreenWidth() / 2 - 100, GetScreenHeight() / 2);
|
||||
Vector2 irisRightPosition = new(GetScreenWidth() / 2 + 100, GetScreenHeight() / 2);
|
||||
float irisRadius = 24;
|
||||
|
||||
float angle = 0.0f;
|
||||
float dx = 0.0f, dy = 0.0f, dxx = 0.0f, dyy = 0.0f;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
irisLeftPosition = GetMousePosition();
|
||||
irisRightPosition = GetMousePosition();
|
||||
|
||||
// Check not inside the left eye sclera
|
||||
if (!CheckCollisionPointCircle(irisLeftPosition, scleraLeftPosition, scleraRadius - 20))
|
||||
{
|
||||
dx = irisLeftPosition.X - scleraLeftPosition.X;
|
||||
dy = irisLeftPosition.Y - scleraLeftPosition.Y;
|
||||
|
||||
angle = MathF.Atan2(dy, dx);
|
||||
|
||||
dxx = (scleraRadius - irisRadius) * MathF.Cos(angle);
|
||||
dyy = (scleraRadius - irisRadius) * MathF.Sin(angle);
|
||||
|
||||
irisLeftPosition.X = scleraLeftPosition.X + dxx;
|
||||
irisLeftPosition.Y = scleraLeftPosition.Y + dyy;
|
||||
}
|
||||
|
||||
// Check not inside the right eye sclera
|
||||
if (!CheckCollisionPointCircle(irisRightPosition, scleraRightPosition, scleraRadius - 20))
|
||||
{
|
||||
dx = irisRightPosition.X - scleraRightPosition.X;
|
||||
dy = irisRightPosition.Y - scleraRightPosition.Y;
|
||||
|
||||
angle = MathF.Atan2(dy, dx);
|
||||
|
||||
dxx = (scleraRadius - irisRadius) * MathF.Cos(angle);
|
||||
dyy = (scleraRadius - irisRadius) * MathF.Sin(angle);
|
||||
|
||||
irisRightPosition.X = scleraRightPosition.X + dxx;
|
||||
irisRightPosition.Y = scleraRightPosition.Y + dyy;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawCircleV(scleraLeftPosition, scleraRadius, Color.LIGHTGRAY);
|
||||
DrawCircleV(irisLeftPosition, irisRadius, Color.BROWN);
|
||||
DrawCircleV(irisLeftPosition, 10, Color.BLACK);
|
||||
|
||||
DrawCircleV(scleraRightPosition, scleraRadius, Color.LIGHTGRAY);
|
||||
DrawCircleV(irisRightPosition, irisRadius, Color.DARKGREEN);
|
||||
DrawCircleV(irisRightPosition, 10, Color.BLACK);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
69
Examples/Shapes/LinesBezier.cs
Normal file
69
Examples/Shapes/LinesBezier.cs
Normal file
@ -0,0 +1,69 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - Cubic-bezier lines
|
||||
*
|
||||
* 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)
|
||||
*
|
||||
* Copyright (c) 2017 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class LinesBezier
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
SetConfigFlags(ConfigFlags.FLAG_MSAA_4X_HINT);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - cubic-bezier lines");
|
||||
|
||||
Vector2 start = new(0, 0);
|
||||
Vector2 end = new(screenWidth, screenHeight);
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsMouseButtonDown(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
start = GetMousePosition();
|
||||
}
|
||||
else if (IsMouseButtonDown(MouseButton.MOUSE_RIGHT_BUTTON))
|
||||
{
|
||||
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();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
193
Examples/Shapes/LogoRaylibAnim.cs
Normal file
193
Examples/Shapes/LogoRaylibAnim.cs
Normal file
@ -0,0 +1,193 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - raylib logo animation
|
||||
*
|
||||
* This example has been created using raylib 1.4 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class LogoRaylibAnim
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo animation");
|
||||
|
||||
int logoPositionX = screenWidth / 2 - 128;
|
||||
int logoPositionY = screenHeight / 2 - 128;
|
||||
|
||||
int framesCounter = 0;
|
||||
int lettersCount = 0;
|
||||
|
||||
int topSideRecWidth = 16;
|
||||
int leftSideRecHeight = 16;
|
||||
|
||||
int bottomSideRecWidth = 16;
|
||||
int rightSideRecHeight = 16;
|
||||
|
||||
// Tracking animation states (State Machine)
|
||||
int state = 0;
|
||||
|
||||
// Useful for fading
|
||||
float alpha = 1.0f;
|
||||
|
||||
Color outline = new(139, 71, 135, 255);
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// State 0: Small box blinking
|
||||
if (state == 0)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
// Reset counter... will be used later...
|
||||
if (framesCounter == 120)
|
||||
{
|
||||
state = 1;
|
||||
framesCounter = 0;
|
||||
}
|
||||
}
|
||||
// State 1: Top and left bars growing
|
||||
else if (state == 1)
|
||||
{
|
||||
topSideRecWidth += 4;
|
||||
leftSideRecHeight += 4;
|
||||
|
||||
if (topSideRecWidth == 256)
|
||||
{
|
||||
state = 2;
|
||||
}
|
||||
}
|
||||
// State 2: Bottom and right bars growing
|
||||
else if (state == 2)
|
||||
{
|
||||
bottomSideRecWidth += 4;
|
||||
rightSideRecHeight += 4;
|
||||
|
||||
if (bottomSideRecWidth == 256)
|
||||
{
|
||||
state = 3;
|
||||
}
|
||||
}
|
||||
// State 3: Letters appearing (one by one)
|
||||
else if (state == 3)
|
||||
{
|
||||
framesCounter++;
|
||||
|
||||
// Every 12 frames, one more letter!
|
||||
if (framesCounter / 12 != 0)
|
||||
{
|
||||
lettersCount++;
|
||||
framesCounter = 0;
|
||||
}
|
||||
|
||||
// When all letters have appeared, just fade out everything
|
||||
if (lettersCount >= 10)
|
||||
{
|
||||
alpha -= 0.02f;
|
||||
|
||||
if (alpha <= 0.0f)
|
||||
{
|
||||
alpha = 0.0f;
|
||||
state = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
// State 4: Reset and Replay
|
||||
else if (state == 4)
|
||||
{
|
||||
if (IsKeyPressed(KeyboardKey.KEY_R))
|
||||
{
|
||||
framesCounter = 0;
|
||||
lettersCount = 0;
|
||||
|
||||
topSideRecWidth = 16;
|
||||
leftSideRecHeight = 16;
|
||||
|
||||
bottomSideRecWidth = 16;
|
||||
rightSideRecHeight = 16;
|
||||
|
||||
// Return to State 0
|
||||
alpha = 1.0f;
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
if (state == 0)
|
||||
{
|
||||
if ((framesCounter / 15) % 2 != 0)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY, 16, 16, outline);
|
||||
}
|
||||
}
|
||||
else if (state == 1)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, outline);
|
||||
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, outline);
|
||||
}
|
||||
else if (state == 2)
|
||||
{
|
||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, outline);
|
||||
DrawRectangle(logoPositionX, logoPositionY, 16, leftSideRecHeight, outline);
|
||||
|
||||
DrawRectangle(logoPositionX + 240, logoPositionY, 16, rightSideRecHeight, outline);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, outline);
|
||||
}
|
||||
else if (state == 3)
|
||||
{
|
||||
Color outlineFade = ColorAlpha(outline, alpha);
|
||||
DrawRectangle(logoPositionX, logoPositionY, topSideRecWidth, 16, outlineFade);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 16, 16, leftSideRecHeight - 32, outlineFade);
|
||||
|
||||
DrawRectangle(logoPositionX + 240, logoPositionY + 16, 16, rightSideRecHeight - 32, outlineFade);
|
||||
DrawRectangle(logoPositionX, logoPositionY + 240, bottomSideRecWidth, 16, outlineFade);
|
||||
|
||||
Color whiteFade = ColorAlpha(Color.RAYWHITE, alpha);
|
||||
DrawRectangle(screenWidth / 2 - 112, screenHeight / 2 - 112, 224, 224, whiteFade);
|
||||
|
||||
Color label = ColorAlpha(new Color(155, 79, 151, 255), alpha);
|
||||
string text = "raylib".SubText(0, lettersCount);
|
||||
DrawText(text, screenWidth / 2 - 44, screenHeight / 2 + 28, 50, label);
|
||||
|
||||
DrawText("cs".SubText(0, lettersCount), screenWidth / 2 - 44, screenHeight / 2 + 58, 50, label);
|
||||
}
|
||||
else if (state == 4)
|
||||
{
|
||||
DrawText("[R] REPLAY", 340, 200, 20, Color.GRAY);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
61
Examples/Shapes/LogoRaylibShape.cs
Normal file
61
Examples/Shapes/LogoRaylibShape.cs
Normal file
@ -0,0 +1,61 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - Draw raylib logo using basic shapes
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class LogoRaylibShape
|
||||
{
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - raylib logo using shapes");
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// TODO: Update your variables here
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawRectangle(screenWidth / 2 - 128, screenHeight / 2 - 128, 256, 256, new Color(139, 71, 135, 255));
|
||||
DrawRectangle(screenWidth / 2 - 112, screenHeight / 2 - 112, 224, 224, Color.RAYWHITE);
|
||||
DrawText("raylib", screenWidth / 2 - 44, screenHeight / 2 + 28, 50, new Color(155, 79, 151, 255));
|
||||
DrawText("cs", screenWidth / 2 - 44, screenHeight / 2 + 58, 50, new Color(155, 79, 151, 255));
|
||||
|
||||
DrawText("this is NOT a texture!", 350, 370, 10, Color.GRAY);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
122
Examples/Shapes/RectangleScaling.cs
Normal file
122
Examples/Shapes/RectangleScaling.cs
Normal file
@ -0,0 +1,122 @@
|
||||
/*******************************************************************************************
|
||||
*
|
||||
* raylib [shapes] example - rectangle scaling by mouse
|
||||
*
|
||||
* This example has been created using raylib 2.5 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Example contributed by Vlad Adrian (@demizdor) and reviewed by Ramon Santamaria (@raysan5)
|
||||
*
|
||||
* Copyright (c) 2018 Vlad Adrian (@demizdor) and Ramon Santamaria (@raysan5)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
using System.Numerics;
|
||||
using static Raylib_cs.Raylib;
|
||||
|
||||
namespace Examples.Shapes;
|
||||
|
||||
public class RectangleScaling
|
||||
{
|
||||
public const int MOUSE_SCALE_MARK_SIZE = 12;
|
||||
|
||||
public static int Main()
|
||||
{
|
||||
// Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - rectangle scaling mouse");
|
||||
|
||||
Rectangle rec = new(100, 100, 200, 80);
|
||||
Vector2 mousePosition = new(0, 0);
|
||||
|
||||
bool mouseScaleReady = false;
|
||||
bool mouseScaleMode = false;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
while (!WindowShouldClose())
|
||||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
mousePosition = GetMousePosition();
|
||||
|
||||
Rectangle area = new(
|
||||
rec.X + rec.Width - MOUSE_SCALE_MARK_SIZE,
|
||||
rec.Y + rec.Height - MOUSE_SCALE_MARK_SIZE,
|
||||
MOUSE_SCALE_MARK_SIZE,
|
||||
MOUSE_SCALE_MARK_SIZE
|
||||
);
|
||||
|
||||
if (CheckCollisionPointRec(mousePosition, rec) &&
|
||||
CheckCollisionPointRec(mousePosition, area))
|
||||
{
|
||||
mouseScaleReady = true;
|
||||
if (IsMouseButtonPressed(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
mouseScaleMode = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mouseScaleReady = false;
|
||||
}
|
||||
|
||||
if (mouseScaleMode)
|
||||
{
|
||||
mouseScaleReady = true;
|
||||
|
||||
rec.Width = (mousePosition.X - rec.X);
|
||||
rec.Height = (mousePosition.Y - rec.Y);
|
||||
|
||||
if (rec.Width < MOUSE_SCALE_MARK_SIZE)
|
||||
{
|
||||
rec.Width = MOUSE_SCALE_MARK_SIZE;
|
||||
}
|
||||
if (rec.Height < MOUSE_SCALE_MARK_SIZE)
|
||||
{
|
||||
rec.Height = MOUSE_SCALE_MARK_SIZE;
|
||||
}
|
||||
|
||||
if (IsMouseButtonReleased(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
{
|
||||
mouseScaleMode = false;
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
|
||||
DrawText("Scale rectangle dragging from bottom-right corner!", 10, 10, 20, Color.GRAY);
|
||||
DrawRectangleRec(rec, ColorAlpha(Color.GREEN, 0.5f));
|
||||
|
||||
if (mouseScaleReady)
|
||||
{
|
||||
DrawRectangleLinesEx(rec, 1, Color.RED);
|
||||
DrawTriangle(
|
||||
new Vector2(rec.X + rec.Width - MOUSE_SCALE_MARK_SIZE, rec.Y + rec.Height),
|
||||
new Vector2(rec.X + rec.Width, rec.Y + rec.Height),
|
||||
new Vector2(rec.X + rec.Width, rec.Y + rec.Height - MOUSE_SCALE_MARK_SIZE),
|
||||
Color.RED
|
||||
);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
}
|
||||
|
||||
// De-Initialization
|
||||
//--------------------------------------------------------------------------------------
|
||||
CloseWindow();
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user