Ejemplo n.º 1
0
        protected override void Initialize()
        {
            RunningGameState.IsXNAHiDef = (GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef);
            spriteBatch = new SpriteBatch(GraphicsDevice);

#if MUSIC_ENABLED
            // create music engine
            musicEngine = MusicEngine.GetInstance(); // TODO check for Initialized property
            musicEngine.AudioPath = "..\\..\\..\\..\\Audio";
#endif
            RunningGameState.musicEngine = musicEngine;

            toplevelScreen = new Screenlet(1280, 768);
            Gamelet physicsModel = new FixedTimestepPhysics();
            
            toplevelScreen.Add(physicsModel);
            toplevelScreen.Add(new FrameRateCounter(1.0f, 0f));
            physicsModel.Add(new TTRStateMachine());
            treeRoot = toplevelScreen;

            TTengineMaster.Initialize(treeRoot);

            // finally call base to enumnerate all (gfx) Game components to init
            base.Initialize();
        }
Ejemplo n.º 2
0
        void GardenInit()
        {
            // loading screen
            loadingScreenlet                    = new Screenlet(myWindowWidth, myWindowHeight);
            TTengineMaster.ActiveScreen         = loadingScreenlet;
            loadingScreenlet.ActiveInState      = new StatePlayingGame();
            loadingScreenlet.DrawInfo.DrawColor = Color.Black;
            loadingDisplay = new LoadingDisplay();
            loadingScreenlet.Add(loadingDisplay);

            // from here on, main screen
            mainScreenlet = new Screenlet(myWindowWidth, myWindowHeight);
            TTengineMaster.ActiveScreen = mainScreenlet;
            //mainScreenlet.ActiveInState = new StateBrowsingMenu();
            TreeRoot = new FixedTimestepPhysics();
            TreeRoot.SetNextState(new StateStartup()); // set the initial state

            TreeRoot.Add(mainScreenlet);
            TreeRoot.Add(loadingScreenlet);
            mainScreenlet.DrawInfo.DrawColor = new Color(169 * 2 / 3, 157 * 2 / 3, 241 * 2 / 3); // Color.Black;

            // graphics bitmap scaling that adapts to screen resolution
            mainScreenlet.Motion.Scale    = ((float)myWindowHeight) / 900f;
            loadingScreenlet.Motion.Scale = mainScreenlet.Motion.Scale;

            //
            Spritelet SplashScreen = new Spritelet("igglogo");

            SplashScreen.DrawInfo.LayerDepth = 1f;
            SplashScreen.ActiveInState       = new StateStartup();
            //l.Duration = 17.5f;
            SplashScreen.Motion.Position = mainScreenlet.Center;
            //l.Motion.Add(new MyFuncyModifier( delegate(float v) { return 1f-(float)Math.Sqrt((18f-v)/18f); }, "Scale" ));
            mainScreenlet.Add(SplashScreen);

            // music engine
            musicEngine           = MusicEngine.GetInstance();
            musicEngine.AudioPath = ".";
            if (!musicEngine.Initialize())
            {
                throw new Exception(musicEngine.StatusMsg);
            }

            Thread t = new Thread(new ThreadStart(GardenInitInBackground));

            t.Start();
        }
Ejemplo n.º 3
0
        void GardenInit()
        {
            // loading screen
            loadingScreenlet = new Screenlet(myWindowWidth, myWindowHeight);
            TTengineMaster.ActiveScreen = loadingScreenlet;
            loadingScreenlet.ActiveInState = new StatePlayingGame();
            loadingScreenlet.DrawInfo.DrawColor = Color.Black;
            loadingDisplay = new LoadingDisplay();
            loadingScreenlet.Add(loadingDisplay);

            // from here on, main screen
            mainScreenlet = new Screenlet(myWindowWidth, myWindowHeight);
            TTengineMaster.ActiveScreen = mainScreenlet;
            //mainScreenlet.ActiveInState = new StateBrowsingMenu();
            TreeRoot = new FixedTimestepPhysics();
            TreeRoot.SetNextState(new StateStartup()); // set the initial state

            TreeRoot.Add(mainScreenlet);
            TreeRoot.Add(loadingScreenlet);
            mainScreenlet.DrawInfo.DrawColor = new Color(169 * 2 / 3, 157 * 2 / 3, 241 * 2 / 3); // Color.Black;

            // graphics bitmap scaling that adapts to screen resolution 
            mainScreenlet.Motion.Scale = ((float)myWindowHeight) / 900f;
            loadingScreenlet.Motion.Scale = mainScreenlet.Motion.Scale;

            //
            Spritelet SplashScreen = new Spritelet("igglogo");
            SplashScreen.DrawInfo.LayerDepth = 1f;
            SplashScreen.ActiveInState = new StateStartup();
            //l.Duration = 17.5f;
            SplashScreen.Motion.Position = mainScreenlet.Center;
            //l.Motion.Add(new MyFuncyModifier( delegate(float v) { return 1f-(float)Math.Sqrt((18f-v)/18f); }, "Scale" ));
            mainScreenlet.Add(SplashScreen);

            // music engine
            musicEngine = MusicEngine.GetInstance();
            musicEngine.AudioPath = ".";
            if (!musicEngine.Initialize())
                throw new Exception(musicEngine.StatusMsg);

            Thread t = new Thread(new ThreadStart(GardenInitInBackground));
            t.Start();
        }