Exemplo n.º 1
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();
        }
 public LoadingDisplayState(LoadingDisplay parent)
 {
     this.loadingDisplay = parent;
 }
 public StateLoadingDisplay_Empty(LoadingDisplay parent)
     : base(parent)
 {
 }
 public StateLoadingDisplay_Playing(LoadingDisplay parent)
     : base(parent)
 {
 }
 public StateLoadingDisplay_Empty(LoadingDisplay parent)
     : base(parent)
 {
 }
 public LoadingDisplayState(LoadingDisplay parent)
 {
     this.loadingDisplay = parent;
 }