Esempio n. 1
0
        protected override void Update(GameTime gameTime)
        {
            var st = Keyboard.GetState();

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                Exit();
            }
            if (!loading)
            {
                long now = FileSystemTime.Now1;
                if (fsTime != -1)
                {
                    //limit frame to 100ms
                    ts.Update(Math.Min(100 * 1000, (now - fsTime) / 10.0));
                }
                fsTime = now;

                inp.Update(st);


                if (st.IsKeyDown(Keys.Escape))
                {
                    if (g.Playing)
                    {
                        g.Pause();
                    }
                    else
                    {
                        g.Play();
                    }
                }
            }
            base.Update(gameTime);
        }
Esempio n. 2
0
        public void Update(GameTime gameTime)
        {
            var  st  = Keyboard.GetState();
            long now = FileSystemTime.Now1;

            if (fsTime != -1)
            {
                //limit frame to 100ms
                ts.Update(Math.Min(100 * 1000, (now - fsTime) / 10.0));
            }
            fsTime = now;

            inp.Update(st);


            if (globals.InputManager.DidPress(Keys.Escape))
            {
                if (g.Playing)
                {
                    g.Pause();
                }
                else
                {
                    g.Play();
                }
            }
            else if (globals.InputManager.DidPress(Keys.OemTilde))
            {
                //TODO think more about this screen switching logic
                globals.ScreenManager.Switch(previous);
            }
        }
Esempio n. 3
0
        public PlayScreen(MainGame.Globals globals, SongLoader previous, Song s, SongSettings songSettings)
        {
            this.globals  = globals;
            this.previous = previous;


            ts = new SimpleTimeSource(s.PPQ, s.InitialTempo);
            //var stf = new StaffRenderer(theme, , s);
            sR = new StaffRenderer(globals.Theme, new MV
            {
                ts       = ts,
                interval = s.PPQ * 4,
            }, s);


            g   = new Core.Game(s, songSettings.MidiOut, ts, this);
            inp = new Mono.KeyboardMIDIInput(g);

            ctr = new ComboCounter(globals.Theme.TestFont, ts);

            g.Play();
        }
Esempio n. 4
0
        protected override void LoadContent()
        {
            sb    = new SpriteBatch(GraphicsDevice);
            theme = new Theme();
            theme.LoadBasic(Content);

            var loadMidi  = Task.Run(() => new MidiFile("Assets/desire_drive.mid"));
            var loadTheme = Task.Run(() => theme.LoadFromContent(Content));
            var output    = midiManager.CreateOutput();

            Task.Run(async() =>
            {
                // TODO: use this.Content to load your game content here
                var s = MidiToSong.FromMidi(await loadMidi);


                ts = new SimpleTimeSource(s.PPQ, s.InitialTempo);
                //var stf = new StaffRenderer(theme, , s);
                await loadTheme;
                sR = new StaffRenderer(theme, new MV
                {
                    ts       = ts,
                    interval = s.PPQ * 4,
                }, s);

                var mout = await output;

                g   = new Core.Game(s, mout, ts, this);
                inp = new Mono.KeyboardMIDIInput(g);

                ctr = new ComboCounter(theme.TestFont, ts);

                loading = false;
                g.Play();
            });
        }