Watch
3
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,10 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public unsafe partial class AmpEnvelope : IExample public unsafe partial class AmpEnvelope : IExample
@ -89,9 +85,15 @@ public unsafe partial class AmpEnvelope : IExample
{ {
// Update // Update
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KeyboardKey.Space)) env.State = ADSRState.Attack; if (IsKeyPressed(KeyboardKey.Space))
{
env.State = ADSRState.Attack;
}
if (IsKeyReleased(KeyboardKey.Space) && (env.State != ADSRState.Idle)) env.State = ADSRState.Release; if (IsKeyReleased(KeyboardKey.Space) && (env.State != ADSRState.Idle))
{
env.State = ADSRState.Release;
}
if (IsAudioStreamProcessed(stream)) if (IsAudioStreamProcessed(stream))
{ {
@ -106,7 +108,11 @@ public unsafe partial class AmpEnvelope : IExample
else else
{ {
// Clear buffer if silent to avoid looping noise // Clear buffer if silent to avoid looping noise
for (int i = 0; i < BUFFER_SIZE; i++) buffer[i] = 0; for (int i = 0; i < BUFFER_SIZE; i++)
{
buffer[i] = 0;
}
audioTime = 0.0f; audioTime = 0.0f;
} }
@ -116,7 +122,10 @@ public unsafe partial class AmpEnvelope : IExample
} }
} }
if (!IsAudioStreamPlaying(stream)) PlayAudioStream(stream); if (!IsAudioStreamPlaying(stream))
{
PlayAudioStream(stream);
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw

View file

@ -15,10 +15,8 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
@ -60,7 +58,10 @@ public unsafe partial class MixedProcessor : IExample
} }
// Moving history to the left // Moving history to the left
for (int i = 0; i < 399; i++) averageVolume[i] = averageVolume[i + 1]; for (int i = 0; i < 399; i++)
{
averageVolume[i] = averageVolume[i + 1];
}
averageVolume[399] = average; // Adding last average value averageVolume[399] = average; // Adding last average value
} }
@ -88,13 +89,30 @@ public unsafe partial class MixedProcessor : IExample
// Modify processing variables // Modify processing variables
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyPressed(KeyboardKey.Left)) exponent -= 0.05f; if (IsKeyPressed(KeyboardKey.Left))
if (IsKeyPressed(KeyboardKey.Right)) exponent += 0.05f; {
exponent -= 0.05f;
}
if (exponent <= 0.5f) exponent = 0.5f; if (IsKeyPressed(KeyboardKey.Right))
if (exponent >= 3.0f) exponent = 3.0f; {
exponent += 0.05f;
}
if (IsKeyPressed(KeyboardKey.Space)) PlaySound(sound); if (exponent <= 0.5f)
{
exponent = 0.5f;
}
if (exponent >= 3.0f)
{
exponent = 3.0f;
}
if (IsKeyPressed(KeyboardKey.Space))
{
PlaySound(sound);
}
// Draw // Draw
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------

View file

@ -13,9 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public partial class ModulePlaying : IExample public partial class ModulePlaying : IExample

View file

@ -13,8 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public partial class MusicStreamDemo : IExample public partial class MusicStreamDemo : IExample

View file

@ -15,10 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public unsafe partial class RawStream : IExample public unsafe partial class RawStream : IExample
@ -71,26 +67,40 @@ public unsafe partial class RawStream : IExample
if (IsKeyDown(KeyboardKey.Up)) if (IsKeyDown(KeyboardKey.Up))
{ {
newSineFrequency += 10; newSineFrequency += 10;
if (newSineFrequency > 12500) newSineFrequency = 12500; if (newSineFrequency > 12500)
{
newSineFrequency = 12500;
}
} }
if (IsKeyDown(KeyboardKey.Down)) if (IsKeyDown(KeyboardKey.Down))
{ {
newSineFrequency -= 10; newSineFrequency -= 10;
if (newSineFrequency < 20) newSineFrequency = 20; if (newSineFrequency < 20)
{
newSineFrequency = 20;
}
} }
if (IsKeyDown(KeyboardKey.Left)) if (IsKeyDown(KeyboardKey.Left))
{ {
pan -= 0.01f; pan -= 0.01f;
if (pan < -1.0f) pan = -1.0f; if (pan < -1.0f)
{
pan = -1.0f;
}
SetAudioStreamPan(stream, pan); SetAudioStreamPan(stream, pan);
} }
if (IsKeyDown(KeyboardKey.Right)) if (IsKeyDown(KeyboardKey.Right))
{ {
pan += 0.01f; pan += 0.01f;
if (pan > 1.0f) pan = 1.0f; if (pan > 1.0f)
{
pan = 1.0f;
}
SetAudioStreamPan(stream, pan); SetAudioStreamPan(stream, pan);
} }

