示例#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);
        }
示例#2
0
文件: World.cs 项目: barronds/XNARTS
        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();
        }
示例#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);
        }
示例#4
0
        public Game1()
        {
            mGraphicsDeviceManager = new GraphicsDeviceManager(this);
            Content.RootDirectory  = "Content";

            mListener_ExitGameEvent = new XListener <ExitGameEvent>(1, eEventQueueFullBehaviour.Ignore, "ExitGame");

            XBulletinBoard.CreateInstance();
            XFontDraw.CreateInstance();
            XRenderManager.CreateInstance();
            XTouch.CreateInstance();
            XKeyInput.CreateInstance();
            XWorld.CreateInstance();
            XMouse.CreateInstance();
            XUI.CreateInstance();
            XRootDebugMenu.CreateInstance();
        }