mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Remove Robust.Lite
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
namespace Robust.Lite
|
||||
{
|
||||
/// <summary>
|
||||
/// Initial parameters for instantiating the window.
|
||||
/// </summary>
|
||||
public class InitialWindowParameters
|
||||
{
|
||||
/// <summary>
|
||||
/// The title of the window. This string will be localized before being used.
|
||||
/// </summary>
|
||||
public string WindowTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The initial size of the window.
|
||||
/// </summary>
|
||||
public Vector2i? Size { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,193 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Robust.Client;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Interfaces;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.Interfaces.Graphics.ClientEye;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.Interfaces.UserInterface;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Asynchronous;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.Interfaces.Log;
|
||||
using Robust.Shared.Interfaces.Timers;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Robust.Lite
|
||||
{
|
||||
internal class LiteGameController : IGameControllerInternal
|
||||
{
|
||||
private IGameLoop _mainLoop;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IClydeInternal _clyde;
|
||||
[Dependency] private readonly IConfigurationManager _configurationManager;
|
||||
[Dependency] private readonly IEyeManager _eyeManager;
|
||||
[Dependency] private readonly IFontManagerInternal _fontManager;
|
||||
[Dependency] private readonly IGameTiming _gameTiming;
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly ILogManager _logManager;
|
||||
[Dependency] private readonly IResourceCacheInternal _resourceCache;
|
||||
[Dependency] private readonly ISignalHandler _signalHandler;
|
||||
[Dependency] private readonly ITaskManager _taskManager;
|
||||
[Dependency] private readonly ITimerManager _timerManager;
|
||||
[Dependency] private readonly IUserInterfaceManagerInternal _userInterfaceManager;
|
||||
[Dependency] private readonly IInputManager _inputManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public void SetCommandLineArgs(CommandLineArgs args)
|
||||
{
|
||||
// Nada.
|
||||
}
|
||||
|
||||
public bool LoadConfigAndUserData { get; set; }
|
||||
public string ContentRootDir { get; set; }
|
||||
|
||||
|
||||
public void Shutdown(string reason = null)
|
||||
{
|
||||
_mainLoop.Running = false;
|
||||
}
|
||||
|
||||
public bool Startup()
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public void Startup(InitialWindowParameters windowParameters)
|
||||
{
|
||||
_logManager.RootSawmill.AddHandler(new ConsoleLogHandler());
|
||||
|
||||
_taskManager.Initialize();
|
||||
|
||||
_signalHandler.MaybeStart();
|
||||
|
||||
_taskManager.Initialize();
|
||||
|
||||
// TODO: Init user data maybe?
|
||||
_resourceCache.Initialize(null);
|
||||
|
||||
#if FULL_RELEASE
|
||||
_resourceCache.MountContentDirectory(@"Resources/");
|
||||
#else
|
||||
_resourceCache.MountContentDirectory($@"../../RobustToolbox/Resources");
|
||||
_resourceCache.MountContentDirectory($@"../../Resources");
|
||||
#endif
|
||||
|
||||
_localizationManager.LoadCulture(CultureInfo.CurrentCulture);
|
||||
|
||||
if (windowParameters?.Size != null)
|
||||
{
|
||||
var (w, h) = windowParameters.Size.Value;
|
||||
_configurationManager.SetCVar("display.width", w);
|
||||
_configurationManager.SetCVar("display.height", h);
|
||||
}
|
||||
|
||||
_clyde.Initialize(true);
|
||||
if (windowParameters?.WindowTitle != null)
|
||||
{
|
||||
_clyde.SetWindowTitle(_localizationManager.GetString(windowParameters.WindowTitle));
|
||||
}
|
||||
|
||||
_fontManager.Initialize();
|
||||
|
||||
_eyeManager.Initialize();
|
||||
|
||||
_userInterfaceManager.Initialize();
|
||||
|
||||
_inputManager.Initialize();
|
||||
|
||||
_inputManager.AddClickBind();
|
||||
|
||||
_clyde.Ready();
|
||||
}
|
||||
|
||||
public void MainLoop(GameController.DisplayMode mode)
|
||||
{
|
||||
_mainLoop = new GameLoop(_gameTiming);
|
||||
|
||||
_mainLoop.Tick += (sender, args) =>
|
||||
{
|
||||
if (_mainLoop.Running)
|
||||
{
|
||||
ProcessUpdate(args);
|
||||
}
|
||||
};
|
||||
|
||||
_mainLoop.Render += (sender, args) =>
|
||||
{
|
||||
if (_mainLoop.Running)
|
||||
{
|
||||
_gameTiming.CurFrame++;
|
||||
_clyde.Render();
|
||||
}
|
||||
};
|
||||
_mainLoop.Input += (sender, args) =>
|
||||
{
|
||||
if (_mainLoop.Running)
|
||||
{
|
||||
_clyde.ProcessInput(args);
|
||||
}
|
||||
};
|
||||
|
||||
_mainLoop.Update += (sender, args) =>
|
||||
{
|
||||
if (_mainLoop.Running)
|
||||
{
|
||||
RenderFrameProcess(args);
|
||||
}
|
||||
};
|
||||
|
||||
_mainLoop.Run();
|
||||
}
|
||||
|
||||
private void RenderFrameProcess(FrameEventArgs frameEventArgs)
|
||||
{
|
||||
_userInterfaceManager.FrameUpdate(frameEventArgs);
|
||||
_clyde.FrameProcess(frameEventArgs);
|
||||
}
|
||||
|
||||
private void ProcessUpdate(FrameEventArgs frameEventArgs)
|
||||
{
|
||||
_timerManager.UpdateTimers(frameEventArgs);
|
||||
_taskManager.ProcessPendingTasks();
|
||||
_userInterfaceManager.Update(frameEventArgs);
|
||||
}
|
||||
|
||||
public void KeyDown(KeyEventArgs keyEvent)
|
||||
{
|
||||
_inputManager.KeyDown(keyEvent);
|
||||
}
|
||||
|
||||
public void KeyUp(KeyEventArgs keyEvent)
|
||||
{
|
||||
_inputManager.KeyUp(keyEvent);
|
||||
}
|
||||
|
||||
public void TextEntered(TextEventArgs textEvent)
|
||||
{
|
||||
_userInterfaceManager.TextEntered(textEvent);
|
||||
}
|
||||
|
||||
public void MouseMove(MouseMoveEventArgs mouseMoveEventArgs)
|
||||
{
|
||||
_userInterfaceManager.MouseMove(mouseMoveEventArgs);
|
||||
}
|
||||
|
||||
public void MouseWheel(MouseWheelEventArgs mouseWheelEventArgs)
|
||||
{
|
||||
_userInterfaceManager.MouseWheel(mouseWheelEventArgs);
|
||||
}
|
||||
|
||||
public void OverrideMainLoop(IGameLoop gameLoop)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using Robust.Client;
|
||||
using Robust.Client.Interfaces;
|
||||
using Robust.Shared.Asynchronous;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Robust.Lite
|
||||
{
|
||||
public static class LiteLoader
|
||||
{
|
||||
public static void Run(Action postInit, InitialWindowParameters windowParameters=null)
|
||||
{
|
||||
IoCManager.InitThread();
|
||||
|
||||
ClientIoC.RegisterIoC(GameController.DisplayMode.Clyde);
|
||||
IoCManager.Register<IGameController, LiteGameController>(true);
|
||||
IoCManager.Register<IGameControllerInternal, LiteGameController>(true);
|
||||
IoCManager.Register<LiteGameController, LiteGameController>(true);
|
||||
IoCManager.BuildGraph();
|
||||
|
||||
var gc = IoCManager.Resolve<LiteGameController>();
|
||||
gc.Startup(windowParameters);
|
||||
|
||||
IoCManager.Resolve<ITaskManager>().RunOnMainThread(postInit);
|
||||
gc.MainLoop(GameController.DisplayMode.Clyde);
|
||||
|
||||
IoCManager.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\MSBuild\Robust.Properties.targets" />
|
||||
<PropertyGroup>
|
||||
<!-- Work around https://github.com/dotnet/project-system/issues/4314 -->
|
||||
<TargetFramework>$(TargetFramework)</TargetFramework>
|
||||
<LangVersion>8</LangVersion>
|
||||
<IsPackable>false</IsPackable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<Platforms>x64</Platforms>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<OutputPath>../bin/Lite</OutputPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\MSBuild\Robust.DefineConstants.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Lidgren.Network\Lidgren.Network.csproj" />
|
||||
<ProjectReference Include="..\Robust.Shared.Maths\Robust.Shared.Maths.csproj" />
|
||||
<ProjectReference Include="..\Robust.Shared\Robust.Shared.csproj" />
|
||||
<ProjectReference Include="..\Robust.Client\Robust.Client.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="..\MSBuild\Robust.Engine.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user