View file

@ -13,8 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public partial class SoundLoading : IExample public partial class SoundLoading : IExample

View file

@ -15,8 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public partial class SoundMulti : IExample public partial class SoundMulti : IExample
@ -42,7 +40,10 @@ public partial class SoundMulti : IExample
soundArray[0] = LoadSound("resources/audio/sound.wav"); soundArray[0] = LoadSound("resources/audio/sound.wav");
// Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played // Load an alias of the sound into slots 1-9. These do not own the sound data, but can be played
for (int i = 1; i < MAX_SOUNDS; i++) soundArray[i] = LoadSoundAlias(soundArray[0]); for (int i = 1; i < MAX_SOUNDS; i++)
{
soundArray[i] = LoadSoundAlias(soundArray[0]);
}
currentSound = 0; // Set the sound list to the start currentSound = 0; // Set the sound list to the start
} }
@ -57,7 +58,10 @@ public partial class SoundMulti : IExample
currentSound++; // Increment the sound slot currentSound++; // Increment the sound slot
// If the sound slot is out of bounds, go back to 0 // If the sound slot is out of bounds, go back to 0
if (currentSound >= MAX_SOUNDS) currentSound = 0; if (currentSound >= MAX_SOUNDS)
{
currentSound = 0;
}
// NOTE: Another approach would be to look at the list for the first sound // NOTE: Another approach would be to look at the list for the first sound
// that is not playing and use that slot // that is not playing and use that slot
@ -78,7 +82,11 @@ public partial class SoundMulti : IExample
public void Unload() public void Unload()
{ {
for (int i = 1; i < MAX_SOUNDS; i++) UnloadSoundAlias(soundArray[i]); // Unload sound aliases for (int i = 1; i < MAX_SOUNDS; i++)
{
UnloadSoundAlias(soundArray[i]); // Unload sound aliases
}
UnloadSound(soundArray[0]); // Unload source sound data UnloadSound(soundArray[0]); // Unload source sound data
CloseAudioDevice(); // Close audio device CloseAudioDevice(); // Close audio device

View file

@ -15,10 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
public partial class SoundPositioning : IExample public partial class SoundPositioning : IExample
@ -67,7 +63,10 @@ public partial class SoundPositioning : IExample
SetSoundPosition(camera, sound, spherePos, 1.0f); SetSoundPosition(camera, sound, spherePos, 1.0f);
if (!IsSoundPlaying(sound)) PlaySound(sound); if (!IsSoundPlaying(sound))
{
PlaySound(sound);
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@ -112,7 +111,10 @@ public partial class SoundPositioning : IExample
// Reduce volume for sounds behind the listener // Reduce volume for sounds behind the listener
float dotProduct = Vector3.Dot(forward, normalizedDirection); float dotProduct = Vector3.Dot(forward, normalizedDirection);
if (dotProduct < 0.0f) attenuation *= (1.0f + dotProduct * 0.5f); if (dotProduct < 0.0f)
{
attenuation *= (1.0f + dotProduct * 0.5f);
}
// Set stereo panning based on sound position relative to listener // Set stereo panning based on sound position relative to listener
float pan = 0.5f + 0.5f * Vector3.Dot(normalizedDirection, right); float pan = 0.5f + 0.5f * Vector3.Dot(normalizedDirection, right);

View file

@ -20,11 +20,8 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
@ -105,31 +102,61 @@ public unsafe partial class StreamCallback : IExample
if (IsKeyDown(KeyboardKey.Up)) if (IsKeyDown(KeyboardKey.Up))
{ {
newWaveFrequency += 10; newWaveFrequency += 10;
if (newWaveFrequency > 12500) newWaveFrequency = 12500; if (newWaveFrequency > 12500)
{
newWaveFrequency = 12500;
}
} }
if (IsKeyDown(KeyboardKey.Down)) if (IsKeyDown(KeyboardKey.Down))
{ {
newWaveFrequency -= 10; newWaveFrequency -= 10;
if (newWaveFrequency < 20) newWaveFrequency = 20; if (newWaveFrequency < 20)
{
newWaveFrequency = 20;
}
} }
if (IsKeyPressed(KeyboardKey.Left)) if (IsKeyPressed(KeyboardKey.Left))
{ {
if (waveType == WaveType.Sine) waveType = WaveType.Sawtooth; if (waveType == WaveType.Sine)
else if (waveType == WaveType.Square) waveType = WaveType.Sine; {
else if (waveType == WaveType.Triangle) waveType = WaveType.Square; waveType = WaveType.Sawtooth;
else waveType = WaveType.Triangle; }
else if (waveType == WaveType.Square)
{
waveType = WaveType.Sine;
}
else if (waveType == WaveType.Triangle)
{
waveType = WaveType.Square;
}
else
{
waveType = WaveType.Triangle;
}
SetWaveCallback(); SetWaveCallback();
} }
if (IsKeyPressed(KeyboardKey.Right)) if (IsKeyPressed(KeyboardKey.Right))
{ {
if (waveType == WaveType.Sine) waveType = WaveType.Square; if (waveType == WaveType.Sine)
else if (waveType == WaveType.Square) waveType = WaveType.Triangle; {
else if (waveType == WaveType.Triangle) waveType = WaveType.Sawtooth; waveType = WaveType.Square;
else waveType = WaveType.Sine; }
else if (waveType == WaveType.Square)
{
waveType = WaveType.Triangle;
}
else if (waveType == WaveType.Triangle)
{
waveType = WaveType.Sawtooth;
}
else
{
waveType = WaveType.Sine;
}
SetWaveCallback(); SetWaveCallback();
} }
@ -197,8 +224,15 @@ public unsafe partial class StreamCallback : IExample
} }
// Save the synthesized samples for later drawing // Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - fc; i++) buffer[i] = buffer[i + fc]; for (int i = 0; i < SAMPLE_RATE - fc; i++)
for (int i = 0; i < fc; i++) buffer[SAMPLE_RATE - fc + i] = frames[i]; {
buffer[i] = buffer[i + fc];
}
for (int i = 0; i < fc; i++)
{
buffer[SAMPLE_RATE - fc + i] = frames[i];
}
} }
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
@ -222,8 +256,15 @@ public unsafe partial class StreamCallback : IExample
} }
// Save the synthesized samples for later drawing // Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - fc; i++) buffer[i] = buffer[i + fc]; for (int i = 0; i < SAMPLE_RATE - fc; i++)
for (int i = 0; i < fc; i++) buffer[SAMPLE_RATE - fc + i] = frames[i]; {
buffer[i] = buffer[i + fc];
}
for (int i = 0; i < fc; i++)
{
buffer[SAMPLE_RATE - fc + i] = frames[i];
}
} }
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
@ -247,8 +288,15 @@ public unsafe partial class StreamCallback : IExample
} }
// Save the synthesized samples for later drawing // Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - fc; i++) buffer[i] = buffer[i + fc]; for (int i = 0; i < SAMPLE_RATE - fc; i++)
for (int i = 0; i < fc; i++) buffer[SAMPLE_RATE - fc + i] = frames[i]; {
buffer[i] = buffer[i + fc];
}
for (int i = 0; i < fc; i++)
{
buffer[SAMPLE_RATE - fc + i] = frames[i];
}
} }
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })] [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
@ -272,8 +320,15 @@ public unsafe partial class StreamCallback : IExample
} }
// Save the synthesized samples for later drawing // Save the synthesized samples for later drawing
for (int i = 0; i < SAMPLE_RATE - fc; i++) buffer[i] = buffer[i + fc]; for (int i = 0; i < SAMPLE_RATE - fc; i++)
for (int i = 0; i < fc; i++) buffer[SAMPLE_RATE - fc + i] = frames[i]; {
buffer[i] = buffer[i + fc];
}
for (int i = 0; i < fc; i++)
{
buffer[SAMPLE_RATE - fc + i] = frames[i];
}
} }
public static int Main() public static int Main()

