Esempio n. 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="game_time">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime game_time)
        {
            // user controller app exit
            // TODO: get this into exit event framework below.
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            ExitGameEvent e = mListener_ExitGameEvent.GetMaxOne();

            if (e != null)
            {
                // elaborate shutdown code goes here.
                Exit();
            }

            // TODO: Add your update logic here
            XTouch.Instance().Update(game_time);
            XKeyInput.Instance().Update();
            XMouse.Instance().Update(game_time);
            XUI.Instance().Update(game_time);
            XRootDebugMenu.Instance().Update();
            XWorld.Instance().Update();

            base.Update(game_time);
        }
Esempio n. 2
0
        public void Init()
        {
            mRendered = false;
            XUI ui = XUI.Instance();

            mListenter_KeyUp = new XListener <XKeyInput.KeyUp>(1, eEventQueueFullBehaviour.Ignore, "WorldKeyUp");
            XKeyInput.Instance().GetBroadcaster_KeyUp().Subscribe(mListenter_KeyUp);

            mListener_Button = new XListener <XUI.ButtonUpEvent>(1, eEventQueueFullBehaviour.Ignore, "WorldButton");
            ui.GetBroadcaster_ButtonUpEvent().Subscribe(mListener_Button);

            mRegnerateMapButton = ui._CreateRectangularButton(new Vector2(30, 30), "Regenerate Map", XUI.eStyle.GameplayUI);
            mMapTypeButton      = ui._CreateRectangularButton(new Vector2(30, 125), "Change Map Type", XUI.eStyle.GameplayUI);
            mMapSizeButton      = ui._CreateRectangularButton(new Vector2(30, 220), "Change Map Size", XUI.eStyle.GameplayUI);

            /*
             * mMapSizeButton = ui.CreateRectangularButton( new Vector2( 30, 315 ),
             *      "Hy0123456789012345678901234567890123456789",
             *      XUI.eStyle.FontTest );
             */

            /*
             * String[] texts = { "Hello", "Goodbye", "Meatball Soup", "Four", "5" };
             * String[] controls = { "Back", "Exit Game", "Quit Program, not really, i'm having fun" };
             * mSelector = ui.CreateSelector(	new Vector2( 1000, 400 ), "missing everything", XUI.eStyle.Frontend, XUI.eStyle.FrontendButton,
             *                                      XUI.eStyle.FrontendTitle, XUI.eStyle.FrontendControl, texts, controls );
             */

            Generate();
        }
Esempio n. 3
0
        /// <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()
        {
            XBulletinBoard.Instance().Init();
            XTouch.Instance().Init();
            XKeyInput.Instance().Init();
            XWorld.Instance().Init();
            XMouse.Instance().Init();
            XFontDraw.Instance().Init(GraphicsDevice, Content);
            XRenderManager.Instance().Initialize(GraphicsDevice, mGraphicsDeviceManager, Content);
            XUI.Instance().Init();
            XRootDebugMenu.Instance().Init();

            base.Initialize();

            XBulletinBoard.Instance().mBroadcaster_ExitGameEvent.Subscribe(mListener_ExitGameEvent);
        }