コード例 #1
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();
 }
コード例 #2
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();
        }
コード例 #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();
        }