protected override void Update(GameTime gameTime)
        {
            TTengineMaster.Update(gameTime, TreeRoot);

            // update any other XNA components
            base.Update(gameTime);
        }
Exemple #2
0
        protected override void Initialize()
        {
            TTengineMaster.Create(this);

            // open the TTMusicEngine
            musicEngine           = MusicEngine.GetInstance();
            musicEngine.AudioPath = "Content";
            if (!musicEngine.Initialize())
            {
                throw new Exception(musicEngine.StatusMsg);
            }

            // from here on, main screen
            mainScreenlet = new PixieScreenlet(myWindowWidth, myWindowHeight);
            TTengineMaster.ActiveScreen = mainScreenlet;
            TreeRoot = new FixedTimestepPhysics();
            TreeRoot.Add(mainScreenlet);

            // debug only
            debugMsg = new DebugMessage("");
            //mainScreenlet.Add(debugMsg);

            // finally call base to enumnerate all (gfx) Game components to init
            base.Initialize();
        }
        protected override void Draw(GameTime gameTime)
        {
            TTengineMaster.Draw(gameTime, TreeRoot);

            // then draw other (if any) XNA game components on the screen
            base.Draw(gameTime);
        }
Exemple #4
0
        public GardenGame()
        {
            // frame border
            Form frm = (Form)Form.FromHandle(Window.Handle);

            frm.FormBorderStyle = FormBorderStyle.None;

            Instance = this;
            Content.RootDirectory = "Content";

            // create the TTengine for this game
            TTengineMaster.Create(this);

            // basic XNA graphics manager init here (before Initialize() and LoadContent() )
            graphics = new GraphicsDeviceManager(this);

            // DEBUG: insert below values eg = 1024; to test other resolutions
            myWindowWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            myWindowHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            graphics.PreferredBackBufferWidth  = myWindowWidth;
            graphics.PreferredBackBufferHeight = myWindowHeight;
            graphics.IsFullScreen = false;
            IsFixedTimeStep       = false;
            graphics.SynchronizeWithVerticalRetrace = true;
        }
Exemple #5
0
        protected override void Draw(GameTime gameTime)
        {
            TTengineMaster.Draw(gameTime, TreeRoot);
            //debugMsg.Text = Math.Round(maxDtUpdate) + " ms      ";

            // then draw other (if any) XNA game components on the screen
            base.Draw(gameTime);
        }
Exemple #6
0
        protected override void Update(GameTime gameTime)
        {
            long t0 = System.DateTime.Now.Ticks;

            TTengineMaster.Update(gameTime, TreeRoot);
            long  t1 = System.DateTime.Now.Ticks;
            float dt = ((float)(t1 - t0)) * 0.001f; //convert to ms

            //if (dt > maxDtUpdate)
            maxDtUpdate = maxDtUpdate * 0.98f + 0.02f * dt;

            // update any other XNA components
            base.Update(gameTime);
        }
Exemple #7
0
        protected override void Update(GameTime gameTime)
        {
            // update params, and call the root gamelet to do all.
            TTengineMaster.Update(gameTime, TreeRoot);

            // update any other XNA components
            base.Update(gameTime);

            // TODO document
            if (launcher != null && !launcher.IsFinished() &&
                launcher.IsGameShowingWindow && loadingDisplay.IsLoadingState())
            {
                loadingDisplay.SetPlayingGame(3.0f);
            }

            if (isExiting && !music.IsPlaying)
            {
                Exit(); // finally really exit XNA if music is faded out.
            }
        }