示例#1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

            _Booru.Connect(_Options.Server);

            _IDs = _Booru.Search(_Options.Search ?? string.Empty);
            int deleteCount = _IDs.Count - _Options.ImageLimit;

            for (int i = 0; i < deleteCount; i++)
            {
                _IDs.RemoveAt(R.Next(0, _IDs.Count));
            }

            _Cursor     = new Cursor(ScreensaverHelper.Texture2DFromBytes(GraphicsDevice, Properties.Resources.cursor), 1f);
            _Background = new BackgroundBooruTexture(W, H);

            _ImgManager = new ImageManager(R, GraphicsDevice, _Booru, _IDs, _Options.ImageSize, _Options.UseImages);
            _ImgManager.NewTextureLoaded += () =>
            {
                lock (_Textures)
                    if (_Textures.Count < _Options.ImageCount || _Options.ImageCount < 1)
                    {
                        AddNewFBT();
                    }
            };
            //_ImgManager.LoadingFinished += _Booru.Disconnect;

            _ImgManager.Start();
            AddNewFBT();
        }
示例#2
0
        public void SetBooruImage(GraphicsDevice GD, BooruImage Image)
        {
            Dispose();
            _Texture = ScreensaverHelper.Texture2DFromBytes(GD, Image.Bytes);
            float   num        = Math.Max(_Screen.X / _Texture.Width, _Screen.Y / _Texture.Height);
            Vector2 resultSize = new Vector2(_Texture.Width * num, _Texture.Height * num);

            _DrawRectangle = new Rectangle(
                0 - (int)((resultSize.X - _Screen.X) / 2 + 0.5),
                0 - (int)((resultSize.Y - _Screen.Y) / 2 + 0.5),
                (int)resultSize.X, (int)resultSize.Y);
        }