feat(linux): add graphical platform services
This commit is contained in:
parent
1628d9f587
commit
66f114b258
28 changed files with 1328 additions and 155 deletions
|
|
@ -4,9 +4,11 @@ using AcDream.App.Physics;
|
|||
using AcDream.App.Rendering.Scene;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
using AcDream.App.Settings;
|
||||
using AcDream.App.Platform;
|
||||
using AcDream.App.World;
|
||||
using AcDream.Content;
|
||||
using AcDream.Runtime;
|
||||
using AcDream.Runtime.Platform;
|
||||
using AcDream.Runtime.Entities;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
using AcDream.Runtime.Session;
|
||||
|
|
@ -498,16 +500,19 @@ public sealed class GameWindow :
|
|||
_runtimeDiagnosticCommands = new();
|
||||
private readonly AcDream.App.Combat.LiveCombatModeCommandSlot
|
||||
_liveCombatModeCommands = new();
|
||||
// K.1c: load user-customized bindings from %LOCALAPPDATA%\acdream\keybinds.json,
|
||||
// K.1c/L0: load user-customized bindings from the canonical per-platform
|
||||
// configuration path,
|
||||
// falling back to the retail-faithful defaults if the file is missing
|
||||
// or corrupt. This is THE single source of truth for the keymap at
|
||||
// startup — no other call to RetailDefaults() / AcdreamCurrentDefaults()
|
||||
// should land in the GameWindow construction path.
|
||||
private readonly AcDream.UI.Abstractions.Input.KeyBindings _keyBindings = LoadStartupKeyBindings();
|
||||
private readonly AcDream.UI.Abstractions.Input.KeyBindings _keyBindings;
|
||||
private readonly GraphicalHostPlatformServices _platformServices;
|
||||
private readonly ApplicationPathSet _applicationPaths;
|
||||
|
||||
private static AcDream.UI.Abstractions.Input.KeyBindings LoadStartupKeyBindings()
|
||||
private static AcDream.UI.Abstractions.Input.KeyBindings LoadStartupKeyBindings(
|
||||
string path)
|
||||
{
|
||||
var path = AcDream.UI.Abstractions.Input.KeyBindings.DefaultPath();
|
||||
var bindings = AcDream.UI.Abstractions.Input.KeyBindings.LoadOrDefault(path);
|
||||
Console.WriteLine($"keybinds: loaded {bindings.All.Count} bindings from {path}");
|
||||
return bindings;
|
||||
|
|
@ -571,8 +576,28 @@ public sealed class GameWindow :
|
|||
WorldGameState worldGameState,
|
||||
WorldEvents worldEvents,
|
||||
AcDream.App.Plugins.BufferedUiRegistry? uiRegistry = null)
|
||||
: this(
|
||||
options,
|
||||
worldGameState,
|
||||
worldEvents,
|
||||
uiRegistry,
|
||||
GraphicalHostPlatformServices.Resolve())
|
||||
{
|
||||
}
|
||||
|
||||
internal GameWindow(
|
||||
AcDream.App.RuntimeOptions options,
|
||||
WorldGameState worldGameState,
|
||||
WorldEvents worldEvents,
|
||||
AcDream.App.Plugins.BufferedUiRegistry? uiRegistry,
|
||||
GraphicalHostPlatformServices platformServices)
|
||||
{
|
||||
_options = options ?? throw new System.ArgumentNullException(nameof(options));
|
||||
_platformServices = platformServices
|
||||
?? throw new ArgumentNullException(nameof(platformServices));
|
||||
_applicationPaths = _platformServices.Paths;
|
||||
_keyBindings = LoadStartupKeyBindings(
|
||||
_applicationPaths.KeyBindingsFile);
|
||||
_runtime = new GameRuntime(new GameRuntimeDependencies(
|
||||
_combatAttackOperations,
|
||||
_combatTargetOperations,
|
||||
|
|
@ -611,10 +636,11 @@ public sealed class GameWindow :
|
|||
_worldEvents = worldEvents;
|
||||
_displayFramePacing = new DisplayFramePacingController(
|
||||
options.UncappedRendering,
|
||||
_frameProfiler);
|
||||
_frameProfiler,
|
||||
_platformServices.FramePacingWaiters);
|
||||
_runtimeSettings = new RuntimeSettingsController(
|
||||
new JsonRuntimeSettingsStorage(
|
||||
AcDream.UI.Abstractions.Panels.Settings.SettingsStore.DefaultPath()),
|
||||
_applicationPaths.SettingsFile),
|
||||
log: Console.WriteLine);
|
||||
_animationDiagnostics = AnimationPresentationDiagnostics.FromEnvironment();
|
||||
_uiRegistry = uiRegistry;
|
||||
|
|
@ -1209,7 +1235,9 @@ public sealed class GameWindow :
|
|||
devToolsFrameDiagnostics);
|
||||
IRuntimeKeyBindingTarget? keyBindingTarget =
|
||||
hostInputCamera.InputDispatcher is { } settingsDispatcher
|
||||
? new RuntimeKeyBindingTarget(settingsDispatcher)
|
||||
? new RuntimeKeyBindingTarget(
|
||||
settingsDispatcher,
|
||||
_applicationPaths.KeyBindingsFile)
|
||||
: null;
|
||||
optionalDevTools = new SettingsDevToolsOptionalDependencies(
|
||||
devToolsFacts,
|
||||
|
|
@ -1249,6 +1277,7 @@ public sealed class GameWindow :
|
|||
_gpuFrameFlights!,
|
||||
_options.ResidencyBudgets,
|
||||
initialCenterLandblockId,
|
||||
_applicationPaths.DiagnosticsDirectory,
|
||||
Console.WriteLine),
|
||||
this).Compose(platformResult, contentEffectsAudio, settingsDevTools);
|
||||
Console.WriteLine(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue