Пример #1
0
        /// <summary>
        ///     Creates a game with embedded resources as a content manager.
        /// </summary>
        protected WobbleGame()
        {
            Directory.SetCurrentDirectory(WorkingDirectory);
            Environment.CurrentDirectory = WorkingDirectory;
            NativeAssemblies.Copy();

            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8,
            };

            GameBase.Game       = this;
            GlobalUserInterface = new GlobalUserInterface();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                // Required for libbass_fx.so to load properly on Linux and not crash (see https://github.com/ppy/osu/issues/2852).
                NativeLibrary.Load("libbass.so", NativeLibrary.LoadFlags.RTLD_LAZY | NativeLibrary.LoadFlags.RTLD_GLOBAL);
            }

            alphaOneSprite = new Sprite
            {
                SpriteBatchOptions = new SpriteBatchOptions
                {
                    // We want to copy the source alpha and leave the destination color.
                    BlendState = new BlendState
                    {
                        AlphaSourceBlend      = Blend.One,
                        AlphaDestinationBlend = Blend.Zero,
                        ColorSourceBlend      = Blend.Zero,
                        ColorDestinationBlend = Blend.One
                    }
                }
            };
        }
Пример #2
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;
            }

            // Update the time since the last frame and the game's clock.
            TimeSinceLastFrame = gameTime.ElapsedGameTime.TotalMilliseconds;
            TimeRunning       += (long)gameTime.ElapsedGameTime.TotalMilliseconds;

            Drawable.ResetTotalDrawnCount();

            // Keep the window updated with the current resolution.
            WindowManager.Update();
            MouseManager.Update();
            KeyboardManager.Update();
            ScreenManager.Update(gameTime);
            AudioManager.Update(gameTime);

            // Update the global sprite container
            GlobalUserInterface.Update(gameTime);

            // Keep the RPC client up-to-date.
            DiscordManager.Client?.Invoke();
            LogManager.Update(gameTime);
            Logger.Update();

            base.Update(gameTime);
        }
Пример #3
0
        /// <summary>
        ///     Creates a game with embedded resources as a content manager.
        /// </summary>
        protected WobbleGame()
        {
            Directory.SetCurrentDirectory(WorkingDirectory);
            Environment.CurrentDirectory = WorkingDirectory;
            NativeAssemblies.Copy();

            Graphics = new GraphicsDeviceManager(this)
            {
                PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8,
            };

            GameBase.Game       = this;
            GlobalUserInterface = new GlobalUserInterface();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                // Required for libbass_fx.so to load properly on Linux and not crash (see https://github.com/ppy/osu/issues/2852).
                NativeLibrary.Load("libbass.so", NativeLibrary.LoadFlags.RTLD_LAZY | NativeLibrary.LoadFlags.RTLD_GLOBAL);
            }
        }