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

chore: clean up linter warnings

This commit is contained in:
tiger tiger tiger 2026-07-29 19:58:47 +02:00
commit dfc34997bc
No known key found for this signature in database
217 changed files with 1863 additions and 1077 deletions

View file

@ -15,9 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public partial class AsciiRendering : IExample

View file

@ -20,8 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using Examples.Shared;
namespace Examples.Shaders;

View file

@ -19,9 +19,7 @@
*
********************************************************************************************/
using System.Numerics;
using Examples.Shared;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;

View file

@ -18,9 +18,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath;
using static Raylib_cs.Rlgl;
using Examples.Shared;

View file

@ -18,8 +18,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public partial class ColorCorrection : IExample
@ -85,10 +83,22 @@ public partial class ColorCorrection : IExample
// Update
//----------------------------------------------------------------------------------
// Select texture to draw
if (IsKeyPressed(KeyboardKey.One)) imageIndex = 0;
else if (IsKeyPressed(KeyboardKey.Two)) imageIndex = 1;
else if (IsKeyPressed(KeyboardKey.Three)) imageIndex = 2;
else if (IsKeyPressed(KeyboardKey.Four)) imageIndex = 3;
if (IsKeyPressed(KeyboardKey.One))
{
imageIndex = 0;
}
else if (IsKeyPressed(KeyboardKey.Two))
{
imageIndex = 1;
}
else if (IsKeyPressed(KeyboardKey.Three))
{
imageIndex = 2;
}
else if (IsKeyPressed(KeyboardKey.Four))
{
imageIndex = 3;
}
// Reset values to 0
if (IsKeyPressed(KeyboardKey.R) || resetButtonClicked != 0)

View file

@ -20,9 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class CustomUniform : IExample

View file

@ -17,9 +17,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
using Examples.Shared;
namespace Examples.Shaders;
@ -218,13 +215,31 @@ public partial class DeferredRendering : IExample
if (IsKeyPressed(KeyboardKey.B)) { lights[3].Enabled = !lights[3].Enabled; }
// Check key inputs to switch between G-buffer textures
if (IsKeyPressed(KeyboardKey.One)) mode = DeferredMode.Position;
if (IsKeyPressed(KeyboardKey.Two)) mode = DeferredMode.Normal;
if (IsKeyPressed(KeyboardKey.Three)) mode = DeferredMode.Albedo;
if (IsKeyPressed(KeyboardKey.Four)) mode = DeferredMode.Shading;
if (IsKeyPressed(KeyboardKey.One))
{
mode = DeferredMode.Position;
}
if (IsKeyPressed(KeyboardKey.Two))
{
mode = DeferredMode.Normal;
}
if (IsKeyPressed(KeyboardKey.Three))
{
mode = DeferredMode.Albedo;
}
if (IsKeyPressed(KeyboardKey.Four))
{
mode = DeferredMode.Shading;
}
// Update light values (actually, only enable/disable them)
for (var i = 0; i < MaxLights; i++) Rlights.UpdateLightValues(deferredShader, lights[i]);
for (var i = 0; i < MaxLights; i++)
{
Rlights.UpdateLightValues(deferredShader, lights[i]);
}
//----------------------------------------------------------------------------------
// Draw
@ -295,9 +310,15 @@ public partial class DeferredRendering : IExample
Rlgl.EnableShader(Rlgl.GetShaderIdDefault());
for (var i = 0; i < MaxLights; i++)
{
if (lights[i].Enabled) DrawSphereEx(lights[i].Position, 0.2f, 8, 8, lights[i].Color);
else DrawSphereWires(lights[i].Position, 0.2f, 8, 8, ColorAlpha(lights[i].Color, 0.3f));
}
if (lights[i].Enabled)
{
DrawSphereEx(lights[i].Position, 0.2f, 8, 8, lights[i].Color);
}
else
{
DrawSphereWires(lights[i].Position, 0.2f, 8, 8, ColorAlpha(lights[i].Color, 0.3f));
}
}
Rlgl.DisableShader();
EndMode3D();

View file

@ -15,9 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class DepthRendering : IExample

View file

@ -27,9 +27,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class Eratosthenes : IExample

View file

@ -20,8 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath;
using Examples.Shared;

View file

