/// <summary>
        /// Called once per frame.
        /// If camera is null, assumes everything is in screenspace.
        /// </summary>
        public void Update(Camera camera)
        {
            if (Active)
            {
                // Don't let anyone else grab focus, if anyone has, grab it back.
                if (CommandStack.Peek() != commandMap)
                {
                    CommandStack.Pop(commandMap);
                    CommandStack.Push(commandMap);
                }
                // Check if we have input focus.
                if (CommandStack.Peek() == commandMap)
                {
                    GamePadInput pad = GamePadInput.GetGamePad0();

                    if (handlerA != null && Actions.A.WasPressed)
                    {
                        Actions.A.ClearAllWasPressedState();
                        Actions.A.IgnoreUntilReleased();
                        handlerA(this);
                    }

                    if (handlerB != null && Actions.B.WasPressed)
                    {
                        Actions.B.ClearAllWasPressedState();
                        Actions.B.IgnoreUntilReleased();
                        handlerB(this);
                    }

                    if (handlerX != null && Actions.X.WasPressed)
                    {
                        Actions.X.ClearAllWasPressedState();
                        Actions.X.IgnoreUntilReleased();
                        handlerX(this);
                    }

                    if (handlerY != null && Actions.Y.WasPressed)
                    {
                        Actions.Y.ClearAllWasPressedState();
                        Actions.Y.IgnoreUntilReleased();
                        handlerY(this);
                    }
                    Vector2 hit;

                    if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
                    {
                        for (int i = 0; i < TouchInput.TouchCount; i++)
                        {
                            TouchContact touch = TouchInput.GetTouchContactByIndex(i);
                            hit = touch.position;
                            if (camera != null)
                            {
                                hit = MouseInput.AdjustHitPosition(hit, camera, false, false);
                            }
                            hit = hit - pos;

                            HandleTouchInput(hit, touch);
                        }
                    }
                    else
                    {
                        // Since the dialog is screenspace we can use the mouse position directly.
                        hit = MouseInput.PositionVec;
                        if (useRtCoords)
                        {
                            hit = ScreenWarp.ScreenToRT(hit);
                        }
                        hit -= pos;

                        HandleMouseInput(hit);
                    }
                }   // end if we have input focus.

                RefreshTexture();
            }
        }   // end of Update()