Update enum/color names to match C# naming convention (#224)
This commit is contained in:
parent
2a1889403d
commit
70d86837d4
112 changed files with 1846 additions and 1850 deletions
|
|
@ -36,27 +36,27 @@ public class ModulePlaying
|
|||
const int screenWidth = 800;
|
||||
const int screenHeight = 450;
|
||||
|
||||
SetConfigFlags(ConfigFlags.FLAG_MSAA_4X_HINT); // NOTE: Try to enable MSAA 4X
|
||||
SetConfigFlags(ConfigFlags.Msaa4xHint); // NOTE: Try to enable MSAA 4X
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [audio] example - module playing (streaming)");
|
||||
|
||||
InitAudioDevice();
|
||||
|
||||
Color[] colors = new Color[14] {
|
||||
Color.ORANGE,
|
||||
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
|
||||
Color.Orange,
|
||||
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
|
||||
};
|
||||
|
||||
// Creates ome circles for visual effect
|
||||
|
|
@ -92,14 +92,14 @@ public class ModulePlaying
|
|||
UpdateMusicStream(music); // Update music buffer with new stream data
|
||||
|
||||
// Restart music playing (stop and play)
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Space))
|
||||
{
|
||||
StopMusicStream(music);
|
||||
PlayMusicStream(music);
|
||||
}
|
||||
|
||||
// Pause/Resume music playing
|
||||
if (IsKeyPressed(KeyboardKey.KEY_P))
|
||||
if (IsKeyPressed(KeyboardKey.P))
|
||||
{
|
||||
pause = !pause;
|
||||
|
||||
|
|
@ -113,11 +113,11 @@ public class ModulePlaying
|
|||
}
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_DOWN))
|
||||
if (IsKeyDown(KeyboardKey.Down))
|
||||
{
|
||||
pitch -= 0.01f;
|
||||
}
|
||||
else if (IsKeyDown(KeyboardKey.KEY_UP))
|
||||
else if (IsKeyDown(KeyboardKey.Up))
|
||||
{
|
||||
pitch += 0.01f;
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ public class ModulePlaying
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
for (int i = MaxCircles - 1; i >= 0; i--)
|
||||
{
|
||||
|
|
@ -171,9 +171,9 @@ public class ModulePlaying
|
|||
}
|
||||
|
||||
// Draw time bar
|
||||
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, Color.LIGHTGRAY);
|
||||
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, Color.MAROON);
|
||||
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, Color.GRAY);
|
||||
DrawRectangle(20, screenHeight - 20 - 12, screenWidth - 40, 12, Color.LightGray);
|
||||
DrawRectangle(20, screenHeight - 20 - 12, (int)timePlayed, 12, Color.Maroon);
|
||||
DrawRectangleLines(20, screenHeight - 20 - 12, screenWidth - 40, 12, Color.Gray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -44,14 +44,14 @@ public class MusicStreamDemo
|
|||
UpdateMusicStream(music); // Update music buffer with new stream data
|
||||
|
||||
// Restart music playing (stop and play)
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Space))
|
||||
{
|
||||
StopMusicStream(music);
|
||||
PlayMusicStream(music);
|
||||
}
|
||||
|
||||
// Pause/Resume music playing
|
||||
if (IsKeyPressed(KeyboardKey.KEY_P))
|
||||
if (IsKeyPressed(KeyboardKey.P))
|
||||
{
|
||||
pause = !pause;
|
||||
|
||||
|
|
@ -77,16 +77,16 @@ public class MusicStreamDemo
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, Color.LIGHTGRAY);
|
||||
DrawText("MUSIC SHOULD BE PLAYING!", 255, 150, 20, Color.LightGray);
|
||||
|
||||
DrawRectangle(200, 200, 400, 12, Color.LIGHTGRAY);
|
||||
DrawRectangle(200, 200, (int)timePlayed, 12, Color.MAROON);
|
||||
DrawRectangleLines(200, 200, 400, 12, Color.GRAY);
|
||||
DrawRectangle(200, 200, 400, 12, Color.LightGray);
|
||||
DrawRectangle(200, 200, (int)timePlayed, 12, Color.Maroon);
|
||||
DrawRectangleLines(200, 200, 400, 12, Color.Gray);
|
||||
|
||||
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, Color.LIGHTGRAY);
|
||||
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, Color.LIGHTGRAY);
|
||||
DrawText("PRESS SPACE TO RESTART MUSIC", 215, 250, 20, Color.LightGray);
|
||||
DrawText("PRESS P TO PAUSE/RESUME MUSIC", 208, 280, 20, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -38,12 +38,12 @@ public class SoundLoading
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KeyboardKey.KEY_SPACE))
|
||||
if (IsKeyPressed(KeyboardKey.Space))
|
||||
{
|
||||
PlaySound(fxWav);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER))
|
||||
if (IsKeyPressed(KeyboardKey.Enter))
|
||||
{
|
||||
PlaySound(fxOgg);
|
||||
}
|
||||
|
|
@ -52,10 +52,10 @@ public class SoundLoading
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, Color.LIGHTGRAY);
|
||||
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, Color.LIGHTGRAY);
|
||||
DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, Color.LightGray);
|
||||
DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class BasicScreenManager
|
|||
// TODO: Update TITLE screen variables here!
|
||||
|
||||
// Press enter to change to GAMEPLAY screen
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER) || IsGestureDetected(Gesture.GESTURE_TAP))
|
||||
if (IsKeyPressed(KeyboardKey.Enter) || IsGestureDetected(Gesture.Tap))
|
||||
{
|
||||
currentScreen = GameScreen.Gameplay;
|
||||
}
|
||||
|
|
@ -89,7 +89,7 @@ public class BasicScreenManager
|
|||
// TODO: Update GAMEPLAY screen variables here!
|
||||
|
||||
// Press enter to change to ENDING screen
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER) || IsGestureDetected(Gesture.GESTURE_TAP))
|
||||
if (IsKeyPressed(KeyboardKey.Enter) || IsGestureDetected(Gesture.Tap))
|
||||
{
|
||||
currentScreen = GameScreen.Ending;
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ public class BasicScreenManager
|
|||
// TODO: Update ENDING screen variables here!
|
||||
|
||||
// Press enter to return to TITLE screen
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ENTER) || IsGestureDetected(Gesture.GESTURE_TAP))
|
||||
if (IsKeyPressed(KeyboardKey.Enter) || IsGestureDetected(Gesture.Tap))
|
||||
{
|
||||
currentScreen = GameScreen.Title;
|
||||
}
|
||||
|
|
@ -115,42 +115,42 @@ public class BasicScreenManager
|
|||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
switch (currentScreen)
|
||||
{
|
||||
case GameScreen.Logo:
|
||||
{
|
||||
// TODO: Draw LOGO screen here!
|
||||
DrawText("LOGO SCREEN", 20, 20, 40, Color.LIGHTGRAY);
|
||||
DrawText("WAIT for 2 SECONDS...", 290, 220, 20, Color.GRAY);
|
||||
DrawText("LOGO SCREEN", 20, 20, 40, Color.LightGray);
|
||||
DrawText("WAIT for 2 SECONDS...", 290, 220, 20, Color.Gray);
|
||||
|
||||
}
|
||||
break;
|
||||
case GameScreen.Title:
|
||||
{
|
||||
// TODO: Draw TITLE screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.GREEN);
|
||||
DrawText("TITLE SCREEN", 20, 20, 40, Color.DARKGREEN);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, Color.DARKGREEN);
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.Green);
|
||||
DrawText("TITLE SCREEN", 20, 20, 40, Color.DarkGreen);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to GAMEPLAY SCREEN", 120, 220, 20, Color.DarkGreen);
|
||||
|
||||
}
|
||||
break;
|
||||
case GameScreen.Gameplay:
|
||||
{
|
||||
// TODO: Draw GAMEPLAY screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.PURPLE);
|
||||
DrawText("GAMEPLAY SCREEN", 20, 20, 40, Color.MAROON);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, Color.MAROON);
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.Purple);
|
||||
DrawText("GAMEPLAY SCREEN", 20, 20, 40, Color.Maroon);
|
||||
DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, Color.Maroon);
|
||||
|
||||
}
|
||||
break;
|
||||
case GameScreen.Ending:
|
||||
{
|
||||
// TODO: Draw ENDING screen here!
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.BLUE);
|
||||
DrawText("ENDING SCREEN", 20, 20, 40, Color.DARKBLUE);
|
||||
DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, Color.DARKBLUE);
|
||||
DrawRectangle(0, 0, screenWidth, screenHeight, Color.Blue);
|
||||
DrawText("ENDING SCREEN", 20, 20, 40, Color.DarkBlue);
|
||||
DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, Color.DarkBlue);
|
||||
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ public class BasicWindow
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, Color.MAROON);
|
||||
DrawText("Congrats! You created your first window!", 190, 200, 20, Color.Maroon);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ public class Camera2dDemo
|
|||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Player movement
|
||||
if (IsKeyDown(KeyboardKey.KEY_RIGHT))
|
||||
if (IsKeyDown(KeyboardKey.Right))
|
||||
{
|
||||
player.X += 2;
|
||||
}
|
||||
else if (IsKeyDown(KeyboardKey.KEY_LEFT))
|
||||
else if (IsKeyDown(KeyboardKey.Left))
|
||||
{
|
||||
player.X -= 2;
|
||||
}
|
||||
|
|
@ -79,11 +79,11 @@ public class Camera2dDemo
|
|||
camera.Target = new Vector2(player.X + 20, player.Y + 20);
|
||||
|
||||
// Camera3D rotation controls
|
||||
if (IsKeyDown(KeyboardKey.KEY_A))
|
||||
if (IsKeyDown(KeyboardKey.A))
|
||||
{
|
||||
camera.Rotation--;
|
||||
}
|
||||
else if (IsKeyDown(KeyboardKey.KEY_S))
|
||||
else if (IsKeyDown(KeyboardKey.S))
|
||||
{
|
||||
camera.Rotation++;
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ public class Camera2dDemo
|
|||
}
|
||||
|
||||
// Camera3D reset (zoom and rotation)
|
||||
if (IsKeyPressed(KeyboardKey.KEY_R))
|
||||
if (IsKeyPressed(KeyboardKey.R))
|
||||
{
|
||||
camera.Zoom = 1.0f;
|
||||
camera.Rotation = 0.0f;
|
||||
|
|
@ -121,45 +121,45 @@ public class Camera2dDemo
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
BeginMode2D(camera);
|
||||
|
||||
DrawRectangle(-6000, 320, 13000, 8000, Color.DARKGRAY);
|
||||
DrawRectangle(-6000, 320, 13000, 8000, Color.DarkGray);
|
||||
|
||||
for (int i = 0; i < MaxBuildings; i++)
|
||||
{
|
||||
DrawRectangleRec(buildings[i], buildColors[i]);
|
||||
}
|
||||
|
||||
DrawRectangleRec(player, Color.RED);
|
||||
DrawRectangleRec(player, Color.Red);
|
||||
|
||||
DrawRectangle((int)camera.Target.X, -500, 1, (int)(screenHeight * 4), Color.GREEN);
|
||||
DrawRectangle((int)camera.Target.X, -500, 1, (int)(screenHeight * 4), Color.Green);
|
||||
DrawLine(
|
||||
(int)(-screenWidth * 10),
|
||||
(int)camera.Target.Y,
|
||||
(int)(screenWidth * 10),
|
||||
(int)camera.Target.Y,
|
||||
Color.GREEN
|
||||
Color.Green
|
||||
);
|
||||
|
||||
EndMode2D();
|
||||
|
||||
DrawText("SCREEN AREA", 640, 10, 20, Color.RED);
|
||||
DrawText("SCREEN AREA", 640, 10, 20, Color.Red);
|
||||
|
||||
DrawRectangle(0, 0, (int)screenWidth, 5, Color.RED);
|
||||
DrawRectangle(0, 5, 5, (int)screenHeight - 10, Color.RED);
|
||||
DrawRectangle((int)screenWidth - 5, 5, 5, (int)screenHeight - 10, Color.RED);
|
||||
DrawRectangle(0, (int)screenHeight - 5, (int)screenWidth, 5, Color.RED);
|
||||
DrawRectangle(0, 0, (int)screenWidth, 5, Color.Red);
|
||||
DrawRectangle(0, 5, 5, (int)screenHeight - 10, Color.Red);
|
||||
DrawRectangle((int)screenWidth - 5, 5, 5, (int)screenHeight - 10, Color.Red);
|
||||
DrawRectangle(0, (int)screenHeight - 5, (int)screenWidth, 5, Color.Red);
|
||||
|
||||
DrawRectangle(10, 10, 250, 113, ColorAlpha(Color.SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(10, 10, 250, 113, Color.BLUE);
|
||||
DrawRectangle(10, 10, 250, 113, ColorAlpha(Color.SkyBlue, 0.5f));
|
||||
DrawRectangleLines(10, 10, 250, 113, Color.Blue);
|
||||
|
||||
DrawText("Free 2d camera controls:", 20, 20, 10, Color.BLACK);
|
||||
DrawText("- Right/Left to move Offset", 40, 40, 10, Color.DARKGRAY);
|
||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, Color.DARKGRAY);
|
||||
DrawText("- A / S to Rotate", 40, 80, 10, Color.DARKGRAY);
|
||||
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, Color.DARKGRAY);
|
||||
DrawText("Free 2d camera controls:", 20, 20, 10, Color.Black);
|
||||
DrawText("- Right/Left to move Offset", 40, 40, 10, Color.DarkGray);
|
||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 60, 10, Color.DarkGray);
|
||||
DrawText("- A / S to Rotate", 40, 80, 10, Color.DarkGray);
|
||||
DrawText("- R to reset Zoom and Rotation", 40, 100, 10, Color.DarkGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -70,11 +70,11 @@ public class Camera2dPlatformer
|
|||
|
||||
EnvItem[] envItems = new EnvItem[]
|
||||
{
|
||||
new EnvItem(new Rectangle(0, 0, 1000, 400), 0, Color.LIGHTGRAY),
|
||||
new EnvItem(new Rectangle(0, 400, 1000, 200), 1, Color.GRAY),
|
||||
new EnvItem(new Rectangle(300, 200, 400, 10), 1, Color.GRAY),
|
||||
new EnvItem(new Rectangle(250, 300, 100, 10), 1, Color.GRAY),
|
||||
new EnvItem(new Rectangle(650, 300, 100, 10), 1, Color.GRAY)
|
||||
new EnvItem(new Rectangle(0, 0, 1000, 400), 0, Color.LightGray),
|
||||
new EnvItem(new Rectangle(0, 400, 1000, 200), 1, Color.Gray),
|
||||
new EnvItem(new Rectangle(300, 200, 400, 10), 1, Color.Gray),
|
||||
new EnvItem(new Rectangle(250, 300, 100, 10), 1, Color.Gray),
|
||||
new EnvItem(new Rectangle(650, 300, 100, 10), 1, Color.Gray)
|
||||
};
|
||||
|
||||
Camera2D camera = new();
|
||||
|
|
@ -127,13 +127,13 @@ public class Camera2dPlatformer
|
|||
camera.Zoom = 0.25f;
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_R))
|
||||
if (IsKeyPressed(KeyboardKey.R))
|
||||
{
|
||||
camera.Zoom = 1.0f;
|
||||
player.Position = new Vector2(400, 280);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_C))
|
||||
if (IsKeyPressed(KeyboardKey.C))
|
||||
{
|
||||
cameraOption = (cameraOption + 1) % cameraUpdatersLength;
|
||||
}
|
||||
|
|
@ -145,7 +145,7 @@ public class Camera2dPlatformer
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.LIGHTGRAY);
|
||||
ClearBackground(Color.LightGray);
|
||||
|
||||
BeginMode2D(camera);
|
||||
|
||||
|
|
@ -155,17 +155,17 @@ public class Camera2dPlatformer
|
|||
}
|
||||
|
||||
Rectangle playerRect = new(player.Position.X - 20, player.Position.Y - 40, 40, 40);
|
||||
DrawRectangleRec(playerRect, Color.RED);
|
||||
DrawRectangleRec(playerRect, Color.Red);
|
||||
|
||||
EndMode2D();
|
||||
|
||||
DrawText("Controls:", 20, 20, 10, Color.BLACK);
|
||||
DrawText("- Right/Left to move", 40, 40, 10, Color.DARKGRAY);
|
||||
DrawText("- Space to jump", 40, 60, 10, Color.DARKGRAY);
|
||||
DrawText("- Mouse Wheel to Zoom in-out, R to reset zoom", 40, 80, 10, Color.DARKGRAY);
|
||||
DrawText("- C to change camera mode", 40, 100, 10, Color.DARKGRAY);
|
||||
DrawText("Current camera mode:", 20, 120, 10, Color.BLACK);
|
||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, Color.DARKGRAY);
|
||||
DrawText("Controls:", 20, 20, 10, Color.Black);
|
||||
DrawText("- Right/Left to move", 40, 40, 10, Color.DarkGray);
|
||||
DrawText("- Space to jump", 40, 60, 10, Color.DarkGray);
|
||||
DrawText("- Mouse Wheel to Zoom in-out, R to reset zoom", 40, 80, 10, Color.DarkGray);
|
||||
DrawText("- C to change camera mode", 40, 100, 10, Color.DarkGray);
|
||||
DrawText("Current camera mode:", 20, 120, 10, Color.Black);
|
||||
DrawText(cameraDescriptions[cameraOption], 40, 140, 10, Color.DarkGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
@ -181,17 +181,17 @@ public class Camera2dPlatformer
|
|||
|
||||
static void UpdatePlayer(ref Player player, EnvItem[] envItems, float delta)
|
||||
{
|
||||
if (IsKeyDown(KeyboardKey.KEY_LEFT))
|
||||
if (IsKeyDown(KeyboardKey.Left))
|
||||
{
|
||||
player.Position.X -= PlayerHorSpeed * delta;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_RIGHT))
|
||||
if (IsKeyDown(KeyboardKey.Right))
|
||||
{
|
||||
player.Position.X += PlayerHorSpeed * delta;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_SPACE) && player.CanJump)
|
||||
if (IsKeyDown(KeyboardKey.Space) && player.CanJump)
|
||||
{
|
||||
player.Speed = -PlayerJumpSpeed;
|
||||
player.CanJump = false;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class Camera3dFirstPerson
|
|||
camera.Target = new Vector3(0.0f, 1.8f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.FovY = 60.0f;
|
||||
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
|
||||
camera.Projection = CameraProjection.Perspective;
|
||||
|
||||
// Generates some random columns
|
||||
float[] heights = new float[MaxColumns];
|
||||
|
|
@ -47,7 +47,7 @@ public class Camera3dFirstPerson
|
|||
colors[i] = new Color(GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255);
|
||||
}
|
||||
|
||||
CameraMode cameraMode = CameraMode.CAMERA_FIRST_PERSON;
|
||||
CameraMode cameraMode = CameraMode.FirstPerson;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -58,54 +58,54 @@ public class Camera3dFirstPerson
|
|||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
// Switch camera mode
|
||||
if (IsKeyPressed(KeyboardKey.KEY_ONE))
|
||||
if (IsKeyPressed(KeyboardKey.One))
|
||||
{
|
||||
cameraMode = CameraMode.CAMERA_FREE;
|
||||
cameraMode = CameraMode.Free;
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_TWO))
|
||||
if (IsKeyPressed(KeyboardKey.Two))
|
||||
{
|
||||
cameraMode = CameraMode.CAMERA_FIRST_PERSON;
|
||||
cameraMode = CameraMode.FirstPerson;
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_THREE))
|
||||
if (IsKeyPressed(KeyboardKey.Three))
|
||||
{
|
||||
cameraMode = CameraMode.CAMERA_THIRD_PERSON;
|
||||
cameraMode = CameraMode.ThirdPerson;
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KeyboardKey.KEY_FOUR))
|
||||
if (IsKeyPressed(KeyboardKey.Four))
|
||||
{
|
||||
cameraMode = CameraMode.CAMERA_ORBITAL;
|
||||
cameraMode = CameraMode.Orbital;
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
|
||||
// Switch camera projection
|
||||
if (IsKeyPressed(KeyboardKey.KEY_P))
|
||||
if (IsKeyPressed(KeyboardKey.P))
|
||||
{
|
||||
if (camera.Projection == CameraProjection.CAMERA_PERSPECTIVE)
|
||||
if (camera.Projection == CameraProjection.Perspective)
|
||||
{
|
||||
// Create isometric view
|
||||
cameraMode = CameraMode.CAMERA_THIRD_PERSON;
|
||||
cameraMode = CameraMode.ThirdPerson;
|
||||
// Note: The target distance is related to the render distance in the orthographic projection
|
||||
camera.Position = new Vector3(0.0f, 2.0f, -100.0f);
|
||||
camera.Target = new Vector3(0.0f, 2.0f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.Projection = CameraProjection.CAMERA_ORTHOGRAPHIC;
|
||||
camera.Projection = CameraProjection.Orthographic;
|
||||
camera.FovY = 20.0f; // near plane width in CAMERA_ORTHOGRAPHIC
|
||||
// CameraYaw(&camera, -135 * DEG2RAD, true);
|
||||
// CameraPitch(&camera, -45 * DEG2RAD, true, true, false);
|
||||
}
|
||||
else if (camera.Projection == CameraProjection.CAMERA_ORTHOGRAPHIC)
|
||||
else if (camera.Projection == CameraProjection.Orthographic)
|
||||
{
|
||||
// Reset to default view
|
||||
cameraMode = CameraMode.CAMERA_THIRD_PERSON;
|
||||
cameraMode = CameraMode.ThirdPerson;
|
||||
camera.Position = new Vector3(0.0f, 2.0f, 10.0f);
|
||||
camera.Target = new Vector3(0.0f, 2.0f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
|
||||
camera.Projection = CameraProjection.Perspective;
|
||||
camera.FovY = 60.0f;
|
||||
}
|
||||
}
|
||||
|
|
@ -113,64 +113,64 @@ public class Camera3dFirstPerson
|
|||
// Update camera computes movement internally depending on the camera mode
|
||||
// Some default standard keyboard/mouse inputs are hardcoded to simplify use
|
||||
// For advance camera controls, it's reecommended to compute camera movement manually
|
||||
UpdateCamera(ref camera, CameraMode.CAMERA_CUSTOM);
|
||||
UpdateCamera(ref camera, CameraMode.Custom);
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
// Draw ground
|
||||
DrawPlane(new Vector3(0.0f, 0.0f, 0.0f), new Vector2(32.0f, 32.0f), Color.LIGHTGRAY);
|
||||
DrawPlane(new Vector3(0.0f, 0.0f, 0.0f), new Vector2(32.0f, 32.0f), Color.LightGray);
|
||||
|
||||
// Draw a blue wall
|
||||
DrawCube(new Vector3(-16.0f, 2.5f, 0.0f), 1.0f, 5.0f, 32.0f, Color.BLUE);
|
||||
DrawCube(new Vector3(-16.0f, 2.5f, 0.0f), 1.0f, 5.0f, 32.0f, Color.Blue);
|
||||
|
||||
// Draw a green wall
|
||||
DrawCube(new Vector3(16.0f, 2.5f, 0.0f), 1.0f, 5.0f, 32.0f, Color.LIME);
|
||||
DrawCube(new Vector3(16.0f, 2.5f, 0.0f), 1.0f, 5.0f, 32.0f, Color.Lime);
|
||||
|
||||
// Draw a yellow wall
|
||||
DrawCube(new Vector3(0.0f, 2.5f, 16.0f), 32.0f, 5.0f, 1.0f, Color.GOLD);
|
||||
DrawCube(new Vector3(0.0f, 2.5f, 16.0f), 32.0f, 5.0f, 1.0f, Color.Gold);
|
||||
|
||||
// Draw some cubes around
|
||||
for (int i = 0; i < MaxColumns; i++)
|
||||
{
|
||||
DrawCube(positions[i], 2.0f, heights[i], 2.0f, colors[i]);
|
||||
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, Color.MAROON);
|
||||
DrawCubeWires(positions[i], 2.0f, heights[i], 2.0f, Color.Maroon);
|
||||
}
|
||||
|
||||
// Draw player cube
|
||||
if (cameraMode == CameraMode.CAMERA_THIRD_PERSON)
|
||||
if (cameraMode == CameraMode.ThirdPerson)
|
||||
{
|
||||
DrawCube(camera.Target, 0.5f, 0.5f, 0.5f, Color.PURPLE);
|
||||
DrawCubeWires(camera.Target, 0.5f, 0.5f, 0.5f, Color.DARKPURPLE);
|
||||
DrawCube(camera.Target, 0.5f, 0.5f, 0.5f, Color.Purple);
|
||||
DrawCubeWires(camera.Target, 0.5f, 0.5f, 0.5f, Color.DarkPurple);
|
||||
}
|
||||
|
||||
EndMode3D();
|
||||
|
||||
// Draw info boxes
|
||||
DrawRectangle(5, 5, 330, 100, ColorAlpha(Color.SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(10, 10, 330, 100, Color.BLUE);
|
||||
DrawRectangle(5, 5, 330, 100, ColorAlpha(Color.SkyBlue, 0.5f));
|
||||
DrawRectangleLines(10, 10, 330, 100, Color.Blue);
|
||||
|
||||
DrawText("Camera controls:", 15, 15, 10, Color.BLACK);
|
||||
DrawText("- Move keys: W, A, S, D, Space, Left-Ctrl", 15, 30, 10, Color.BLACK);
|
||||
DrawText("- Look around: arrow keys or mouse", 15, 45, 10, Color.BLACK);
|
||||
DrawText("- Camera mode keys: 1, 2, 3, 4", 15, 60, 10, Color.BLACK);
|
||||
DrawText("- Zoom keys: num-plus, num-minus or mouse scroll", 15, 75, 10, Color.BLACK);
|
||||
DrawText("- Camera projection key: P", 15, 90, 10, Color.BLACK);
|
||||
DrawText("Camera controls:", 15, 15, 10, Color.Black);
|
||||
DrawText("- Move keys: W, A, S, D, Space, Left-Ctrl", 15, 30, 10, Color.Black);
|
||||
DrawText("- Look around: arrow keys or mouse", 15, 45, 10, Color.Black);
|
||||
DrawText("- Camera mode keys: 1, 2, 3, 4", 15, 60, 10, Color.Black);
|
||||
DrawText("- Zoom keys: num-plus, num-minus or mouse scroll", 15, 75, 10, Color.Black);
|
||||
DrawText("- Camera projection key: P", 15, 90, 10, Color.Black);
|
||||
|
||||
DrawRectangle(600, 5, 195, 100, Fade(Color.SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(600, 5, 195, 100, Color.BLUE);
|
||||
DrawRectangle(600, 5, 195, 100, Fade(Color.SkyBlue, 0.5f));
|
||||
DrawRectangleLines(600, 5, 195, 100, Color.Blue);
|
||||
|
||||
DrawText("Camera status:", 610, 15, 10, Color.BLACK);
|
||||
DrawText($"- Mode: {cameraMode}", 610, 30, 10, Color.BLACK);
|
||||
DrawText($"- Projection: {camera.Projection}", 610, 45, 10, Color.BLACK);
|
||||
DrawText($"- Position: {camera.Position}", 610, 60, 10, Color.BLACK);
|
||||
DrawText($"- Target: {camera.Target}", 610, 75, 10, Color.BLACK);
|
||||
DrawText($"- Up: {camera.Up}", 610, 90, 10, Color.BLACK);
|
||||
DrawText("Camera status:", 610, 15, 10, Color.Black);
|
||||
DrawText($"- Mode: {cameraMode}", 610, 30, 10, Color.Black);
|
||||
DrawText($"- Projection: {camera.Projection}", 610, 45, 10, Color.Black);
|
||||
DrawText($"- Position: {camera.Position}", 610, 60, 10, Color.Black);
|
||||
DrawText($"- Target: {camera.Target}", 610, 75, 10, Color.Black);
|
||||
DrawText($"- Up: {camera.Up}", 610, 90, 10, Color.Black);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class Camera3dFree
|
|||
camera.Target = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.FovY = 45.0f;
|
||||
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
|
||||
camera.Projection = CameraProjection.Perspective;
|
||||
|
||||
Vector3 cubePosition = new(0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
|
@ -43,9 +43,9 @@ public class Camera3dFree
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(ref camera, CameraMode.CAMERA_FREE);
|
||||
UpdateCamera(ref camera, CameraMode.Free);
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_Z))
|
||||
if (IsKeyDown(KeyboardKey.Z))
|
||||
{
|
||||
camera.Target = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
|
@ -54,26 +54,26 @@ public class Camera3dFree
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, Color.RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, Color.MAROON);
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, Color.Red);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, Color.Maroon);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawRectangle(10, 10, 320, 133, ColorAlpha(Color.SKYBLUE, 0.5f));
|
||||
DrawRectangleLines(10, 10, 320, 133, Color.BLUE);
|
||||
DrawRectangle(10, 10, 320, 133, ColorAlpha(Color.SkyBlue, 0.5f));
|
||||
DrawRectangleLines(10, 10, 320, 133, Color.Blue);
|
||||
|
||||
DrawText("Free camera default controls:", 20, 20, 10, Color.BLACK);
|
||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, Color.DARKGRAY);
|
||||
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, Color.DARKGRAY);
|
||||
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, Color.DARKGRAY);
|
||||
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, Color.DARKGRAY);
|
||||
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, Color.DARKGRAY);
|
||||
DrawText("Free camera default controls:", 20, 20, 10, Color.Black);
|
||||
DrawText("- Mouse Wheel to Zoom in-out", 40, 40, 10, Color.DarkGray);
|
||||
DrawText("- Mouse Wheel Pressed to Pan", 40, 60, 10, Color.DarkGray);
|
||||
DrawText("- Alt + Mouse Wheel Pressed to Rotate", 40, 80, 10, Color.DarkGray);
|
||||
DrawText("- Alt + Ctrl + Mouse Wheel Pressed for Smooth Zoom", 40, 100, 10, Color.DarkGray);
|
||||
DrawText("- Z to zoom to (0, 0, 0)", 40, 120, 10, Color.DarkGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class Camera3dMode
|
|||
camera.Target = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.FovY = 45.0f;
|
||||
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
|
||||
camera.Projection = CameraProjection.Perspective;
|
||||
|
||||
Vector3 cubePosition = new(0.0f, 0.0f, 0.0f);
|
||||
|
||||
|
|
@ -49,18 +49,18 @@ public class Camera3dMode
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, Color.RED);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, Color.MAROON);
|
||||
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, Color.Red);
|
||||
DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, Color.Maroon);
|
||||
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Welcome to the third dimension!", 10, 40, 20, Color.DARKGRAY);
|
||||
DrawText("Welcome to the third dimension!", 10, 40, 20, Color.DarkGray);
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ public unsafe class CustomLogging
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Check out the console output to see the custom logger in action!", 60, 200, 20, Color.LIGHTGRAY);
|
||||
DrawText("Check out the console output to see the custom logger in action!", 60, 200, 20, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -45,30 +45,30 @@ public class DropFiles
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
if (files.Length == 0)
|
||||
{
|
||||
DrawText("Drop your files to this window!", 100, 40, 20, Color.DARKGRAY);
|
||||
DrawText("Drop your files to this window!", 100, 40, 20, Color.DarkGray);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("Dropped files:", 100, 40, 20, Color.DARKGRAY);
|
||||
DrawText("Dropped files:", 100, 40, 20, Color.DarkGray);
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, ColorAlpha(Color.LIGHTGRAY, 0.5f));
|
||||
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, ColorAlpha(Color.LightGray, 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, ColorAlpha(Color.LIGHTGRAY, 0.3f));
|
||||
DrawRectangle(0, 85 + 40 * i, screenWidth, 40, ColorAlpha(Color.LightGray, 0.3f));
|
||||
}
|
||||
DrawText(files[i], 120, 100 + 40 * i, 10, Color.GRAY);
|
||||
DrawText(files[i], 120, 100 + 40 * i, 10, Color.Gray);
|
||||
}
|
||||
|
||||
DrawText("Drop new files...", 100, 110 + 40 * files.Length, 20, Color.DARKGRAY);
|
||||
DrawText("Drop new files...", 100, 110 + 40 * files.Length, 20, Color.DarkGray);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class InputGamepad
|
|||
const int screenHeight = 450;
|
||||
|
||||
// Set MSAA 4X hint before windows creation
|
||||
SetConfigFlags(ConfigFlags.FLAG_MSAA_4X_HINT);
|
||||
SetConfigFlags(ConfigFlags.Msaa4xHint);
|
||||
InitWindow(screenWidth, screenHeight, "raylib [core] example - gamepad input");
|
||||
|
||||
Texture2D texPs3Pad = LoadTexture("resources/ps3.png");
|
||||
|
|
@ -58,232 +58,232 @@ public class InputGamepad
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
if (IsGamepadAvailable(0))
|
||||
{
|
||||
string gamepadName = GetGamepadName_(0);
|
||||
DrawText($"GP1: {gamepadName}", 10, 10, 10, Color.BLACK);
|
||||
DrawText($"GP1: {gamepadName}", 10, 10, 10, Color.Black);
|
||||
|
||||
if (gamepadName == XBOX360_LEGACY_NAME_ID ||
|
||||
gamepadName == XBOX360_NAME_ID ||
|
||||
gamepadName == XBOX360_NAME_ID_RPI)
|
||||
{
|
||||
DrawTexture(texXboxPad, 0, 0, Color.DARKGRAY);
|
||||
DrawTexture(texXboxPad, 0, 0, Color.DarkGray);
|
||||
|
||||
// Draw buttons: xbox home
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.Middle))
|
||||
{
|
||||
DrawCircle(394, 89, 19, Color.RED);
|
||||
DrawCircle(394, 89, 19, Color.Red);
|
||||
}
|
||||
|
||||
// Draw buttons: basic
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.MiddleRight))
|
||||
{
|
||||
DrawCircle(436, 150, 9, Color.RED);
|
||||
DrawCircle(436, 150, 9, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.MiddleLeft))
|
||||
{
|
||||
DrawCircle(352, 150, 9, Color.RED);
|
||||
DrawCircle(352, 150, 9, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceLeft))
|
||||
{
|
||||
DrawCircle(501, 151, 15, Color.BLUE);
|
||||
DrawCircle(501, 151, 15, Color.Blue);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_DOWN))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceDown))
|
||||
{
|
||||
DrawCircle(536, 187, 15, Color.LIME);
|
||||
DrawCircle(536, 187, 15, Color.Lime);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceRight))
|
||||
{
|
||||
DrawCircle(572, 151, 15, Color.MAROON);
|
||||
DrawCircle(572, 151, 15, Color.Maroon);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_UP))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceUp))
|
||||
{
|
||||
DrawCircle(536, 115, 15, Color.GOLD);
|
||||
DrawCircle(536, 115, 15, Color.Gold);
|
||||
}
|
||||
|
||||
// Draw buttons: d-pad
|
||||
DrawRectangle(317, 202, 19, 71, Color.BLACK);
|
||||
DrawRectangle(293, 228, 69, 19, Color.BLACK);
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_UP))
|
||||
DrawRectangle(317, 202, 19, 71, Color.Black);
|
||||
DrawRectangle(293, 228, 69, 19, Color.Black);
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceUp))
|
||||
{
|
||||
DrawRectangle(317, 202, 19, 26, Color.RED);
|
||||
DrawRectangle(317, 202, 19, 26, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_DOWN))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceDown))
|
||||
{
|
||||
DrawRectangle(317, 202 + 45, 19, 26, Color.RED);
|
||||
DrawRectangle(317, 202 + 45, 19, 26, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceLeft))
|
||||
{
|
||||
DrawRectangle(292, 228, 25, 19, Color.RED);
|
||||
DrawRectangle(292, 228, 25, 19, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceRight))
|
||||
{
|
||||
DrawRectangle(292 + 44, 228, 26, 19, Color.RED);
|
||||
DrawRectangle(292 + 44, 228, 26, 19, Color.Red);
|
||||
}
|
||||
|
||||
// Draw buttons: left-right back
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_TRIGGER_1))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftTrigger1))
|
||||
{
|
||||
DrawCircle(259, 61, 20, Color.RED);
|
||||
DrawCircle(259, 61, 20, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_TRIGGER_1))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightTrigger1))
|
||||
{
|
||||
DrawCircle(536, 61, 20, Color.RED);
|
||||
DrawCircle(536, 61, 20, Color.Red);
|
||||
}
|
||||
|
||||
// Draw axis: left joystick
|
||||
DrawCircle(259, 152, 39, Color.BLACK);
|
||||
DrawCircle(259, 152, 34, Color.LIGHTGRAY);
|
||||
DrawCircle(259, 152, 39, Color.Black);
|
||||
DrawCircle(259, 152, 34, Color.LightGray);
|
||||
DrawCircle(
|
||||
259 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_X) * 20),
|
||||
152 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_Y) * 20),
|
||||
259 + (int)(GetGamepadAxisMovement(0, GamepadAxis.LeftX) * 20),
|
||||
152 + (int)(GetGamepadAxisMovement(0, GamepadAxis.LeftY) * 20),
|
||||
25,
|
||||
Color.BLACK
|
||||
Color.Black
|
||||
);
|
||||
|
||||
// Draw axis: right joystick
|
||||
DrawCircle(461, 237, 38, Color.BLACK);
|
||||
DrawCircle(461, 237, 33, Color.LIGHTGRAY);
|
||||
DrawCircle(461, 237, 38, Color.Black);
|
||||
DrawCircle(461, 237, 33, Color.LightGray);
|
||||
DrawCircle(
|
||||
461 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_X) * 20),
|
||||
237 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_Y) * 20),
|
||||
25, Color.BLACK
|
||||
461 + (int)(GetGamepadAxisMovement(0, GamepadAxis.RightX) * 20),
|
||||
237 + (int)(GetGamepadAxisMovement(0, GamepadAxis.RightY) * 20),
|
||||
25, Color.Black
|
||||
);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
float leftTriggerX = GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_TRIGGER);
|
||||
float rightTriggerX = GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_TRIGGER);
|
||||
DrawRectangle(170, 30, 15, 70, Color.GRAY);
|
||||
DrawRectangle(604, 30, 15, 70, Color.GRAY);
|
||||
DrawRectangle(170, 30, 15, (int)(((1.0f + leftTriggerX) / 2.0f) * 70), Color.RED);
|
||||
DrawRectangle(604, 30, 15, (int)(((1.0f + rightTriggerX) / 2.0f) * 70), Color.RED);
|
||||
float leftTriggerX = GetGamepadAxisMovement(0, GamepadAxis.LeftTrigger);
|
||||
float rightTriggerX = GetGamepadAxisMovement(0, GamepadAxis.RightTrigger);
|
||||
DrawRectangle(170, 30, 15, 70, Color.Gray);
|
||||
DrawRectangle(604, 30, 15, 70, Color.Gray);
|
||||
DrawRectangle(170, 30, 15, (int)(((1.0f + leftTriggerX) / 2.0f) * 70), Color.Red);
|
||||
DrawRectangle(604, 30, 15, (int)(((1.0f + rightTriggerX) / 2.0f) * 70), Color.Red);
|
||||
}
|
||||
else if (gamepadName == PS3_NAME_ID)
|
||||
{
|
||||
DrawTexture(texPs3Pad, 0, 0, Color.DARKGRAY);
|
||||
DrawTexture(texPs3Pad, 0, 0, Color.DarkGray);
|
||||
|
||||
// Draw buttons: ps
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.Middle))
|
||||
{
|
||||
DrawCircle(396, 222, 13, Color.RED);
|
||||
DrawCircle(396, 222, 13, Color.Red);
|
||||
}
|
||||
|
||||
// Draw buttons: basic
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.MiddleLeft))
|
||||
{
|
||||
DrawRectangle(328, 170, 32, 13, Color.RED);
|
||||
DrawRectangle(328, 170, 32, 13, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_MIDDLE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.MiddleRight))
|
||||
{
|
||||
DrawTriangle(
|
||||
new Vector2(436, 168),
|
||||
new Vector2(436, 185),
|
||||
new Vector2(464, 177),
|
||||
Color.RED
|
||||
Color.Red
|
||||
);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_UP))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceUp))
|
||||
{
|
||||
DrawCircle(557, 144, 13, Color.LIME);
|
||||
DrawCircle(557, 144, 13, Color.Lime);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceRight))
|
||||
{
|
||||
DrawCircle(586, 173, 13, Color.RED);
|
||||
DrawCircle(586, 173, 13, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_DOWN))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceDown))
|
||||
{
|
||||
DrawCircle(557, 203, 13, Color.VIOLET);
|
||||
DrawCircle(557, 203, 13, Color.Violet);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_FACE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightFaceLeft))
|
||||
{
|
||||
DrawCircle(527, 173, 13, Color.PINK);
|
||||
DrawCircle(527, 173, 13, Color.Pink);
|
||||
}
|
||||
|
||||
// Draw buttons: d-pad
|
||||
DrawRectangle(225, 132, 24, 84, Color.BLACK);
|
||||
DrawRectangle(195, 161, 84, 25, Color.BLACK);
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_UP))
|
||||
DrawRectangle(225, 132, 24, 84, Color.Black);
|
||||
DrawRectangle(195, 161, 84, 25, Color.Black);
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceUp))
|
||||
{
|
||||
DrawRectangle(225, 132, 24, 29, Color.RED);
|
||||
DrawRectangle(225, 132, 24, 29, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_DOWN))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceDown))
|
||||
{
|
||||
DrawRectangle(225, 132 + 54, 24, 30, Color.RED);
|
||||
DrawRectangle(225, 132 + 54, 24, 30, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_LEFT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceLeft))
|
||||
{
|
||||
DrawRectangle(195, 161, 30, 25, Color.RED);
|
||||
DrawRectangle(195, 161, 30, 25, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_FACE_RIGHT))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftFaceRight))
|
||||
{
|
||||
DrawRectangle(195 + 54, 161, 30, 25, Color.RED);
|
||||
DrawRectangle(195 + 54, 161, 30, 25, Color.Red);
|
||||
}
|
||||
|
||||
// Draw buttons: left-right back buttons
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_LEFT_TRIGGER_1))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.LeftTrigger1))
|
||||
{
|
||||
DrawCircle(239, 82, 20, Color.RED);
|
||||
DrawCircle(239, 82, 20, Color.Red);
|
||||
}
|
||||
|
||||
if (IsGamepadButtonDown(0, GamepadButton.GAMEPAD_BUTTON_RIGHT_TRIGGER_1))
|
||||
if (IsGamepadButtonDown(0, GamepadButton.RightTrigger1))
|
||||
{
|
||||
DrawCircle(557, 82, 20, Color.RED);
|
||||
DrawCircle(557, 82, 20, Color.Red);
|
||||
}
|
||||
|
||||
// Draw axis: left joystick
|
||||
DrawCircle(319, 255, 35, Color.BLACK);
|
||||
DrawCircle(319, 255, 31, Color.LIGHTGRAY);
|
||||
DrawCircle(319, 255, 35, Color.Black);
|
||||
DrawCircle(319, 255, 31, Color.LightGray);
|
||||
DrawCircle(
|
||||
319 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_X) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_Y) * 20),
|
||||
319 + (int)(GetGamepadAxisMovement(0, GamepadAxis.LeftX) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(0, GamepadAxis.LeftY) * 20),
|
||||
25,
|
||||
Color.BLACK
|
||||
Color.Black
|
||||
);
|
||||
|
||||
// Draw axis: right joystick
|
||||
DrawCircle(475, 255, 35, Color.BLACK);
|
||||
DrawCircle(475, 255, 31, Color.LIGHTGRAY);
|
||||
DrawCircle(475, 255, 35, Color.Black);
|
||||
DrawCircle(475, 255, 31, Color.LightGray);
|
||||
DrawCircle(
|
||||
475 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_X) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_Y) * 20),
|
||||
475 + (int)(GetGamepadAxisMovement(0, GamepadAxis.RightX) * 20),
|
||||
255 + (int)(GetGamepadAxisMovement(0, GamepadAxis.RightY) * 20),
|
||||
25,
|
||||
Color.BLACK
|
||||
Color.Black
|
||||
);
|
||||
|
||||
// Draw axis: left-right triggers
|
||||
float leftTriggerX = GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_LEFT_TRIGGER);
|
||||
float rightTriggerX = GetGamepadAxisMovement(0, GamepadAxis.GAMEPAD_AXIS_RIGHT_TRIGGER);
|
||||
DrawRectangle(169, 48, 15, 70, Color.GRAY);
|
||||
DrawRectangle(611, 48, 15, 70, Color.GRAY);
|
||||
DrawRectangle(169, 48, 15, (int)(((1.0f - leftTriggerX) / 2.0f) * 70), Color.RED);
|
||||
DrawRectangle(611, 48, 15, (int)(((1.0f - rightTriggerX) / 2.0f) * 70), Color.RED);
|
||||
float leftTriggerX = GetGamepadAxisMovement(0, GamepadAxis.LeftTrigger);
|
||||
float rightTriggerX = GetGamepadAxisMovement(0, GamepadAxis.RightTrigger);
|
||||
DrawRectangle(169, 48, 15, 70, Color.Gray);
|
||||
DrawRectangle(611, 48, 15, 70, Color.Gray);
|
||||
DrawRectangle(169, 48, 15, (int)(((1.0f - leftTriggerX) / 2.0f) * 70), Color.Red);
|
||||
DrawRectangle(611, 48, 15, (int)(((1.0f - rightTriggerX) / 2.0f) * 70), Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, Color.GRAY);
|
||||
DrawText("- GENERIC GAMEPAD -", 280, 180, 20, Color.Gray);
|
||||
// TODO: Draw generic gamepad
|
||||
}
|
||||
|
||||
DrawText($"DETECTED AXIS [{GetGamepadAxisCount(0)}]:", 10, 50, 10, Color.MAROON);
|
||||
DrawText($"DETECTED AXIS [{GetGamepadAxisCount(0)}]:", 10, 50, 10, Color.Maroon);
|
||||
|
||||
for (int i = 0; i < GetGamepadAxisCount(0); i++)
|
||||
{
|
||||
|
|
@ -292,23 +292,23 @@ public class InputGamepad
|
|||
20,
|
||||
70 + 20 * i,
|
||||
10,
|
||||
Color.DARKGRAY
|
||||
Color.DarkGray
|
||||
);
|
||||
}
|
||||
|
||||
if (GetGamepadButtonPressed() != (int)GamepadButton.GAMEPAD_BUTTON_UNKNOWN)
|
||||
if (GetGamepadButtonPressed() != (int)GamepadButton.Unknown)
|
||||
{
|
||||
DrawText($"DETECTED BUTTON: {GetGamepadButtonPressed()}", 10, 430, 10, Color.RED);
|
||||
DrawText($"DETECTED BUTTON: {GetGamepadButtonPressed()}", 10, 430, 10, Color.Red);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("DETECTED BUTTON: NONE", 10, 430, 10, Color.GRAY);
|
||||
DrawText("DETECTED BUTTON: NONE", 10, 430, 10, Color.Gray);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText("GP1: NOT DETECTED", 10, 10, 10, Color.GRAY);
|
||||
DrawTexture(texXboxPad, 0, 0, Color.LIGHTGRAY);
|
||||
DrawText("GP1: NOT DETECTED", 10, 10, 10, Color.Gray);
|
||||
DrawTexture(texXboxPad, 0, 0, Color.LightGray);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ public class InputGestures
|
|||
int gesturesCount = 0;
|
||||
string[] gestureStrings = new string[MaxGestureStrings];
|
||||
|
||||
Gesture currentGesture = Gesture.GESTURE_NONE;
|
||||
Gesture lastGesture = Gesture.GESTURE_NONE;
|
||||
Gesture currentGesture = Gesture.None;
|
||||
Gesture lastGesture = Gesture.None;
|
||||
|
||||
// SetGesturesEnabled(0b0000000000001001); // Enable only some gestures to be detected
|
||||
|
||||
|
|
@ -50,41 +50,41 @@ public class InputGestures
|
|||
currentGesture = GetGestureDetected();
|
||||
touchPosition = GetTouchPosition(0);
|
||||
|
||||
if (CheckCollisionPointRec(touchPosition, touchArea) && (currentGesture != Gesture.GESTURE_NONE))
|
||||
if (CheckCollisionPointRec(touchPosition, touchArea) && (currentGesture != Gesture.None))
|
||||
{
|
||||
if (currentGesture != lastGesture)
|
||||
{
|
||||
// Store gesture string
|
||||
switch ((Gesture)currentGesture)
|
||||
{
|
||||
case Gesture.GESTURE_TAP:
|
||||
case Gesture.Tap:
|
||||
gestureStrings[gesturesCount] = "GESTURE TAP";
|
||||
break;
|
||||
case Gesture.GESTURE_DOUBLETAP:
|
||||
case Gesture.DoubleTap:
|
||||
gestureStrings[gesturesCount] = "GESTURE DOUBLETAP";
|
||||
break;
|
||||
case Gesture.GESTURE_HOLD:
|
||||
case Gesture.Hold:
|
||||
gestureStrings[gesturesCount] = "GESTURE HOLD";
|
||||
break;
|
||||
case Gesture.GESTURE_DRAG:
|
||||
case Gesture.Drag:
|
||||
gestureStrings[gesturesCount] = "GESTURE DRAG";
|
||||
break;
|
||||
case Gesture.GESTURE_SWIPE_RIGHT:
|
||||
case Gesture.SwipeRight:
|
||||
gestureStrings[gesturesCount] = "GESTURE SWIPE RIGHT";
|
||||
break;
|
||||
case Gesture.GESTURE_SWIPE_LEFT:
|
||||
case Gesture.SwipeLeft:
|
||||
gestureStrings[gesturesCount] = "GESTURE SWIPE LEFT";
|
||||
break;
|
||||
case Gesture.GESTURE_SWIPE_UP:
|
||||
case Gesture.SwipeUp:
|
||||
gestureStrings[gesturesCount] = "GESTURE SWIPE UP";
|
||||
break;
|
||||
case Gesture.GESTURE_SWIPE_DOWN:
|
||||
case Gesture.SwipeDown:
|
||||
gestureStrings[gesturesCount] = "GESTURE SWIPE DOWN";
|
||||
break;
|
||||
case Gesture.GESTURE_PINCH_IN:
|
||||
case Gesture.PinchIn:
|
||||
gestureStrings[gesturesCount] = "GESTURE PINCH IN";
|
||||
break;
|
||||
case Gesture.GESTURE_PINCH_OUT:
|
||||
case Gesture.PinchOut:
|
||||
gestureStrings[gesturesCount] = "GESTURE PINCH OUT";
|
||||
break;
|
||||
default:
|
||||
|
|
@ -109,40 +109,40 @@ public class InputGestures
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawRectangleRec(touchArea, Color.GRAY);
|
||||
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, Color.RAYWHITE);
|
||||
DrawRectangleRec(touchArea, Color.Gray);
|
||||
DrawRectangle(225, 15, screenWidth - 240, screenHeight - 30, Color.RayWhite);
|
||||
|
||||
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, ColorAlpha(Color.GRAY, 0.5f));
|
||||
DrawText("GESTURES TEST AREA", screenWidth - 270, screenHeight - 40, 20, ColorAlpha(Color.Gray, 0.5f));
|
||||
|
||||
for (int i = 0; i < gesturesCount; i++)
|
||||
{
|
||||
if (i % 2 == 0)
|
||||
{
|
||||
DrawRectangle(10, 30 + 20 * i, 200, 20, ColorAlpha(Color.LIGHTGRAY, 0.5f));
|
||||
DrawRectangle(10, 30 + 20 * i, 200, 20, ColorAlpha(Color.LightGray, 0.5f));
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawRectangle(10, 30 + 20 * i, 200, 20, ColorAlpha(Color.LIGHTGRAY, 0.3f));
|
||||
DrawRectangle(10, 30 + 20 * i, 200, 20, ColorAlpha(Color.LightGray, 0.3f));
|
||||
}
|
||||
|
||||
if (i < gesturesCount - 1)
|
||||
{
|
||||
DrawText(gestureStrings[i], 35, 36 + 20 * i, 10, Color.DARKGRAY);
|
||||
DrawText(gestureStrings[i], 35, 36 + 20 * i, 10, Color.DarkGray);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawText(gestureStrings[i], 35, 36 + 20 * i, 10, Color.MAROON);
|
||||
DrawText(gestureStrings[i], 35, 36 + 20 * i, 10, Color.Maroon);
|
||||
}
|
||||
}
|
||||
|
||||
DrawRectangleLines(10, 29, 200, screenHeight - 50, Color.GRAY);
|
||||
DrawText("DETECTED GESTURES", 50, 15, 10, Color.GRAY);
|
||||
DrawRectangleLines(10, 29, 200, screenHeight - 50, Color.Gray);
|
||||
DrawText("DETECTED GESTURES", 50, 15, 10, Color.Gray);
|
||||
|
||||
if (currentGesture != Gesture.GESTURE_NONE)
|
||||
if (currentGesture != Gesture.None)
|
||||
{
|
||||
DrawCircleV(touchPosition, 30, Color.MAROON);
|
||||
DrawCircleV(touchPosition, 30, Color.Maroon);
|
||||
}
|
||||
|
||||
EndDrawing();
|
||||
|
|
|
|||
|
|
@ -35,22 +35,22 @@ public class InputKeys
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyDown(KeyboardKey.KEY_RIGHT))
|
||||
if (IsKeyDown(KeyboardKey.Right))
|
||||
{
|
||||
ballPosition.X += 2.0f;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_LEFT))
|
||||
if (IsKeyDown(KeyboardKey.Left))
|
||||
{
|
||||
ballPosition.X -= 2.0f;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_UP))
|
||||
if (IsKeyDown(KeyboardKey.Up))
|
||||
{
|
||||
ballPosition.Y -= 2.0f;
|
||||
}
|
||||
|
||||
if (IsKeyDown(KeyboardKey.KEY_DOWN))
|
||||
if (IsKeyDown(KeyboardKey.Down))
|
||||
{
|
||||
ballPosition.Y += 2.0f;
|
||||
}
|
||||
|
|
@ -59,11 +59,11 @@ public class InputKeys
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("move the ball with arrow keys", 10, 10, 20, Color.DARKGRAY);
|
||||
DrawText("move the ball with arrow keys", 10, 10, 20, Color.DarkGray);
|
||||
|
||||
DrawCircleV(ballPosition, 50, Color.MAROON);
|
||||
DrawCircleV(ballPosition, 50, Color.Maroon);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class InputMouse
|
|||
InitWindow(screenWidth, screenHeight, "raylib [core] example - mouse input");
|
||||
|
||||
Vector2 ballPosition = new(-100.0f, -100.0f);
|
||||
Color ballColor = Color.DARKBLUE;
|
||||
Color ballColor = Color.DarkBlue;
|
||||
|
||||
SetTargetFPS(60);
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
|
@ -38,28 +38,28 @@ public class InputMouse
|
|||
//----------------------------------------------------------------------------------
|
||||
ballPosition = GetMousePosition();
|
||||
|
||||
if (IsMouseButtonPressed(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MouseButton.Left))
|
||||
{
|
||||
ballColor = Color.MAROON;
|
||||
ballColor = Color.Maroon;
|
||||
}
|
||||
else if (IsMouseButtonPressed(MouseButton.MOUSE_MIDDLE_BUTTON))
|
||||
else if (IsMouseButtonPressed(MouseButton.Middle))
|
||||
{
|
||||
ballColor = Color.LIME;
|
||||
ballColor = Color.Lime;
|
||||
}
|
||||
else if (IsMouseButtonPressed(MouseButton.MOUSE_RIGHT_BUTTON))
|
||||
else if (IsMouseButtonPressed(MouseButton.Right))
|
||||
{
|
||||
ballColor = Color.DARKBLUE;
|
||||
ballColor = Color.DarkBlue;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawCircleV(ballPosition, 40, ballColor);
|
||||
|
||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, Color.DARKGRAY);
|
||||
DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, Color.DarkGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -43,12 +43,12 @@ public class InputMouseWheel
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawRectangle(screenWidth / 2 - 40, boxPositionY, 80, 80, Color.MAROON);
|
||||
DrawRectangle(screenWidth / 2 - 40, boxPositionY, 80, 80, Color.Maroon);
|
||||
|
||||
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, Color.GRAY);
|
||||
DrawText($"Box position Y: {boxPositionY}", 10, 40, 20, Color.LIGHTGRAY);
|
||||
DrawText("Use mouse wheel to move the cube up and down!", 10, 10, 20, Color.Gray);
|
||||
DrawText($"Box position Y: {boxPositionY}", 10, 40, 20, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public class InputMultitouch
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
for (int i = 0; i < tCount; i++)
|
||||
{
|
||||
|
|
@ -65,17 +65,17 @@ public class InputMultitouch
|
|||
if ((touchPositions[i].X > 0) && (touchPositions[i].Y > 0))
|
||||
{
|
||||
// Draw circle and touch index number
|
||||
DrawCircleV(touchPositions[i], 34, Color.ORANGE);
|
||||
DrawCircleV(touchPositions[i], 34, Color.Orange);
|
||||
DrawText(i.ToString(),
|
||||
(int)touchPositions[i].X - 10,
|
||||
(int)touchPositions[i].Y - 70,
|
||||
40,
|
||||
Color.BLACK
|
||||
Color.Black
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 10, 20, Color.DARKGRAY);
|
||||
DrawText("touch the screen at multiple locations to get multiple balls", 10, 10, 20, Color.DarkGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class Picking3d
|
|||
camera.Target = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
|
||||
camera.FovY = 45.0f;
|
||||
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
|
||||
camera.Projection = CameraProjection.Perspective;
|
||||
|
||||
Vector3 cubePosition = new(0.0f, 1.0f, 0.0f);
|
||||
Vector3 cubeSize = new(2.0f, 2.0f, 2.0f);
|
||||
|
|
@ -48,9 +48,9 @@ public class Picking3d
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
UpdateCamera(ref camera, CameraMode.CAMERA_FREE);
|
||||
UpdateCamera(ref camera, CameraMode.Free);
|
||||
|
||||
if (IsMouseButtonPressed(MouseButton.MOUSE_LEFT_BUTTON))
|
||||
if (IsMouseButtonPressed(MouseButton.Left))
|
||||
{
|
||||
if (!collision.Hit)
|
||||
{
|
||||
|
|
@ -75,34 +75,34 @@ public class Picking3d
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
BeginMode3D(camera);
|
||||
|
||||
if (collision.Hit)
|
||||
{
|
||||
DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.RED);
|
||||
DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.MAROON);
|
||||
DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.Red);
|
||||
DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.Maroon);
|
||||
|
||||
DrawCubeWires(cubePosition, cubeSize.X + 0.2f, cubeSize.Y + 0.2f, cubeSize.Z + 0.2f, Color.GREEN);
|
||||
DrawCubeWires(cubePosition, cubeSize.X + 0.2f, cubeSize.Y + 0.2f, cubeSize.Z + 0.2f, Color.Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.GRAY);
|
||||
DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.DARKGRAY);
|
||||
DrawCube(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.Gray);
|
||||
DrawCubeWires(cubePosition, cubeSize.X, cubeSize.Y, cubeSize.Z, Color.DarkGray);
|
||||
}
|
||||
|
||||
DrawRay(ray, Color.MAROON);
|
||||
DrawRay(ray, Color.Maroon);
|
||||
DrawGrid(10, 1.0f);
|
||||
|
||||
EndMode3D();
|
||||
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, Color.DARKGRAY);
|
||||
DrawText("Try selecting the box with mouse!", 240, 10, 20, Color.DarkGray);
|
||||
|
||||
if (collision.Hit)
|
||||
{
|
||||
int posX = (screenWidth - MeasureText("BOX SELECTED", 30)) / 2;
|
||||
DrawText("BOX SELECTED", posX, (int)(screenHeight * 0.1f), 30, Color.GREEN);
|
||||
DrawText("BOX SELECTED", posX, (int)(screenHeight * 0.1f), 30, Color.Green);
|
||||
}
|
||||
|
||||
DrawFPS(10, 10);
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ public class RandomValues
|
|||
// Draw
|
||||
//----------------------------------------------------------------------------------
|
||||
BeginDrawing();
|
||||
ClearBackground(Color.RAYWHITE);
|
||||
ClearBackground(Color.RayWhite);
|
||||
|
||||
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, Color.MAROON);
|
||||
DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, Color.Maroon);
|
||||
|
||||
DrawText($"{randValue}", 360, 180, 80, Color.LIGHTGRAY);
|
||||
DrawText($"{randValue}", 360, 180, 80, Color.LightGray);
|
||||
|
||||
EndDrawing();
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue