From aa93b55a747dbe9a4aa229e68602ef3125bcf4ab Mon Sep 17 00:00:00 2001 From: emil28092005 Date: Thu, 18 Jun 2026 00:22:27 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20window=20now=20visible=20=E2=80=94=20SDL?= =?UTF-8?q?=5FShowWindow=20+=20Wayland=20support=20in=20run.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Added SDL_ShowWindow + SDL_RaiseWindow after window creation - run.sh: auto-detect Wayland vs X11, set SDL_VIDEODRIVER accordingly - Wayland session uses SDL_VIDEODRIVER=wayland (bundled SDL3 lacks X11 support) - Engine runs at 1600+ FPS, window visible on Wayland desktop - Screenshots confirm 3D geometry rendering correctly --- scripts/run.sh | 13 ++++++++++--- src/Engine.Core/Sdl3Window.cs | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/run.sh b/scripts/run.sh index f447ce4..1a27f85 100755 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -4,13 +4,20 @@ # ./scripts/run.sh # run with defaults # ./scripts/run.sh --mcp-port 5000 # run with MCP HTTP server # ./scripts/run.sh --camera-tour # capture screenshots and exit -# ./scripts/run.sh --mcp-stdio # run headless stdio MCP server +# ./scripts/run.sh --mcp-stdio # run headless stdio MCP server ENGINE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -export DISPLAY="${DISPLAY:-:0}" export DOTNET_ROOT="${DOTNET_ROOT:-$HOME/.dotnet}" export PATH="$DOTNET_ROOT:$PATH" +# Prefer Wayland if available, fall back to X11 +if [ -n "$WAYLAND_DISPLAY" ]; then + export SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-wayland}" +else + export DISPLAY="${DISPLAY:-:0}" + export SDL_VIDEODRIVER="${SDL_VIDEODRIVER:-x11}" +fi + cd "$ENGINE_DIR" -exec dotnet run --project "$ENGINE_DIR/src/CortexEngine.App/CortexEngine.App.csproj" -- "$@" +exec dotnet run --project "$ENGINE_DIR/src/CortexEngine.App/CortexEngine.App.csproj" -c Debug -- "$@" diff --git a/src/Engine.Core/Sdl3Window.cs b/src/Engine.Core/Sdl3Window.cs index eb0f9bd..024aede 100644 --- a/src/Engine.Core/Sdl3Window.cs +++ b/src/Engine.Core/Sdl3Window.cs @@ -43,6 +43,9 @@ public sealed unsafe class Sdl3Window : IWindow if (_window == null) throw new InvalidOperationException($"SDL_CreateWindow failed: {SDL3.SDL_GetError()}"); + + SDL3.SDL_ShowWindow(_window); + SDL3.SDL_RaiseWindow(_window); } public void PumpEvents()