Exemple #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (!IsReadyToUpdate)
            {
                return;
            }

            Thread.Yield();

            PulsarcTime.Update();

            CheckScreen();

            cursor.SetPos(MouseManager.CurrentState.Position);

            ConvertMaps();

            // Let ScreenManager handle the updating of the current active screen
            ScreenManager.Update(gameTime);

            // See if we're taking a screenshot this frame
            Screenshotter.Update();

            base.Update(gameTime);
        }
Exemple #2
0
        /// <summary>
        /// Initialize most static objects and dependencies
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            // Copy, if needed, the required assemblies (BASS) for 32 or 64bit CPUs
            NativeAssemblies.Copy();

            // Initialize the logging tool for troubleshooting
            PulsarcLogger.Initialize();

            // Initialize Discord Rich Presence
            PulsarcDiscord.Initialize();

            // Set the default culture (Font formatting Locals) for this thread
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // Start the thread listening for user input
            InputManager.StartThread();

            // Start our time and frame-time tracker
            PulsarcTime.Start();

            // Initialize FPS
            fpsDisplay = new FPS(Vector2.Zero);

            // Initialize the game camera
            gameCamera = new Camera(Graphics.GraphicsDevice.Viewport, (int)GetDimensions().X, (int)GetDimensions().Y, 1)
            {
                Pos = new Vector2(GetDimensions().X / 2, GetDimensions().Y / 2)
            };

            // Start the song selection in the background to have music when entering the game
            SongScreen = new SongSelection();
            SongScreen.Init();

            // Create and display the default game screen
            // (Currently Main menu. In the future can implement an intro)
            Menu firstScreen = new Menu();

            ScreenManager.AddScreen(firstScreen);

            cursor = new Cursor();

            IsReadyToUpdate = true;
        }