Beispiel #1
0
        public override void Load()
        {
            _ui = new UIEngine();

            _demos = GetAvailableDemos();
            string[] demoNames = new string[_demos.Length];
            for (int i = 0; i < _demos.Length; i++)
                demoNames[i] = _demos[i].Name;

            // Setup Frame
            var frame = new UIFrame();
            var listBox = new ListBox(Vector2.Zero,
                demoNames,
                (SpriteFont)Utilities.ContentRepository.Repository["BasicFont"],
                Color.Blue);

            listBox.MaximimumElementsDisplayed = 10;
            listBox.SelectionMade += new ListBoxEventHandler(SelectionMade);
            frame.AddControl(listBox);

            frame.KeyUp += new KeyEventHandler(KeyUp);
            _ui.AddAndLoad(frame);
            // End Frame Setup

            Game currentGame = (Game)Utilities.Globals.Data["Game"];
            currentGame.IsMouseVisible = true;
        }
Beispiel #2
0
 public void AddFrame(UIFrame frame)
 {
     if (ActiveFrame != null)
         ActiveFrame.OnLoseControl(ActiveFrame);
     _frames.Add(frame);
     frame.BindToGUIEngine(this);
     ActiveFrame.OnGainControl(ActiveFrame);
 }
Beispiel #3
0
        public override void Load()
        {
            /* initialize game state */
            UIManager = new UIEngine();

            var frame = new UIFrame();
            frame.KeyUp += new KeyEventHandler(frame_KeyUp);
            UIManager.AddAndLoad(frame);
        }
Beispiel #4
0
        public override void Load()
        {
            UIManager = new UIEngine();

            var frame = new UIFrame();
            frame.KeyUp += new KeyEventHandler(frame_KeyUp);
            frame.MouseClick += new MouseEventHandler(game_MouseClick);
            UIManager.AddAndLoad(frame);

            var keyController = new KeyboardController(frame, KeyMappings.SimpleMapping);
            keyController.KeyControlEngaged += new KeyControlEventHandler(keyController_KeyControlEngaged);
            keyController.KeyControlDisengaged += new KeyControlEventHandler(keyController_KeyControlDisengaged);
            keyController.KeyControlJustEngaged += new KeyControlEventHandler(keyController_KeyControlJustEngaged);

            frame.MouseOver += new MouseEventHandler(mouseController_MouseOver);

            Reload();
        }
Beispiel #5
0
 public void OnGainControl(UIFrame sender)
 {
     if (GainControl != null)
         GainControl(sender);
 }
Beispiel #6
0
 public void OnLoseControl(UIFrame sender)
 {
     if (LoseControl != null)
         LoseControl(sender);
 }