options menu shows (empty) options dialog
This commit is contained in:
@@ -29,6 +29,16 @@ namespace OpenRa.Game
|
|||||||
readonly Animation pwrdownButton;
|
readonly Animation pwrdownButton;
|
||||||
readonly Animation optionsButton;
|
readonly Animation optionsButton;
|
||||||
|
|
||||||
|
readonly Sprite optionsTop;
|
||||||
|
readonly Sprite optionsBottom;
|
||||||
|
readonly Sprite optionsLeft;
|
||||||
|
readonly Sprite optionsRight;
|
||||||
|
readonly Sprite optionsTopLeft;
|
||||||
|
readonly Sprite optionsTopRight;
|
||||||
|
readonly Sprite optionsBottomLeft;
|
||||||
|
readonly Sprite optionsBottomRight;
|
||||||
|
readonly Sprite optionsBackground;
|
||||||
|
|
||||||
readonly SpriteRenderer buildPaletteRenderer;
|
readonly SpriteRenderer buildPaletteRenderer;
|
||||||
readonly Animation cantBuild;
|
readonly Animation cantBuild;
|
||||||
readonly Animation ready;
|
readonly Animation ready;
|
||||||
@@ -87,6 +97,16 @@ namespace OpenRa.Game
|
|||||||
optionsButton = new Animation("tabs");
|
optionsButton = new Animation("tabs");
|
||||||
optionsButton.PlayRepeating("left-normal");
|
optionsButton.PlayRepeating("left-normal");
|
||||||
|
|
||||||
|
optionsLeft = SpriteSheetBuilder.LoadAllSprites("dd-left")[0];
|
||||||
|
optionsRight = SpriteSheetBuilder.LoadAllSprites("dd-right")[0];
|
||||||
|
optionsTop = SpriteSheetBuilder.LoadAllSprites("dd-top")[0];
|
||||||
|
optionsBottom = SpriteSheetBuilder.LoadAllSprites("dd-botm")[0];
|
||||||
|
optionsTopLeft = SpriteSheetBuilder.LoadAllSprites("dd-crnr")[0];
|
||||||
|
optionsTopRight = SpriteSheetBuilder.LoadAllSprites("dd-crnr")[1];
|
||||||
|
optionsBottomLeft = SpriteSheetBuilder.LoadAllSprites("dd-crnr")[2];
|
||||||
|
optionsBottomRight = SpriteSheetBuilder.LoadAllSprites("dd-crnr")[3];
|
||||||
|
optionsBackground = SpriteSheetBuilder.LoadAllSprites("dd-bkgnd")[Game.CosmeticRandom.Next(4)];
|
||||||
|
|
||||||
blank = SheetBuilder.Add(new Size(64, 48), 16);
|
blank = SheetBuilder.Add(new Size(64, 48), 16);
|
||||||
|
|
||||||
sprites = groups
|
sprites = groups
|
||||||
@@ -154,6 +174,7 @@ namespace OpenRa.Game
|
|||||||
int paletteHeight = DrawBuildPalette(currentTab);
|
int paletteHeight = DrawBuildPalette(currentTab);
|
||||||
DrawBuildTabs(paletteHeight);
|
DrawBuildTabs(paletteHeight);
|
||||||
DrawChat();
|
DrawChat();
|
||||||
|
DrawOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawMinimap()
|
void DrawMinimap()
|
||||||
@@ -357,17 +378,43 @@ namespace OpenRa.Game
|
|||||||
|
|
||||||
optionsButton.ReplaceAnim(optionsPressed ? "left-pressed" : "left-normal");
|
optionsButton.ReplaceAnim(optionsPressed ? "left-pressed" : "left-normal");
|
||||||
|
|
||||||
AddButton(optionsRect, isLmb => DrawOptionsMenu());
|
AddButton(optionsRect, isLmb => optionsPressed = !optionsPressed);
|
||||||
buildPaletteRenderer.DrawSprite(optionsButton.Image, optionsDrawPos, PaletteType.Chrome);
|
buildPaletteRenderer.DrawSprite(optionsButton.Image, optionsDrawPos, PaletteType.Chrome);
|
||||||
buildPaletteRenderer.Flush();
|
buildPaletteRenderer.Flush();
|
||||||
|
|
||||||
renderer.DrawText("Exit", new int2(80, -2) , Color.White);
|
renderer.DrawText("Options", new int2(80, -2) , Color.White);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawOptionsMenu()
|
void DrawOptionsMenu()
|
||||||
{
|
{
|
||||||
Environment.Exit(0);
|
if (optionsPressed){
|
||||||
|
var menuDrawPos = Game.viewport.Location + new float2(Game.viewport.Width/2, Game.viewport.Height/2);
|
||||||
|
var width = optionsTop.bounds.Width + optionsTopLeft.bounds.Width + optionsTopRight.bounds.Width;
|
||||||
|
var height = optionsLeft.bounds.Height + optionsTopLeft.bounds.Height + optionsBottomLeft.bounds.Height;
|
||||||
|
var adjust = 8;
|
||||||
|
|
||||||
|
menuDrawPos = menuDrawPos + new float2(-width/2, -height/2);
|
||||||
|
|
||||||
|
var backgroundDrawPos = menuDrawPos + new float2( (width - optionsBackground.bounds.Width)/2, (height - optionsBackground.bounds.Height)/2);
|
||||||
|
|
||||||
|
//draw background
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsBackground, backgroundDrawPos, PaletteType.Chrome);
|
||||||
|
|
||||||
|
//draw borders
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsTopLeft, menuDrawPos, PaletteType.Chrome);
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsLeft, menuDrawPos + new float2(0, optionsTopLeft.bounds.Height), PaletteType.Chrome);
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsBottomLeft, menuDrawPos + new float2(0, optionsTopLeft.bounds.Height + optionsLeft.bounds.Height), PaletteType.Chrome);
|
||||||
|
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsTop, menuDrawPos + new float2(optionsTopLeft.bounds.Width, 0), PaletteType.Chrome);
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsTopRight, menuDrawPos + new float2(optionsTopLeft.bounds.Width + optionsTop.bounds.Width, 0), PaletteType.Chrome);
|
||||||
|
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsBottom, menuDrawPos + new float2(optionsTopLeft.bounds.Width, optionsTopLeft.bounds.Height + optionsLeft.bounds.Height +adjust), PaletteType.Chrome);
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsBottomRight, menuDrawPos + new float2(optionsBottomLeft.bounds.Width + optionsBottom.bounds.Width, optionsTopLeft.bounds.Height + optionsLeft.bounds.Height), PaletteType.Chrome);
|
||||||
|
|
||||||
|
buildPaletteRenderer.DrawSprite(optionsRight, menuDrawPos + new float2(optionsTopLeft.bounds.Width + optionsTop.bounds.Width + adjust + 1, optionsTopRight.bounds.Height), PaletteType.Chrome);
|
||||||
|
|
||||||
|
buildPaletteRenderer.Flush();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleChronosphereButton()
|
void HandleChronosphereButton()
|
||||||
|
|||||||
@@ -1028,4 +1028,10 @@
|
|||||||
<sequence name="left-normal" start="0" length="1" />
|
<sequence name="left-normal" start="0" length="1" />
|
||||||
<sequence name="left-pressed" start="1" length="1" />
|
<sequence name="left-pressed" start="1" length="1" />
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit name="dd-crnr">
|
||||||
|
<sequence name="top-left" start="0" length="1" />
|
||||||
|
<sequence name="top-right" start="1" length="1" />
|
||||||
|
<sequence name="bottom-left" start="2" length="1" />
|
||||||
|
<sequence name="bottom-right" start="3" length="1" />
|
||||||
|
</unit>
|
||||||
</sequences>
|
</sequences>
|
||||||
Reference in New Issue
Block a user