Manages input for the game.
Example #1
0
        public UIExternalContainer(int width, int height)
        {
            _Width = width;
            _Height = height;
            inputManager = new InputManager();
            State = new UpdateState();
            mouse = new MouseState();

            WidthHeightChange(width, height);
        }
Example #2
0
        public UILayer(Microsoft.Xna.Framework.Game G, SpriteFont SprFontBig, SpriteFont SprFontSmall)
        {
            fpsStopwatch = new Stopwatch();
            fpsStopwatch.Start();

            m_G = G;
            m_SprFontBig = SprFontBig;
            m_SprFontSmall = SprFontSmall;

            m_WorldMatrix = Matrix.Identity;
            m_ViewMatrix = Matrix.CreateLookAt(Vector3.Right * 5, Vector3.Zero, Vector3.Forward);
            m_ProjectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi / 4.0f,
                    (float)GraphicsDevice.PresentationParameters.BackBufferWidth /
                    (float)GraphicsDevice.PresentationParameters.BackBufferHeight,
                    1.0f, 100.0f);

            TextStyle.DefaultTitle = new TextStyle {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255,249,157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultButton = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255, 249, 157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            TextStyle.DefaultLabel = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 10,
                Color = new Color(255, 249, 157),
                SelectedColor = new Color(0x00, 0x38, 0x7B),
                SelectionBoxColor = new Color(255, 249, 157)
            };

            Tween = new UITween();
            this.AddProcess(Tween);

            inputManager = new InputManager();
            mainUI = new UIContainer();
            dialogContainer = new UIContainer();
            mainUI.Add(dialogContainer);

            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch = new UISpriteBatch(GraphicsDevice, 3);

            GameFacade.OnContentLoaderReady += new BasicEventHandler(GameFacade_OnContentLoaderReady);
            m_G.GraphicsDevice.DeviceReset += new EventHandler<EventArgs>(GraphicsDevice_DeviceReset);
        }