View file

@ -15,7 +15,6 @@
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static Raylib_cs.Raylib;
namespace Examples.Audio; namespace Examples.Audio;
@ -87,30 +86,51 @@ public unsafe partial class StreamEffects : IExample
{ {
pause = !pause; pause = !pause;
if (pause) PauseMusicStream(music); if (pause)
else ResumeMusicStream(music); {
PauseMusicStream(music);
}
else
{
ResumeMusicStream(music);
}
} }
// Add/Remove effect: lowpass filter // Add/Remove effect: lowpass filter
if (IsKeyPressed(KeyboardKey.F)) if (IsKeyPressed(KeyboardKey.F))
{ {
enableEffectLPF = !enableEffectLPF; enableEffectLPF = !enableEffectLPF;
if (enableEffectLPF) AttachAudioStreamProcessor(music.Stream, &AudioProcessEffectLPF); if (enableEffectLPF)
else DetachAudioStreamProcessor(music.Stream, &AudioProcessEffectLPF); {
AttachAudioStreamProcessor(music.Stream, &AudioProcessEffectLPF);
}
else
{
DetachAudioStreamProcessor(music.Stream, &AudioProcessEffectLPF);
}
} }
// Add/Remove effect: delay // Add/Remove effect: delay
if (IsKeyPressed(KeyboardKey.D)) if (IsKeyPressed(KeyboardKey.D))
{ {
enableEffectDelay = !enableEffectDelay; enableEffectDelay = !enableEffectDelay;
if (enableEffectDelay) AttachAudioStreamProcessor(music.Stream, &AudioProcessEffectDelay); if (enableEffectDelay)
else DetachAudioStreamProcessor(music.Stream, &AudioProcessEffectDelay); {
AttachAudioStreamProcessor(music.Stream, &AudioProcessEffectDelay);
}
else
{
DetachAudioStreamProcessor(music.Stream, &AudioProcessEffectDelay);
}
} }
// Get normalized time played for current music stream // Get normalized time played for current music stream
timePlayed = GetMusicTimePlayed(music) / GetMusicTimeLength(music); timePlayed = GetMusicTimePlayed(music) / GetMusicTimeLength(music);
if (timePlayed > 1.0f) timePlayed = 1.0f; // Make sure time played is no longer than music if (timePlayed > 1.0f)
{
timePlayed = 1.0f; // Make sure time played is no longer than music
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@ -180,14 +200,20 @@ public unsafe partial class StreamEffects : IExample
float leftDelay = delay[delayReadIndex++]; // ERROR: Reading buffer -> WHY??? Maybe thread related??? float leftDelay = delay[delayReadIndex++]; // ERROR: Reading buffer -> WHY??? Maybe thread related???
float rightDelay = delay[delayReadIndex++]; float rightDelay = delay[delayReadIndex++];
if (delayReadIndex == delayBufferSize) delayReadIndex = 0; if (delayReadIndex == delayBufferSize)
{
delayReadIndex = 0;
}
bufferData[i] = 0.5f * bufferData[i] + 0.5f * leftDelay; bufferData[i] = 0.5f * bufferData[i] + 0.5f * leftDelay;
bufferData[i + 1] = 0.5f * bufferData[i + 1] + 0.5f * rightDelay; bufferData[i + 1] = 0.5f * bufferData[i + 1] + 0.5f * rightDelay;
delay[delayWriteIndex++] = bufferData[i]; delay[delayWriteIndex++] = bufferData[i];
delay[delayWriteIndex++] = bufferData[i + 1]; delay[delayWriteIndex++] = bufferData[i + 1];
if (delayWriteIndex == delayBufferSize) delayWriteIndex = 0; if (delayWriteIndex == delayBufferSize)
{
delayWriteIndex = 0;
}
} }
} }
} }

