feat: add Windows runtime support
This commit is contained in:
@@ -100,7 +100,7 @@ src/
|
|||||||
|
|
||||||
### 3.1 Initialization
|
### 3.1 Initialization
|
||||||
|
|
||||||
1. **Load `libvulkan.so.1`** via `NativeLibrary.Load()`
|
1. **Load the platform Vulkan loader** via `NativeLibrary.Load()` (`vulkan-1.dll` on Windows, `libvulkan.so.1` on Linux)
|
||||||
2. **`vkGetInstanceProcAddr`** — only directly-loaded function
|
2. **`vkGetInstanceProcAddr`** — only directly-loaded function
|
||||||
3. **Create instance** with SDL3 extensions + `VK_EXT_debug_utils` (if validation available)
|
3. **Create instance** with SDL3 extensions + `VK_EXT_debug_utils` (if validation available)
|
||||||
4. **Pick physical device** — prefer `DiscreteGpu`
|
4. **Pick physical device** — prefer `DiscreteGpu`
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ AI-Native 3D game engine with pure P/Invoke Vulkan 1.3 render backend.
|
|||||||
- **ECS** — Flecs.NET with Transform, Mesh, Material, Light, Camera, RigidBody components
|
- **ECS** — Flecs.NET with Transform, Mesh, Material, Light, Camera, RigidBody components
|
||||||
- **SDL3 Window** — cross-platform, Vulkan surface
|
- **SDL3 Window** — cross-platform, Vulkan surface
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start — Linux (main platform)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Build
|
# Build
|
||||||
@@ -38,6 +38,33 @@ dotnet build CORTEX_ENGINE.sln -c Debug
|
|||||||
dotnet test tests/Engine.Tests/Engine.Tests.csproj -c Debug
|
dotnet test tests/Engine.Tests/Engine.Tests.csproj -c Debug
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Quick Start — Windows x64
|
||||||
|
|
||||||
|
PowerShell scripts select the Windows native runtime assets explicitly; Bash is
|
||||||
|
not required:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Build and restore Windows native dependencies
|
||||||
|
dotnet restore .\CORTEX_ENGINE.sln -r win-x64
|
||||||
|
dotnet build .\CORTEX_ENGINE.sln -c Debug -r win-x64 --no-restore
|
||||||
|
|
||||||
|
# Run the engine
|
||||||
|
.\scripts\run.ps1
|
||||||
|
|
||||||
|
# Run a demo scene
|
||||||
|
.\scripts\run.ps1 --scene shooter
|
||||||
|
|
||||||
|
# Run with AI/MCP server
|
||||||
|
.\scripts\start_mcp_engine.ps1 -Port 5000
|
||||||
|
|
||||||
|
# Run tests
|
||||||
|
dotnet test .\tests\Engine.Tests\Engine.Tests.csproj -c Debug -r win-x64
|
||||||
|
```
|
||||||
|
|
||||||
|
The project keeps Linux as the default RID on Linux hosts and selects `win-x64`
|
||||||
|
automatically on Windows. Use `-r win-x64` when cross-publishing from another
|
||||||
|
OS.
|
||||||
|
|
||||||
## Controls
|
## Controls
|
||||||
|
|
||||||
- **WASD** — move camera
|
- **WASD** — move camera
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[Parameter(ValueFromRemainingArguments = $true)]
|
||||||
|
[string[]] $EngineArgs
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$engineDir = Split-Path -Parent $PSScriptRoot
|
||||||
|
$project = Join-Path $engineDir 'src/CortexEngine.App/CortexEngine.App.csproj'
|
||||||
|
|
||||||
|
Push-Location $engineDir
|
||||||
|
try {
|
||||||
|
& dotnet run --project $project -c Debug -r win-x64 -- @EngineArgs
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $exitCode
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
[CmdletBinding()]
|
||||||
|
param(
|
||||||
|
[int] $Port = 5000
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
$engineDir = Split-Path -Parent $PSScriptRoot
|
||||||
|
$project = Join-Path $engineDir 'src/CortexEngine.App/CortexEngine.App.csproj'
|
||||||
|
|
||||||
|
Push-Location $engineDir
|
||||||
|
try {
|
||||||
|
& dotnet run --project $project -c Debug -r win-x64 -- --mcp-port $Port
|
||||||
|
$exitCode = $LASTEXITCODE
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
|
||||||
|
exit $exitCode
|
||||||
@@ -11,6 +11,15 @@
|
|||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
|
||||||
<DefineConstants>DEV_MODE</DefineConstants>
|
<DefineConstants>DEV_MODE</DefineConstants>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<!-- Keep Linux as the default development platform while selecting the
|
||||||
|
correct native runtime assets automatically on Windows. An explicit
|
||||||
|
-r/-p:RuntimeIdentifier always takes precedence for cross-publishing. -->
|
||||||
|
<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' AND '$(OS)' == 'Windows_NT'">
|
||||||
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' AND '$(OS)' != 'Windows_NT'">
|
||||||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -408,18 +408,39 @@ class Program
|
|||||||
|
|
||||||
var w = window.Width;
|
var w = window.Width;
|
||||||
var h = window.Height;
|
var h = window.Height;
|
||||||
var ffmpegArgs = $"-y -f rawvideo -pixel_format bgra -video_size {w}x{h} -framerate 60 -i - -c:v libx264 -preset fast -crf 23 -pix_fmt yuv420p -vf fps=30 {recordingPath}";
|
var outputPath = recordingPath!;
|
||||||
|
|
||||||
|
// ArgumentList avoids shell-specific quoting rules and works
|
||||||
|
// for paths on both Windows and Linux.
|
||||||
var psi = new ProcessStartInfo
|
var psi = new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "ffmpeg",
|
FileName = "ffmpeg",
|
||||||
Arguments = ffmpegArgs,
|
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardInput = true,
|
RedirectStandardInput = true,
|
||||||
RedirectStandardOutput = true,
|
|
||||||
RedirectStandardError = true,
|
|
||||||
CreateNoWindow = true,
|
CreateNoWindow = true,
|
||||||
};
|
};
|
||||||
|
psi.ArgumentList.Add("-y");
|
||||||
|
psi.ArgumentList.Add("-f");
|
||||||
|
psi.ArgumentList.Add("rawvideo");
|
||||||
|
psi.ArgumentList.Add("-pixel_format");
|
||||||
|
psi.ArgumentList.Add("bgra");
|
||||||
|
psi.ArgumentList.Add("-video_size");
|
||||||
|
psi.ArgumentList.Add($"{w}x{h}");
|
||||||
|
psi.ArgumentList.Add("-framerate");
|
||||||
|
psi.ArgumentList.Add("60");
|
||||||
|
psi.ArgumentList.Add("-i");
|
||||||
|
psi.ArgumentList.Add("-");
|
||||||
|
psi.ArgumentList.Add("-c:v");
|
||||||
|
psi.ArgumentList.Add("libx264");
|
||||||
|
psi.ArgumentList.Add("-preset");
|
||||||
|
psi.ArgumentList.Add("fast");
|
||||||
|
psi.ArgumentList.Add("-crf");
|
||||||
|
psi.ArgumentList.Add("23");
|
||||||
|
psi.ArgumentList.Add("-pix_fmt");
|
||||||
|
psi.ArgumentList.Add("yuv420p");
|
||||||
|
psi.ArgumentList.Add("-vf");
|
||||||
|
psi.ArgumentList.Add("fps=30");
|
||||||
|
psi.ArgumentList.Add(outputPath);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -431,7 +452,7 @@ class Program
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"[App] Failed to start FFmpeg: {ex.Message}");
|
Console.WriteLine($"[App] Failed to start FFmpeg: {ex.Message}");
|
||||||
Console.WriteLine("[App] Install FFmpeg: sudo apt install ffmpeg");
|
Console.WriteLine("[App] Install FFmpeg and ensure the ffmpeg executable is available on PATH.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user