diff --git a/OpenRA.Game/Widgets/Delegates/MainMenuButtonsDelegate.cs b/OpenRA.Game/Widgets/Delegates/MainMenuButtonsDelegate.cs index bd9ceb2060..3feaee5178 100644 --- a/OpenRA.Game/Widgets/Delegates/MainMenuButtonsDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/MainMenuButtonsDelegate.cs @@ -18,6 +18,7 @@ */ #endregion using System; +using OpenRA.FileFormats; namespace OpenRA.Widgets.Delegates { public class MainMenuButtonsDelegate : IWidgetDelegate @@ -25,6 +26,15 @@ namespace OpenRA.Widgets.Delegates public MainMenuButtonsDelegate() { Chrome.rootWidget.GetWidget("MAINMENU_BUTTON_QUIT").OnMouseUp = mi => {Game.Exit(); return true;}; + + var version = Chrome.rootWidget.GetWidget("MAINMENU_BG").GetWidget("VERSION_STRING"); + + if (FileSystem.Exists("VERSION")) + { + var s = FileSystem.Open("VERSION"); + version.Text = "Version: "+s.ReadAllText(); + s.Close(); + } } } } diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 35588ac5e9..c32d8acb0e 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -56,12 +56,18 @@ namespace OpenRA.Widgets { var font = (Bold) ? Game.chrome.renderer.BoldFont : Game.chrome.renderer.RegularFont; var text = GetText(); + if (text == null) + return; + int2 textSize = font.Measure(text); int2 position = DrawPosition(); if (Align == TextAlign.Center) position += new int2((Bounds.Width - textSize.X)/2, 0); - + + if (Align == TextAlign.Right) + position += new int2(Bounds.Width - textSize.X,0); + font.DrawText(text, position, Color.White); } diff --git a/OpenRA.Game/Widgets/Widget.cs b/OpenRA.Game/Widgets/Widget.cs index f7f3124430..0d36e74cfa 100644 --- a/OpenRA.Game/Widgets/Widget.cs +++ b/OpenRA.Game/Widgets/Widget.cs @@ -102,6 +102,8 @@ namespace OpenRA.Widgets substitutions.Add("WINDOW_RIGHT", Game.viewport.Width); substitutions.Add("WINDOW_BOTTOM", Game.viewport.Height); substitutions.Add("PARENT_RIGHT", parentBounds.Width); + substitutions.Add("PARENT_LEFT", parentBounds.Left); + substitutions.Add("PARENT_TOP", parentBounds.Top); substitutions.Add("PARENT_BOTTOM", parentBounds.Height); int width = Evaluator.Evaluate(Width, substitutions); int height = Evaluator.Evaluate(Height, substitutions); diff --git a/mods/cnc/menus.yaml b/mods/cnc/menus.yaml index 41ada215f2..6119b0ba36 100644 --- a/mods/cnc/menus.yaml +++ b/mods/cnc/menus.yaml @@ -53,6 +53,14 @@ Container: Width:160 Height:25 Text:Quit + Label@VERSION_STRING: + Id:VERSION_STRING + X:WINDOW_RIGHT - PARENT_LEFT - WIDTH - 15 + Y:WINDOW_BOTTOM - PARENT_TOP - 25 + Width:400 + Height:35 + Text: + Align:Right Background@CREATESERVER_BG: Id:CREATESERVER_BG Delegate:CreateServerMenuDelegate @@ -650,7 +658,7 @@ Container: Id:MUSIC_BG Delegate:MusicPlayerDelegate X:WINDOW_RIGHT - 175 - Y:WINDOW_BOTTOM - 65 + Y:WINDOW_BOTTOM - 95 Width: 160 Height: 55 Visible: true diff --git a/mods/ra/menus.yaml b/mods/ra/menus.yaml index d5d31b832a..caceb65b49 100644 --- a/mods/ra/menus.yaml +++ b/mods/ra/menus.yaml @@ -53,6 +53,14 @@ Container: Width:160 Height:25 Text:Quit + Label@VERSION_STRING: + Id:VERSION_STRING + X:WINDOW_RIGHT - PARENT_LEFT - WIDTH - 15 + Y:WINDOW_BOTTOM - PARENT_TOP - 25 + Width:400 + Height:35 + Text: + Align:Right Background@CREATESERVER_BG: Id:CREATESERVER_BG Delegate:CreateServerMenuDelegate @@ -649,7 +657,7 @@ Container: Id:MUSIC_BG Delegate:MusicPlayerDelegate X:WINDOW_RIGHT - 175 - Y:WINDOW_BOTTOM - 65 + Y:WINDOW_BOTTOM - 95 Width: 160 Height: 55 Visible: true diff --git a/packaging/osx/package-game.sh b/packaging/osx/package-game.sh index 5a6f6c0f6e..e51e93c66b 100755 --- a/packaging/osx/package-game.sh +++ b/packaging/osx/package-game.sh @@ -25,7 +25,7 @@ cd $PAYLOAD for i in $EXCLUDE; do find . -path "$i" -delete done -date "+%Y%m%d%H" >> "VERSION" +date "+%Y%m%d%H" > "VERSION" zip payload -r -9 * cd $PACKAGING_PATH