Exemplo n.º 1
0
 public void Play()
 {
     Willnext = false; _cannext = true; _videoExist = false;
     BassAudio.Init();
     uniAudio.Open(Map.Audio);
     if (Playfx)
     {
         Initfx(); _fxpos = 0;
     }
     uniAudio.UpdateTimer.Tick += AVsync;
     _videoExist = false; _sbExist = false;
     if (Map.HaveVideo && Playvideo && File.Exists(Map.Video))
     {
         Initvideo();
     }
     if (Map.HaveSB && Playsb)
     {
         InitSB();
     }
     uniAudio.Play(Allvolume * Musicvolume);
 }
Exemplo n.º 2
0
        public Player(IntPtr shandle, Size ssize)
        {
            uniAudio      = new BassAudio();
            _showRect     = new Rectangle(0, 0, ssize.Width, ssize.Height);
            _screenCenter = new Vector2((float)ssize.Width / 2, (float)ssize.Height / 2);
            _sbScale      = Math.Min(_showRect.Width / 640f, _showRect.Height / 480f);
            SBtramsform   = Matrix.CreateTranslation(-320, -240, 0) * Matrix.CreateScale(_sbScale, _sbScale, 1) * Matrix.CreateTranslation(new Vector3(_screenCenter, 0));

            /* presentParams.DeviceWindowHandle=handle;
             * presentParams.IsFullScreen=false;
             * device = new GraphicsDevice();
             * device.Reset(presentParams, GraphicsAdapter.DefaultAdapter);*/
            var presentParams = new PresentationParameters
            {
                IsFullScreen     = false,
                SwapEffect       = SwapEffect.Discard,
                BackBufferHeight = Math.Max(_showRect.Height, 1),
                BackBufferWidth  = Math.Max(_showRect.Width, 1)
            };

            _handle        = shandle;
            device         = new GraphicsDevice(GraphicsAdapter.DefaultAdapter, DeviceType.Hardware, _handle, CreateOptions.MixedVertexProcessing, presentParams);
            AlphaSprite    = new SpriteBatch(device);
            AdditiveSprite = new SpriteBatch(device);
            fxplayer       = new BassAudio[MaxFxplayer];
            for (int i = 0; i < MaxFxplayer; i++)
            {
                fxplayer[i] = new BassAudio();
            }
            using (var s = new MemoryStream())
            {
                Resources.defaultBG.Save(s, ImageFormat.Png);
                s.Seek(0, SeekOrigin.Begin);
                _bgTexture = Texture2D.FromFile(device, s);
            }
        }