public override void Initialize() { inputHelper = null; for (int componentIndex = 0; componentIndex < Game.Components.Count; componentIndex++) { if (Game.Components[componentIndex] is _21BlackJack.Misc.InputHelper) { inputHelper = (_21BlackJack.Misc.InputHelper)Game.Components[componentIndex]; break; } } spriteBatch = new SpriteBatch(Game.GraphicsDevice); base.Initialize(); }
public override void Initialize() { inputHelper = null; for (int componentIndex = 0; componentIndex < Game.Components.Count; componentIndex++) { if (Game.Components[componentIndex] is _21BlackJack.Misc.InputHelper) { inputHelper = (_21BlackJack.Misc.InputHelper)Game.Components[componentIndex]; break; } } Game.IsMouseVisible = true; base.Initialize(); spriteBatch = new SpriteBatch(Game.GraphicsDevice); Rectangle size = chipAssets[assetNames[0]].Bounds; Rectangle bounds = spriteBatch.GraphicsDevice.Viewport.TitleSafeArea; positions[chipAssets.Count - 1] = new Vector2(bounds.Left + 10, bounds.Bottom - size.Height - 80); for (int chipIndex = 2; chipIndex <= chipAssets.Count; chipIndex++) { size = chipAssets[assetNames[chipAssets.Count - chipIndex]].Bounds; positions[chipAssets.Count - chipIndex] = positions[chipAssets.Count - (chipIndex - 1)] - new Vector2(0, size.Height + 10); } bet = new CardsGame.UI.Button("Button Regular", "ButtonPressed", input, cardGame) { Bounds = new Rectangle(bounds.Left + 10, bounds.Bottom - 60, 100, 50), Font = cardGame.Font, Text = "Deal", }; bet.Click += Bet_Click; Game.Components.Add(bet); clear = new CardsGame.UI.Button("Button Regular", "Button Pressed", input, cardGame) { Bounds = new Rectangle(bounds.Left + 120, bounds.Bottom - 60, 100, 50), Font = cardGame.Font, Text = "Clear", }; clear.Click += Clear_Click; Game.Components.Add(clear); ShowAndEnableButtons(false); }