View file

@ -15,10 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class AutomationEvents : IExample public partial class AutomationEvents : IExample
@ -143,8 +139,16 @@ public partial class AutomationEvents : IExample
// Update player // Update player
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
if (IsKeyDown(KeyboardKey.Left)) player.Position.X -= PLAYER_HOR_SPD * deltaTime; if (IsKeyDown(KeyboardKey.Left))
if (IsKeyDown(KeyboardKey.Right)) player.Position.X += PLAYER_HOR_SPD * deltaTime; {
player.Position.X -= PLAYER_HOR_SPD * deltaTime;
}
if (IsKeyDown(KeyboardKey.Right))
{
player.Position.X += PLAYER_HOR_SPD * deltaTime;
}
if (IsKeyDown(KeyboardKey.Space) && player.CanJump) if (IsKeyDown(KeyboardKey.Space) && player.CanJump)
{ {
player.Speed = -PLAYER_JUMP_SPD; player.Speed = -PLAYER_JUMP_SPD;
@ -173,7 +177,10 @@ public partial class AutomationEvents : IExample
player.Speed += GRAVITY * deltaTime; player.Speed += GRAVITY * deltaTime;
player.CanJump = false; player.CanJump = false;
} }
else player.CanJump = true; else
{
player.CanJump = true;
}
if (IsKeyPressed(KeyboardKey.R)) if (IsKeyPressed(KeyboardKey.R))
{ {
@ -224,8 +231,14 @@ public partial class AutomationEvents : IExample
// WARNING: On event replay, mouse-wheel internal value is set // WARNING: On event replay, mouse-wheel internal value is set
camera.Zoom += ((float)GetMouseWheelMove() * 0.05f); camera.Zoom += ((float)GetMouseWheelMove() * 0.05f);
if (camera.Zoom > 3.0f) camera.Zoom = 3.0f; if (camera.Zoom > 3.0f)
else if (camera.Zoom < 0.25f) camera.Zoom = 0.25f; {
camera.Zoom = 3.0f;
}
else if (camera.Zoom < 0.25f)
{
camera.Zoom = 0.25f;
}
for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++) for (int i = 0; i < MAX_ENVIRONMENT_ELEMENTS; i++)
{ {
@ -239,10 +252,25 @@ public partial class AutomationEvents : IExample
Vector2 max = GetWorldToScreen2D(new Vector2(maxX, maxY), camera); Vector2 max = GetWorldToScreen2D(new Vector2(maxX, maxY), camera);
Vector2 min = GetWorldToScreen2D(new Vector2(minX, minY), camera); Vector2 min = GetWorldToScreen2D(new Vector2(minX, minY), camera);
if (max.X < screenWidth) camera.Offset.X = screenWidth - (max.X - (float)screenWidth / 2); if (max.X < screenWidth)
if (max.Y < screenHeight) camera.Offset.Y = screenHeight - (max.Y - (float)screenHeight / 2); {
if (min.X > 0) camera.Offset.X = (float)screenWidth / 2 - min.X; camera.Offset.X = screenWidth - (max.X - (float)screenWidth / 2);
if (min.Y > 0) camera.Offset.Y = (float)screenHeight / 2 - min.Y; }
if (max.Y < screenHeight)
{
camera.Offset.Y = screenHeight - (max.Y - (float)screenHeight / 2);
}
if (min.X > 0)
{
camera.Offset.X = (float)screenWidth / 2 - min.X;
}
if (min.Y > 0)
{
camera.Offset.Y = (float)screenHeight / 2 - min.Y;
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Events management // Events management
@ -287,8 +315,14 @@ public partial class AutomationEvents : IExample
} }
} }
if (eventRecording || eventPlaying) frameCounter++; if (eventRecording || eventPlaying)
else frameCounter = 0; {
frameCounter++;
}
else
{
frameCounter = 0;
}
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw // Draw
@ -329,7 +363,10 @@ public partial class AutomationEvents : IExample
DrawRectangleLines(10, 160, 290, 30, Fade(Color.Maroon, 0.8f)); DrawRectangleLines(10, 160, 290, 30, Fade(Color.Maroon, 0.8f));
DrawCircle(30, 175, 10, Color.Maroon); DrawCircle(30, 175, 10, Color.Maroon);
if (((frameCounter / 15) % 2) == 1) DrawText($"RECORDING EVENTS... [{aelist.Count}]", 50, 170, 10, Color.Maroon); if (((frameCounter / 15) % 2) == 1)
{
DrawText($"RECORDING EVENTS... [{aelist.Count}]", 50, 170, 10, Color.Maroon);
}
} }
else if (eventPlaying) else if (eventPlaying)
{ {
@ -337,7 +374,10 @@ public partial class AutomationEvents : IExample
DrawRectangleLines(10, 160, 290, 30, Fade(Color.DarkGreen, 0.8f)); DrawRectangleLines(10, 160, 290, 30, Fade(Color.DarkGreen, 0.8f));
DrawTriangle(new Vector2(20, 155 + 10), new Vector2(20, 155 + 30), new Vector2(40, 155 + 20), Color.DarkGreen); DrawTriangle(new Vector2(20, 155 + 10), new Vector2(20, 155 + 30), new Vector2(40, 155 + 20), Color.DarkGreen);
if (((frameCounter / 15) % 2) == 1) DrawText($"PLAYING RECORDED EVENTS... [{currentPlayFrame}]", 50, 170, 10, Color.DarkGreen); if (((frameCounter / 15) % 2) == 1)
{
DrawText($"PLAYING RECORDED EVENTS... [{currentPlayFrame}]", 50, 170, 10, Color.DarkGreen);
}
} }
EndDrawing(); EndDrawing();

