2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-07-02 19:13:43 -04:00

Update enum/color names to match C# naming convention (#224)

This commit is contained in:
Danil
2024-01-18 21:00:57 +02:00
committed by GitHub
parent 2a1889403d
commit 70d86837d4
123 changed files with 1843 additions and 1847 deletions

View File

@ -33,12 +33,12 @@ public class YawPitchRoll
camera.Target = new Vector3(0.0f, 0.0f, 0.0f);
camera.Up = new Vector3(0.0f, 1.0f, 0.0f);
camera.FovY = 30.0f;
camera.Projection = CameraProjection.CAMERA_PERSPECTIVE;
camera.Projection = CameraProjection.Perspective;
// Model loading
Model model = LoadModel("resources/models/obj/plane.obj");
Texture2D texture = LoadTexture("resources/models/obj/plane_diffuse.png");
model.Materials[0].Maps[(int)MaterialMapIndex.MATERIAL_MAP_DIFFUSE].Texture = texture;
model.Materials[0].Maps[(int)MaterialMapIndex.Diffuse].Texture = texture;
float pitch = 0.0f;
float roll = 0.0f;
@ -53,11 +53,11 @@ public class YawPitchRoll
//----------------------------------------------------------------------------------
// Plane roll (x-axis) controls
if (IsKeyDown(KeyboardKey.KEY_DOWN))
if (IsKeyDown(KeyboardKey.Down))
{
pitch += 0.6f;
}
else if (IsKeyDown(KeyboardKey.KEY_UP))
else if (IsKeyDown(KeyboardKey.Up))
{
pitch -= 0.6f;
}
@ -74,11 +74,11 @@ public class YawPitchRoll
}
// Plane yaw (y-axis) controls
if (IsKeyDown(KeyboardKey.KEY_S))
if (IsKeyDown(KeyboardKey.S))
{
yaw += 1.0f;
}
else if (IsKeyDown(KeyboardKey.KEY_A))
else if (IsKeyDown(KeyboardKey.A))
{
yaw -= 1.0f;
}
@ -95,11 +95,11 @@ public class YawPitchRoll
}
// Plane pitch (z-axis) controls
if (IsKeyDown(KeyboardKey.KEY_LEFT))
if (IsKeyDown(KeyboardKey.Left))
{
roll += 1.0f;
}
else if (IsKeyDown(KeyboardKey.KEY_RIGHT))
else if (IsKeyDown(KeyboardKey.Right))
{
roll -= 1.0f;
}
@ -122,30 +122,30 @@ public class YawPitchRoll
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(Color.RAYWHITE);
ClearBackground(Color.RayWhite);
// Draw 3D model (recomended to draw 3D always before 2D)
BeginMode3D(camera);
// Draw 3d model with texture
DrawModel(model, new Vector3(0.0f, -8.0f, 0.0f), 1.0f, Color.WHITE);
DrawModel(model, new Vector3(0.0f, -8.0f, 0.0f), 1.0f, Color.White);
DrawGrid(10, 10.0f);
EndMode3D();
// Draw controls info
DrawRectangle(30, 370, 260, 70, Fade(Color.GREEN, 0.5f));
DrawRectangleLines(30, 370, 260, 70, Fade(Color.DARKGREEN, 0.5f));
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 380, 10, Color.DARKGRAY);
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 400, 10, Color.DARKGRAY);
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 420, 10, Color.DARKGRAY);
DrawRectangle(30, 370, 260, 70, Fade(Color.Green, 0.5f));
DrawRectangleLines(30, 370, 260, 70, Fade(Color.DarkGreen, 0.5f));
DrawText("Pitch controlled with: KEY_UP / KEY_DOWN", 40, 380, 10, Color.DarkGray);
DrawText("Roll controlled with: KEY_LEFT / KEY_RIGHT", 40, 400, 10, Color.DarkGray);
DrawText("Yaw controlled with: KEY_A / KEY_S", 40, 420, 10, Color.DarkGray);
DrawText(
"(c) WWI Plane Model created by GiaHanLam",
screenWidth - 240,
screenHeight - 20,
10,
Color.DARKGRAY
Color.DarkGray
);
EndDrawing();