コード例 #1
0
ファイル: TTRGame.cs プロジェクト: IndiegameGarden/TTR
        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();
        }
コード例 #2
0
ファイル: MusicEngine.cs プロジェクト: IndiegameGarden/Quest
 public static MusicEngine GetInstance()
 {
     if (_instance == null)
     {
         _instance = new MusicEngine();
     }
     return(_instance);
 }
コード例 #3
0
 protected override void Initialize()
 {
     // open the TTMusicEngine
     musicEngine = MusicEngine.GetInstance();
     musicEngine.AudioPath = "../../../../test-audio";
     if (!musicEngine.Initialize())
         throw new Exception(musicEngine.StatusMsg);
     base.Initialize();
 }
コード例 #4
0
ファイル: TTGame.cs プロジェクト: IndiegameGarden/TTengine
        protected override void Initialize()
        {
            // make root world and build to it
            RootWorld = new EntityWorld();
            RootWorld.InitializeAll(true);
            TTFactory.BuildTo(RootWorld);

            // make root screen and build to it
            RootScreen = new ScreenComp(false, 0, 0);
            TTFactory.BuildTo(RootScreen);

            // make the MainChannel and build to it
            MainChannel = TTFactory.CreateChannel(Color.CornflowerBlue);
            MainChannelScreen = MainChannel.GetComponent<WorldComp>().Screen;
            TTFactory.BuildTo(MainChannel);

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

            base.Initialize();
        }
コード例 #5
0
 public static MusicEngine GetInstance()
 {
     if (_instance == null)
         _instance = new MusicEngine();
     return _instance;
 }
コード例 #6
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();
        }