Beispiel #1
0
        void GardenInitInBackground()
        {
            // music
            music = new GardenMusic();
            TreeRoot.AddNextUpdate(music);

            // MyDownloader configuration
            myDownloaderProtocol        = new HttpFtpProtocolExtension();
            Settings.Default.MaxRetries = 0;

            // load config
            if ((GardenConfig.Instance != null) && LoadGameLibrary())
            {
                // game chooser menu
                GameChooserMenu menu = new GameChooserMenu();
                menu.ActiveInState = new StateBrowsingMenu();
                mainScreenlet.AddNextUpdate(menu);
            }
            else
            {
                Exit();
            }

            // activate next phase
            TreeRoot.SetNextState(new StateBrowsingMenu());
        }
            public override void OnUpdate(Gamelet g, ref UpdateParams p)
            {
                base.OnUpdate(g, ref p);
                // fade in
                loadingDisplay.iggNameBox.ColorB.FadeTarget = 1.0f;

                if (SimTime <= 1f || isFirstDraw)
                {
                    loadingDisplay.tbox.Text = "   Enjoy \"" + loadingDisplay.game.Name + "\"";
                }
                else
                {
                    // suppress drawing during play of another game - save resources and avoid gfx conflicts.
                    GardenGame.Instance.SuppressDraw();
                }
                if (SimTime > TIME_SHOW_PLAYING_MESSAGE)
                {
                    g.SetNextState(new StateLoadingDisplay_Empty(loadingDisplay));
                }

                // check keyboard - if esc, get back to garden state
                if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                {
                    g.SetNextState(new StateBrowsingMenu());
                }
            }
Beispiel #3
0
            public override void OnUpdate(Gamelet g, ref UpdateParams p)
            {
                base.OnUpdate(g, ref p);
                int    phase = (int)Math.Round((SimTime * 2f) % 3.0f);
                string t     = "Loading \"" + loadingDisplay.game.Name + "\"";

                switch (phase)
                {
                case 0: t += " .";
                    break;

                case 1: t += " ..";
                    break;

                case 2: t += " ...";
                    break;
                }
                loadingDisplay.tbox.Text = t;

                if (loadingDisplay.nextStateTimer >= 0f && SimTime > loadingDisplay.nextStateTimer)
                {
                    loadingDisplay.nextStateTimer = -1f;
                    g.SetNextState(new StateLoadingDisplay_Playing(loadingDisplay));
                }

                loadingDisplay.helpTextBox.Text = loadingDisplay.game.HelpText;
            }
Beispiel #4
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();
        }
Beispiel #5
0
            public override void OnUpdate(Gamelet g, ref UpdateParams p)
            {
                base.OnUpdate(g, ref p);
                // fade in
                loadingDisplay.iggNameBox.ColorB.AlphaTarget = 1.0f;

                if (SimTime <= 1f || isFirstDraw)
                {
                    loadingDisplay.tbox.Text = "   Enjoy \"" + loadingDisplay.game.Name + "\"";
                }
                else
                {
                    // suppress drawing during play of another game - save resources and avoid gfx conflicts.
                    GardenGame.Instance.SuppressDraw();
                }
                if (SimTime > TIME_SHOW_PLAYING_MESSAGE)
                {
                    g.SetNextState(new StateLoadingDisplay_Empty(loadingDisplay));
                }

                // check keyboard - if esc, get back to garden state
                if (loadingDisplay.isExiting)
                {
                    loadingDisplay.timeExiting += p.Dt;
                    if (loadingDisplay.timeExiting > TIME_ESC_PRESS_TO_EXIT)
                    {
                        loadingDisplay.willExitSoon = true;
                    }
                }

                // perform real exit operation (abort launcher task) when ESC already released
                if (!loadingDisplay.isExiting && loadingDisplay.willExitSoon)
                {
                    GardenGame.Instance.launcher.Abort();
                    loadingDisplay.willExitSoon = false;
                    //to do: // do not progress to next global state until user has released esc button? or do not consider that as a new ESC press (even better)
                }
            }
        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 override void OnUpdate(Gamelet g, ref UpdateParams p)
            {
                base.OnUpdate(g, ref p);
                // fade in
                loadingDisplay.iggNameBox.ColorB.FadeTarget = 1.0f;

                if (SimTime <= 1f || isFirstDraw)
                {
                    loadingDisplay.tbox.Text = "   Enjoy \"" + loadingDisplay.game.Name + "\"";
                }
                else
                {
                    // suppress drawing during play of another game - save resources and avoid gfx conflicts.
                    GardenGame.Instance.SuppressDraw();
                }
                if (SimTime > TIME_SHOW_PLAYING_MESSAGE)
                {
                    g.SetNextState(new StateLoadingDisplay_Empty(loadingDisplay));
                }

                // check keyboard - if esc, get back to garden state
                if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                {
                    g.SetNextState(new StateBrowsingMenu());
                }
            }
            public override void OnUpdate(Gamelet g, ref UpdateParams p)
            {
                base.OnUpdate(g, ref p);
                int phase = (int)Math.Round((SimTime*2f) % 3.0f);
                string t = "Loading \"" + loadingDisplay.game.Name + "\"";
                switch (phase)
                {
                    case 0: t += " .";
                        break;
                    case 1: t += " ..";
                        break;
                    case 2: t += " ...";
                        break;
                }
                loadingDisplay.tbox.Text = t;

                if (loadingDisplay.nextStateTimer >= 0f && SimTime > loadingDisplay.nextStateTimer)
                {
                    loadingDisplay.nextStateTimer = -1f;
                    g.SetNextState(new StateLoadingDisplay_Playing(loadingDisplay));
                }

                loadingDisplay.helpTextBox.Text = loadingDisplay.game.HelpText;
            }