@ -18,10 +18,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public partial class GameOfLife : IExample
@ -186,15 +182,30 @@ public partial class GameOfLife : IExample
var centerX = offsetX + (windowWidth / 2.0f) / zoom;
var centerY = offsetY + (windowHeight / 2.0f) / zoom;
if (buttonZoomIn || (mouseWheelMove > 0.0f)) zoom *= 2;
if ((buttonZomOut || (mouseWheelMove < 0.0f)) && (zoom > 1)) zoom /= 2;
if (buttonZoomIn || (mouseWheelMove > 0.0f))
{
zoom *= 2;
}
if ((buttonZomOut || (mouseWheelMove < 0.0f)) && (zoom > 1))
{
zoom /= 2;
}
offsetX = centerX - (windowWidth / 2.0f) / zoom;
offsetY = centerY - (windowHeight / 2.0f) / zoom;
}
// Change speed: number of frames per step
if (buttonFaster && framesPerStep > 1) framesPerStep--;
if (buttonSlower) framesPerStep++;
if (buttonFaster && framesPerStep > 1)
{
framesPerStep--;
}
if (buttonSlower)
{
framesPerStep++;
}
// Mouse management
if ((mode == InteractionMode.Run) || (mode == InteractionMode.Pause))
@ -216,8 +227,15 @@ public partial class GameOfLife : IExample
var offsetDecimalY = offsetY - MathF.Floor(offsetY);
var sizeInWorldX = (int)(MathF.Ceiling((windowWidth + offsetDecimalX * zoom) / zoom));
var sizeInWorldY = (int)(MathF.Ceiling((windowHeight + offsetDecimalY * zoom) / zoom));
if (offsetX + sizeInWorldX >= worldWidth) sizeInWorldX = worldWidth - (int)MathF.Floor(offsetX);
if (offsetY + sizeInWorldY >= worldHeight) sizeInWorldY = worldHeight - (int)MathF.Floor(offsetY);
if (offsetX + sizeInWorldX >= worldWidth)
{
sizeInWorldX = worldWidth - (int)MathF.Floor(offsetX);
}
if (offsetY + sizeInWorldY >= worldHeight)
{
sizeInWorldY = worldHeight - (int)MathF.Floor(offsetY);
}
// Create image to draw if not created yet
if (!imageToDrawValid)
@ -242,9 +260,21 @@ public partial class GameOfLife : IExample
{
var mouseX = (int)(mousePosition.X + offsetDecimalX * zoom) / zoom;
var mouseY = (int)(mousePosition.Y + offsetDecimalY * zoom) / zoom;
if (mouseX >= sizeInWorldX) mouseX = sizeInWorldX - 1;
if (mouseY >= sizeInWorldY) mouseY = sizeInWorldY - 1;
if (firstColor == -1) firstColor = (GetImageColor(imageToDraw, mouseX, mouseY).R < 5) ? 0 : 1;
if (mouseX >= sizeInWorldX)
{
mouseX = sizeInWorldX - 1;
}
if (mouseY >= sizeInWorldY)
{
mouseY = sizeInWorldY - 1;
}
if (firstColor == -1)
{
firstColor = (GetImageColor(imageToDraw, mouseX, mouseY).R < 5) ? 0 : 1;
}
var prevColor = (GetImageColor(imageToDraw, mouseX, mouseY).R < 5) ? 0 : 1;
ImageDrawPixel(ref imageToDraw, mouseX, mouseY, (firstColor != 0) ? Color.Black : Color.RayWhite);
@ -258,7 +288,10 @@ public partial class GameOfLife : IExample
);
}
}
else firstColor = -1;
else
{
firstColor = -1;
}
}
// Load selected preset
@ -306,7 +339,10 @@ public partial class GameOfLife : IExample
{
for (var y = 0; y < pattern.Height; y++)
{
if (GetRandomValue(0, 100) < 15) ImageDrawPixel(ref pattern, x, y, Color.Black);
if (GetRandomValue(0, 100) < 15)
{
ImageDrawPixel(ref pattern, x, y, Color.Black);
}
}
}
UpdateTextureRec(
@ -326,10 +362,25 @@ public partial class GameOfLife : IExample
}
// Check window draw inside world limits
if (offsetX < 0) offsetX = 0;
if (offsetY < 0) offsetY = 0;
if (offsetX > worldWidth - (float)windowWidth / zoom) offsetX = worldWidth - (float)windowWidth / zoom;
if (offsetY > worldHeight - (float)windowHeight / zoom) offsetY = worldHeight - (float)windowHeight / zoom;
if (offsetX < 0)
{
offsetX = 0;
}
if (offsetY < 0)
{
offsetY = 0;
}
if (offsetX > worldWidth - (float)windowWidth / zoom)
{
offsetX = worldWidth - (float)windowWidth / zoom;
}
if (offsetY > worldHeight - (float)windowHeight / zoom)
{
offsetY = worldHeight - (float)windowHeight / zoom;
}
// Rectangles for drawing texture portion to screen
var textureSourceToScreen = new Rectangle(offsetX, offsetY, (float)windowWidth / zoom, (float)windowHeight / zoom);

