/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { _btnPause = new ButtonSprite(); _btn480 = new ButtonSprite(); _btn720 = new ButtonSprite(); _btn1080 = new ButtonSprite(); _buttons.Add(_btnPause); _buttons.Add(_btn480); _buttons.Add(_btn720); _buttons.Add(_btn1080); _btnPause.Position = new Vector2(100, 225); _btnPause.TextureScale = new Vector2(1f, 0.5f); _btnPause.Text = "Pause"; _btnPause.TextOffset = new Vector2(30, 20); _btn480.Position = new Vector2(250, 225); _btn480.TextureScale = new Vector2(0.5f, 0.5f); _btn480.Text = "480"; _btn480.TextOffset = new Vector2(15, 20); _btn720.Position = new Vector2(325, 225); _btn720.TextureScale = new Vector2(0.5f, 0.5f); _btn720.Text = "720"; _btn720.TextOffset = new Vector2(15, 20); _btn1080.Position = new Vector2(400, 225); _btn1080.TextureScale = new Vector2(0.6f, 0.5f); _btn1080.Text = "1080"; _btn1080.TextOffset = new Vector2(15, 20); _focusManager.Mappings[_btnPause] = new FocusManager.ButtonMapping() { Right = _btn480, }; _focusManager.Mappings[_btn480] = new FocusManager.ButtonMapping() { Right = _btn720, }; _focusManager.Mappings[_btn720] = new FocusManager.ButtonMapping() { Left = _btn480, Right = _btn1080, }; _focusManager.Mappings[_btn1080] = new FocusManager.ButtonMapping() { Left = _btn720, }; _focusManager.SelectedButton = _btn720; _resolution = "1920x1080"; base.Initialize(); }
private void SetSelection(ButtonSprite selection) { if (null != selection && m_timerSelection < DateTime.Now) { m_timerSelection = DateTime.Now + TimeSpan.FromMilliseconds(DELAY_MS); SelectedButton = selection; } }
public void SetSelection(ButtonSprite selection) { if (null != selection && m_timerSelection < DateTime.Now) { m_timerSelection = DateTime.Now + TimeSpan.FromMilliseconds(DELAY_MS); SelectedButton = selection; } }
public void UpdatePauseFocus(ButtonSprite pauseButton) { for (int index = 0; index < 4; ++index) { if (PausePressed((PlayerIndex)index)) { SetSelection(pauseButton); } } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here m_focusManager.OnClick += OnClick; GamePad.EventOnKeyUp += EventOnKeyUp; BtnPause = new ButtonSprite(); Btn480 = new ButtonSprite(); Btn720 = new ButtonSprite(); Btn1080 = new ButtonSprite(); m_buttons.Add(BtnPause); m_buttons.Add(Btn480); m_buttons.Add(Btn720); m_buttons.Add(Btn1080); BtnPause.Position = new Vector2(100, 225); BtnPause.TextureScale = new Vector2(1f, 0.5f); BtnPause.Text = "Pause"; BtnPause.TextOffset = new Vector2(30, 20); Btn480.Position = new Vector2(250, 225); Btn480.TextureScale = new Vector2(0.5f, 0.5f); Btn480.Text = "480"; Btn480.TextOffset = new Vector2(15, 20); Btn720.Position = new Vector2(325, 225); Btn720.TextureScale = new Vector2(0.5f, 0.5f); Btn720.Text = "720"; Btn720.TextOffset = new Vector2(15, 20); Btn1080.Position = new Vector2(400, 225); Btn1080.TextureScale = new Vector2(0.6f, 0.5f); Btn1080.Text = "1080"; Btn1080.TextOffset = new Vector2(15, 20); m_focusManager.Mappings[BtnPause] = new FocusManager.ButtonMapping() { Right = Btn480, }; m_focusManager.Mappings[Btn480] = new FocusManager.ButtonMapping() { Right = Btn720, }; m_focusManager.Mappings[Btn720] = new FocusManager.ButtonMapping() { Left = Btn480, Right = Btn1080, }; m_focusManager.Mappings[Btn1080] = new FocusManager.ButtonMapping() { Left = Btn720, }; m_focusManager.SelectedButton = Btn1080; m_resolution = "1920x1080"; base.Initialize(); }