View file

@ -15,8 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
internal enum GameScreen internal enum GameScreen

View file

@ -26,11 +26,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System.Numerics;
using System;
using System.Text;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class BasicWindow : IExample public partial class BasicWindow : IExample

View file

@ -13,10 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class Camera2dDemo : IExample public partial class Camera2dDemo : IExample

View file

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

View file

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

View file

@ -13,9 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class Camera3dFirstPerson : IExample public partial class Camera3dFirstPerson : IExample

View file

@ -15,9 +15,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System;
using System.Numerics;
using static Raylib_cs.Raylib;
using static Raylib_cs.Raymath; using static Raylib_cs.Raymath;
namespace Examples.Core; namespace Examples.Core;
@ -167,11 +164,17 @@ public partial class Camera3dFps : IExample
// `#define NORMALIZE_INPUT 0` above it (defined() tests definedness, not the value), so the // `#define NORMALIZE_INPUT 0` above it (defined() tests definedness, not the value), so the
// diagonal-movement normalization is active. // diagonal-movement normalization is active.
// Slow down diagonal movement // Slow down diagonal movement
if ((side != 0) && (forward != 0)) input = Vector2Normalize(input); if ((side != 0) && (forward != 0))
{
input = Vector2Normalize(input);
}
float delta = GetFrameTime(); float delta = GetFrameTime();
if (!body.IsGrounded) body.Velocity.Y -= GRAVITY * delta; if (!body.IsGrounded)
{
body.Velocity.Y -= GRAVITY * delta;
}
if (body.IsGrounded && jumpPressed) if (body.IsGrounded && jumpPressed)
{ {
@ -196,7 +199,10 @@ public partial class Camera3dFps : IExample
Vector3 hvel = new Vector3(body.Velocity.X * decel, 0.0f, body.Velocity.Z * decel); Vector3 hvel = new Vector3(body.Velocity.X * decel, 0.0f, body.Velocity.Z * decel);
float hvelLength = Vector3Length(hvel); // Magnitude float hvelLength = Vector3Length(hvel); // Magnitude
if (hvelLength < (MAX_SPEED * 0.01f)) hvel = new Vector3(0, 0, 0); if (hvelLength < (MAX_SPEED * 0.01f))
{
hvel = new Vector3(0, 0, 0);
}
// This is what creates strafing // This is what creates strafing
float speed = Vector3DotProduct(hvel, body.Dir); float speed = Vector3DotProduct(hvel, body.Dir);

View file

@ -13,9 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class Camera3dFree : IExample public partial class Camera3dFree : IExample

View file

@ -13,9 +13,6 @@
* *
********************************************************************************************/ ********************************************************************************************/
using System.Numerics;
using static Raylib_cs.Raylib;
namespace Examples.Core; namespace Examples.Core;
public partial class Camera3dMode : IExample public partial class Camera3dMode : IExample

Some files were not shown because too many files have changed in this diff Show more