Beispiel #1
0
 public override void Update(InputController inputController)
 {
     timer++;
     if (inputController.Pause.JustPressed)
         selected = true;
     option.Update(true);
 }
Beispiel #2
0
        /// <summary>
        /// Should be called in load content.
        /// </summary>
        public void Initialize(GameContext initialContext)
        {
            canvas = new Canvas(graphics, graphicsDevice);
            #if DEBUG
            canvas.DebugMode = true;
            #else
            canvas.DebugMode = false;
            #endif
            // Initialize audio player.
            audioPlayer = new AudioPlayer();
            assets = new AssetManager();
            exitGame = false;

            //launch initialize asynchronously
            //ThreadPool.QueueUserWorkItem(new WaitCallback(InitializeNextContext));
            asyncFinished = true;
            /*Thread t = new Thread(new ThreadStart(InitializeNextContext));
            t.IsBackground = true;
            t.Start();*/

            // load all content
            assets.LoadContent(content, graphicsDevice);
            canvas.LoadContent(assets);
            inputController = new InputController(assets);
            fileManager = new DataCenter(assets);
            InitializeContextComponents(initialContext);
            currentContext = initialContext;

            inputController.Update();

            currentOverlayAlpha = 0;
        }
Beispiel #3
0
 public abstract void Update(InputController inputController);
Beispiel #4
0
 private void ProcessInput(InputController inputController)
 {
     if (cursor.Cyclable(inputController.MenuLeft))
     {
         x--;
         if (x < 0)
         {
             x = arrangement.Columns - 1;
             while (arrangement.GetIndex(x, y) >= options.Count)
                 x--;
         }
     }
     if (cursor.Cyclable(inputController.MenuRight))
     {
         x++;
         if (x >= arrangement.Columns || arrangement.GetIndex(x, y) >= options.Count)
             x = 0;
     }
     if (cursor.Cyclable(inputController.MenuUp))
     {
         y--;
         if (y < 0)
         {
             y = arrangement.Rows - 1;
             while (arrangement.GetIndex(x, y) >= options.Count)
                 y--;
         }
     }
     if (cursor.Cyclable(inputController.MenuDown))
     {
         y++;
         if (y >= arrangement.Rows || arrangement.GetIndex(x, y) >= options.Count)
             y = 0;
     }
     if (inputController.MenuForward.JustPressed)
         cursor.Select();
 }
Beispiel #5
0
 public override void Update(InputController inputController)
 {
     //process input
     ProcessInput(inputController);
     //update options and cursor
     IntValue = arrangement.GetIndex(x, y);
     for (int i = 0; i < options.Count; i++)
         options[i].Update(i == IntValue);
     cursor.Update(IntValue);
     if (cursorBoundsEnabled)// && !cursorBounds.Contains(cursor.Position))
     {
         //offset = -cursorBounds.EdgeDistance(cursor.Position);
         cursorBounds = cursorBounds.Offset(cursorBounds.EdgeDistance(cursor.Position));
     }
 }