Files
RobustToolbox/SS14.Client/GameController/GameController.Headless.cs
Pieter-Jan Briers dbc88e253b Allow client to run headlessly. (#727)
AKA Without Godot.

Still links against GodotSharp, but this does mean that you can run headless or not from the same binary.
2019-01-19 18:23:41 +01:00

45 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using SS14.Client.Interfaces;
using SS14.Shared.Interfaces.Timing;
using SS14.Shared.IoC;
using SS14.Shared.Timing;
namespace SS14.Client
{
public partial class GameController
{
private GameLoop _mainLoop;
[Dependency] private IGameTiming _gameTimingHeadless;
public static void Main()
{
#if !X64
throw new InvalidOperationException("The client cannot start outside x64.");
#endif
IoCManager.Register<ISceneTreeHolder, SceneTreeHolder>();
IoCManager.BuildGraph();
var gc = new GameController();
gc.Startup();
gc.MainLoop();
}
private void MainLoop()
{
_mainLoop = new GameLoop(_gameTimingHeadless)
{
SleepMode = SleepMode.Delay
};
_mainLoop.Tick += (sender, args) => Update(args.DeltaSeconds);
// set GameLoop.Running to false to return from this function.
_mainLoop.Run();
}
}
}