Skip to main content

Windows

A native WinUI 3 shell (Windows App SDK, C++/WinRT) around the Zig chart core. Same core, same C ABI and same behaviour as the other hosts.

Annapolis Harbor and the Naval Academy, day scheme

The core renders with Direct3D 12, the Windows form of the Metal transport. It owns the device, the pipelines (HLSL, compiled at run time) and a composition swapchain. The shell attaches that swapchain to a SwapChainPanel with ISwapChainPanelNative::SetSwapChain, and the XAML chrome floats over the chart. On a machine with no GPU driver the core selects WARP, the in-box software rasterizer, so the app still runs.

Before you build

  • Windows 11, Visual Studio 2022 or later with the C++ workload, and the Windows SDK 10.0.22621 or later.
  • Zig 0.16 on PATH.

NuGet restores Microsoft.WindowsAppSDK and Microsoft.Windows.CppWinRT at the first build. tile57 is not a prerequisite.

Building and running

pwsh windows/build-core.ps1 # zig build lib -Dbackend=d3d12 -> ../zig-out
cd windows
msbuild LookoutMarine.vcxproj -t:Restore /p:Configuration=Release /p:Platform=ARM64
msbuild LookoutMarine.vcxproj /p:Configuration=Release /p:Platform=ARM64
.\ARM64\Release\LookoutMarine.exe

Use /p:Platform=x64 on an x64 machine. The app is unpackaged and self-contained: the build copies the Windows App SDK runtime next to the executable.

Environment variables

VariableEffect
LOOKOUT_OPENOpen this chart or folder at start
LOOKOUT_VIEWlon,lat,zoom[,rotation] sets the opening camera
LOOKOUT_WARP1 forces the software rasterizer
LOOKOUT_OPEN_SETTINGS1 opens the mariner pane at start, for a screenshot

The mariner pane above the chart

Where the code lives

FileRole
ui/MainWindow.xamlThe chrome: bubbles, readout capsule, scale bar, panes
ui/MainWindow.xaml.cppWindow construction, chrome wiring, the render thread
ui/MainWindow.Open.cppThe open flow, the layers flyout, the pickers, the chart panel
ui/MainWindow.Input.cppGestures, commands, cursor pick, coordinate search
ui/MainWindow.Hud.cppThe readout capsule and the scale bar
ui/MainWindow.Settings.cppThe mariner pane: tabbed pages, applied on a debounce
ui/winrt_glue.cppCompiles the XAML-generated units that a command-line build does not register
src/lk_controller.*The one lookout* handle and every lookout_* call
src/lk_store.*Camera pose, recents and mariner settings in %APPDATA%\lookout-marine\settings.ini
src/lk_format.*The readout formats: scale, band and position

What to watch out for

  • The chart is a child of the XAML tree. Only a press that starts on the chart surface is a chart gesture. A press that starts on a control must stay with the control, or the button loses its click.
  • A command-line build does not register the XAML-generated units. winrt_glue.cpp compiles them. Adding a XAML file means adding it there.