View file

@ -16,10 +16,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class HotReloading : IExample

View file

@ -15,10 +15,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class HybridRender : IExample

View file

@ -20,9 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class JuliaSet : IExample

View file

@ -20,8 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Rlgl;
namespace Examples.Shaders;

View file

@ -21,10 +21,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public partial class MandelbrotSet : IExample
@ -122,12 +118,30 @@ public partial class MandelbrotSet : IExample
IsKeyPressed(KeyboardKey.Six))
{
var interestIndex = 0;
if (IsKeyPressed(KeyboardKey.One)) interestIndex = 0;
else if (IsKeyPressed(KeyboardKey.Two)) interestIndex = 1;
else if (IsKeyPressed(KeyboardKey.Three)) interestIndex = 2;
else if (IsKeyPressed(KeyboardKey.Four)) interestIndex = 3;
else if (IsKeyPressed(KeyboardKey.Five)) interestIndex = 4;
else if (IsKeyPressed(KeyboardKey.Six)) interestIndex = 5;
if (IsKeyPressed(KeyboardKey.One))
{
interestIndex = 0;
}
else if (IsKeyPressed(KeyboardKey.Two))
{
interestIndex = 1;
}
else if (IsKeyPressed(KeyboardKey.Three))
{
interestIndex = 2;
}
else if (IsKeyPressed(KeyboardKey.Four))
{
interestIndex = 3;
}
else if (IsKeyPressed(KeyboardKey.Five))
{
interestIndex = 4;
}
else if (IsKeyPressed(KeyboardKey.Six))
{
interestIndex = 5;
}
offset[0] = pointsOfInterest[interestIndex][0];
offset[1] = pointsOfInterest[interestIndex][1];
@ -144,7 +158,10 @@ public partial class MandelbrotSet : IExample
updateShader = true;
}
if (IsKeyPressed(KeyboardKey.F1)) showControls = !showControls; // Toggle whether or not to show controls
if (IsKeyPressed(KeyboardKey.F1))
{
showControls = !showControls; // Toggle whether or not to show controls
}
// Change number of max iterations with UP and DOWN keys
// WARNING: Increasing the number of max iterations greatly impacts performance

View file

@ -15,9 +15,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
using Examples.Shared;
namespace Examples.Shaders;

View file

@ -20,9 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class ModelShader : IExample

View file

@ -20,8 +20,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class MultiSample2d : IExample

View file

@ -18,8 +18,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath;
namespace Examples.Shaders;

View file

@ -22,8 +22,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class PaletteSwitch : IExample

View file

@ -20,9 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class PostProcessing : IExample

View file

@ -16,8 +16,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.ConfigFlags;
namespace Examples.Shaders;

View file

@ -18,11 +18,9 @@
*
********************************************************************************************/
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;

View file

@ -15,9 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class RoundedRectangle : IExample

View file

@ -15,8 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath;
using static Raylib_cs.Rlgl;

View file

@ -20,9 +20,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class ShapesTextures : IExample

View file

@ -22,8 +22,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath;
namespace Examples.Shaders;

View file

@ -30,10 +30,6 @@
*
********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class Spotlight : IExample

View file

@ -15,8 +15,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class TextureDrawing : IExample

View file

@ -18,8 +18,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class TextureOutline : IExample

View file

@ -17,9 +17,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class TextureTiling : IExample

View file

@ -22,8 +22,6 @@
*
********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class TextureWaves : IExample

View file

@ -15,8 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Rlgl;
namespace Examples.Shaders;

View file

@ -15,9 +15,6 @@
*
********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Shaders;
public class WriteDepth : IExample