Allow mods to customize application title.

This commit is contained in:
Matthias Mailänder
2021-07-16 15:39:21 +02:00
committed by abcdefg30
parent 3a8957c6f3
commit f08a0b113e
8 changed files with 17 additions and 2 deletions

View File

@@ -482,9 +482,12 @@ namespace OpenRA
Renderer.InitializeDepthBuffer(grid);
Cursor?.Dispose();
Cursor = new CursorManager(ModData.CursorProvider);
var metadata = ModData.Manifest.Metadata;
if (!string.IsNullOrEmpty(metadata.WindowTitle))
Renderer.Window.SetWindowTitle(metadata.WindowTitle);
PerfHistory.Items["render"].HasNormalTick = false;
PerfHistory.Items["batches"].HasNormalTick = false;
PerfHistory.Items["render_world"].HasNormalTick = false;

View File

@@ -72,6 +72,7 @@ namespace OpenRA
IHardwareCursor CreateHardwareCursor(string name, Size size, byte[] data, int2 hotspot, bool pixelDouble);
void SetHardwareCursor(IHardwareCursor cursor);
void SetWindowTitle(string title);
void SetRelativeMouseMode(bool mode);
void SetScaleModifier(float scale);

View File

@@ -60,6 +60,7 @@ namespace OpenRA
public string Version;
public string Website;
public string WebIcon32;
public string WindowTitle;
public bool Hidden;
}

View File

@@ -31,7 +31,7 @@ namespace OpenRA.Platforms.Default
bool disposed;
readonly object syncObject = new object();
Size windowSize;
readonly Size windowSize;
Size surfaceSize;
float windowScale = 1f;
int2? lockedMousePosition;
@@ -405,6 +405,12 @@ namespace OpenRA.Platforms.Default
SDL.SDL_ShowCursor((int)SDL.SDL_bool.SDL_FALSE);
}
public void SetWindowTitle(string title)
{
VerifyThreadAffinity();
SDL.SDL_SetWindowTitle(window, title);
}
public void SetRelativeMouseMode(bool mode)
{
if (mode)

View File

@@ -3,6 +3,7 @@ Metadata:
Version: {DEV_VERSION}
Website: https://www.openra.net
WebIcon32: https://www.openra.net/images/icons/cnc_32x32.png
WindowTitle: OpenRA - Tiberian Dawn
PackageFormats: Mix

View File

@@ -3,6 +3,7 @@ Metadata:
Version: {DEV_VERSION}
Website: https://www.openra.net
WebIcon32: https://www.openra.net/images/icons/d2k_32x32.png
WindowTitle: OpenRA - Dune 2000
PackageFormats: D2kSoundResources

View File

@@ -3,6 +3,7 @@ Metadata:
Version: {DEV_VERSION}
Website: https://www.openra.net
WebIcon32: https://www.openra.net/images/icons/ra_32x32.png
WindowTitle: OpenRA - Red Alert
PackageFormats: Mix

View File

@@ -3,6 +3,7 @@ Metadata:
Version: {DEV_VERSION}
Website: https://www.openra.net
WebIcon32: https://www.openra.net/images/icons/ts_32x32.png
WindowTitle: OpenRA - Tiberian Sun
PackageFormats: Mix