Skip to content

Commit

Permalink
Expose GameTitle, WindowIconSet and SplashLogo to content (#5475)
Browse files Browse the repository at this point in the history
* Expose GameTitle to public

Requirement for upstream ss14 pr

* Missing method implemented

* Add windowiconset and splashlogo (I think this is what pjb meant?)

I don't think its worth it to add the other stuff (modules, assemblyprefix, autocnnect, clientassemblies)

* Docs
  • Loading branch information
VasilisThePikachu authored Oct 1, 2024
1 parent ea02260 commit b4beca6
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
1 change: 1 addition & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ END TEMPLATE-->

* `RequiredMemberAttribute` and `SetsRequiredMembersAttribute` have been added to the sandbox whitelist. I.e., you can now use the `required` keyword in client/shared code.
* Added `LineEdit.SelectAllOnFocus`.
* ``Gametitle``,``WindowIconSet`` and ``SplashLogo`` are exposed in IGameController. These will return said information set game options or whatever is set in manifest.yml.

### Bugfixes

Expand Down
24 changes: 18 additions & 6 deletions Robust.Client/GameController/GameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,28 @@ public void SetCommandLineArgs(CommandLineArgs args)
_commandLineArgs = args;
}

public string GameTitle()
{
return Options.DefaultWindowTitle ?? _resourceManifest!.DefaultWindowTitle ?? "RobustToolbox";
}

public string WindowIconSet()
{
return Options.WindowIconSet?.ToString() ?? _resourceManifest!.WindowIconSet ?? "";
}

public string SplashLogo()
{
return Options.SplashLogo?.ToString() ?? _resourceManifest!.SplashLogo ?? "";
}

internal bool StartupContinue(DisplayMode displayMode)
{
DebugTools.AssertNotNull(_resourceManifest);

_clyde.InitializePostWindowing();
_audio.InitializePostWindowing();
_clyde.SetWindowTitle(
Options.DefaultWindowTitle ?? _resourceManifest!.DefaultWindowTitle ?? "RobustToolbox");
_clyde.SetWindowTitle(GameTitle());

_taskManager.Initialize();
_parallelMgr.Initialize();
Expand Down Expand Up @@ -399,10 +413,8 @@ internal bool StartupSystemSplash(
// Handle GameControllerOptions implicit CVar overrides.
_configurationManager.OverrideConVars(new[]
{
(CVars.DisplayWindowIconSet.Name,
options.WindowIconSet?.ToString() ?? _resourceManifest.WindowIconSet ?? ""),
(CVars.DisplaySplashLogo.Name,
options.SplashLogo?.ToString() ?? _resourceManifest.SplashLogo ?? "")
(CVars.DisplayWindowIconSet.Name, WindowIconSet()),
(CVars.DisplaySplashLogo.Name, SplashLogo())
});
}

Expand Down
15 changes: 15 additions & 0 deletions Robust.Client/IGameController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,20 @@ public interface IGameController
/// This exists to give content module more control over tick updating.
/// </summary>
event Action<FrameEventArgs>? TickUpdateOverride;

/// <summary>
/// Get the games Title, if Options.DefaultWindowTitle or if defaultWindowTitle is not set in the manifest.yml, it will default to RobustToolbox.
/// </summary>
string GameTitle();

/// <summary>
/// Get the games Window Icon set, if Options.WindowIconSet or if windowIconSet is not set in the manifest.yml, it will default to an empty string.
/// </summary>
string WindowIconSet();

/// <summary>
/// Get the games Splash Logo, if Options.SplashLogo or if splashLogo is not set in the manifest.yml, it will default to an empty string.
/// </summary>
string SplashLogo();
}

15 changes: 15 additions & 0 deletions Robust.UnitTesting/GameControllerDummy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,20 @@ public void MouseWheel(MouseWheelEventArgs mouseWheelEventArgs)
public void OverrideMainLoop(IGameLoop gameLoop)
{
}

public string GameTitle()
{
return "RobustToolbox";
}

public string WindowIconSet()
{
return "";
}

public string SplashLogo()
{
return "";
}
}
}

0 comments on commit b4beca6

Please sign in to comment.