Пример #1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            Resources.AddStore(new DllResourceStore("Wobble.Tests.Resources.dll"));
            Textures.Load();

            // (This should normally be done at the start of the game.)
            // Load up a font to use by a byte[] / ResourceStore.
            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-bold"))
            {
                BitmapFontFactory.AddFont("exo2-bold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-bold.otf"));
            }

            // (This should normally be done at the start of the game.)
            // Load up a font to use by a byte[] / ResourceStore.
            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-regular"))
            {
                BitmapFontFactory.AddFont("exo2-regular", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-regular.otf"));
            }

            IsReadyToUpdate = true;

            // Once the assets load, we'll start the main screen
            ScreenManager.ChangeScreen(new SelectionScreen());
        }
Пример #2
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            Resources.AddStore(new DllResourceStore("Wobble.Tests.Resources.dll"));
            Textures.Load();

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-bold"))
            {
                BitmapFontFactory.AddFont("exo2-bold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-bold.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-regular"))
            {
                BitmapFontFactory.AddFont("exo2-regular", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-regular.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-semibold"))
            {
                BitmapFontFactory.AddFont("exo2-semibold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-medium"))
            {
                BitmapFontFactory.AddFont("exo2-medium", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-medium.ttf"));
            }

            IsReadyToUpdate = true;

            // Once the assets load, we'll start the main screen
            ScreenManager.ChangeScreen(new SelectionScreen());
        }
Пример #3
0
 /// <summary>
 ///     UnloadContent will be called once per game and is the place to unload
 ///     game-specific content.
 /// </summary>
 protected override void UnloadContent()
 {
     WobbleAssets.Dispose();
     WindowManager.UnHookEvents();
     AudioManager.Dispose();
     DiscordManager.Dispose();
     BitmapFontFactory.Dispose();
 }
Пример #4
0
 /// <summary>
 ///     Loads all bitmap fonts.
 /// </summary>
 public static void Load()
 {
     BitmapFontFactory.AddFont(Exo2Bold, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-bold.ttf"));
     BitmapFontFactory.AddFont(Exo2BoldItalic, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-bolditalic.ttf"));
     BitmapFontFactory.AddFont(Exo2Italic, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-italic.ttf"));
     BitmapFontFactory.AddFont(Exo2Light, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-light.ttf"));
     BitmapFontFactory.AddFont(Exo2Medium, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-medium.ttf"));
     BitmapFontFactory.AddFont(Exo2MediumItalic, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-mediumitalic.ttf"));
     BitmapFontFactory.AddFont(Exo2Regular, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-regular.ttf"));
     BitmapFontFactory.AddFont(Exo2SemiBold, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-semibold.ttf"));
     BitmapFontFactory.AddFont(Exo2SemiBoldItalic, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-semibolditalic.ttf"));
     BitmapFontFactory.AddFont(Exo2Thin, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-thin.ttf"));
     BitmapFontFactory.AddFont(Exo2ThinItalic, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/Exo2/exo2-thinitalic.ttf"));
     BitmapFontFactory.AddFont(SourceSansProRegular, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/SourceSansPro/sspro-regular.ttf"));
     BitmapFontFactory.AddFont(SourceSansProBold, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/SourceSansPro/sspro-bold.ttf"));
     BitmapFontFactory.AddFont(SourceSansProSemiBold, GameBase.Game.Resources.Get("Quaver.Resources/Fonts/SourceSansPro/sspro-semibold.ttf"));
 }
Пример #5
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        protected override void LoadContent()
        {
            base.LoadContent();

            Resources.AddStore(new DllResourceStore("Wobble.Tests.Resources.dll"));

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-bold"))
            {
                BitmapFontFactory.AddFont("exo2-bold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-bold.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-regular"))
            {
                BitmapFontFactory.AddFont("exo2-regular", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-regular.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-semibold"))
            {
                BitmapFontFactory.AddFont("exo2-semibold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf"));
            }

            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-medium"))
            {
                BitmapFontFactory.AddFont("exo2-medium", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-medium.ttf"));
            }

            var font = new WobbleFontStore(20, GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-semibold.ttf"), new Dictionary <string, byte[]>()
            {
                { "Emoji", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/symbola-emoji.ttf") },
                { "Japanese", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/droid-sans-japanese.ttf") }
            });

            FontManager.CacheWobbleFont("exo2-semibold", font);

            IsReadyToUpdate = true;

            // Once the assets load, we'll start the main screen
            ScreenManager.ChangeScreen(new SelectionScreen());
        }
Пример #6
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="screen"></param>
        public TestDrawingSpritesScreenView(Screen screen) : base(screen)
        {
            #region GREEN_BOX
            GreenBox = new Sprite()
            {
                Parent    = Container,
                Size      = new ScalableVector2(50, 50),
                Tint      = Color.Green,
                Position  = new ScalableVector2(0, 10),
                Alignment = Alignment.TopCenter
            };

            GreenBox.AddBorder(Color.White, 2);
            #endregion

            // (This should normally be done at the start of the game.)
            // Load up a font to use by a byte[] / ResourceStore.
            if (!BitmapFontFactory.CustomFonts.ContainsKey("exo2-bold"))
            {
                BitmapFontFactory.AddFont("exo2-bold", GameBase.Game.Resources.Get("Wobble.Tests.Resources/Fonts/exo2-bold.otf"));
            }

            #region HELLO_WORLD_TEXT
            HelloWorldText = new SpriteText("exo2-bold", "Hello, World!", 18)
            {
                Parent    = Container,
                Alignment = Alignment.TopCenter,
                Y         = GreenBox.Height + GreenBox.Y + 40
            };
            #endregion

            #region CLICK_ME_BUTTON
            ClickMeButton = new TextButton(WobbleAssets.WhiteBox, "exo2-bold", "Click me!", 18, (sender, args) =>
            {
                // Click event handler method goes here.
                // Choose a random background color!
                BackgroundColor = new Color(Rng.Next(0, 255), Rng.Next(0, 255), Rng.Next(0, 255));
            })
            {
                Parent    = Container,
                Size      = new ScalableVector2(150, 50),
                Tint      = Color.White,
                Text      = { Tint = Color.Black },
                Alignment = Alignment.TopCenter,
                Y         = HelloWorldText.Y + 40
            };
            #endregion

            #region ANIMATING_LIGHTING
            AnimatingLighting = new AnimatableSprite(Textures.TestSpritesheet)
            {
                Parent    = Container,
                Size      = new ScalableVector2(200, 200),
                Alignment = Alignment.MidRight,
                X         = -20,
                // Here we will create new custom SpriteBatchOptions for this sprite.
                // This overrides SpriteBatch.Begin() to include these new SpriteBatchOptions ONLY for this sprite and any
                // sprites drawn after it that specify `UsePreviousSpriteBatchOptions`
                //
                // IMPORTANT!
                // Any sprites you want to have these same SpriteBatch.Begin options for WITHOUT creating a new SpriteBatch,
                // you must set `UsePreviousSpriteBatchOptions` to true.
                SpriteBatchOptions = new SpriteBatchOptions {
                    BlendState = BlendState.Additive
                },
            };

            // Start the animation loop forwards at 60FPS infinitely.
            AnimatingLighting.StartLoop(Direction.Forward, 60);
            #endregion

            #region SPRITE_WITH_SHADER
            SpriteWithShader = new Sprite
            {
                Image              = WobbleAssets.WhiteBox,
                Size               = new ScalableVector2(200, 200),
                Alignment          = Alignment.TopCenter,
                Parent             = Container,
                Tint               = Color.Orange,
                Y                  = ClickMeButton.Y + ClickMeButton.Height + 40,
                SpriteBatchOptions = new SpriteBatchOptions
                {
                    SortMode          = SpriteSortMode.Deferred,
                    BlendState        = BlendState.NonPremultiplied,
                    SamplerState      = SamplerState.PointClamp,
                    DepthStencilState = DepthStencilState.Default,
                    RasterizerState   = RasterizerState.CullNone,
                    // The shader attached is to make the sprite semi transparent
                    // Shader created by "Vortex-" (https://github.com/VortexCoyote)
                    Shader = new Shader(GameBase.Game.Resources.Get("Wobble.Tests.Resources/Shaders/semi-transparent.mgfxo"),
                                        new Dictionary <string, object>
                    {
                        { "p_dimensions", new Vector2(200, 200) },
                        { "p_position", new Vector2(0, 0) },
                        { "p_rectangle", new Vector2(100, 100) },
                        { "p_alpha", 0f }
                    })
                }
            };
            #endregion
        }