Пример #1
0
        public override void Setup(GraphicsDevice graphics, AudioDevice audio, Window window)
        {
            this.cursorSmile = new Smile()
            {
                colour = Colour.White
            };

            this.rng    = new Random();
            this.smiles = new List <Smile>();

            this.viewportSize = graphics.Viewport.Size;

            this.listener             = audio;
            this.listener.Orientation = Orientation.Ortho;
            this.scream    = audio.LoadSound(GetEmbeddedStream("RendererTest.scream.wav"), AudioFormat.Wav);
            this.placement = audio.LoadSound(GetEmbeddedStream("RendererTest.retrojump.ogg"), AudioFormat.OggVorbis);

            this.screamer               = audio.CreateSpeaker(this.scream);
            this.screamer.Loop          = true;
            this.screamer.MaxDistance   = 400;
            this.screamer.MinDistance   = 100f;
            this.screamer.DistanceScale = 0.2f;
            this.screamer.Volume        = 0.6f;

            this.placementEmitter          = audio.CreateSpeaker(this.placement);
            this.placementEmitter.Loop     = false;
            this.placementEmitter.Position = null;
            this.placementEmitter.Volume   = 1f;

            this.camera = new OrthoCamera(this.viewportSize);

            this.spriteRenderer = graphics.CreateSpriteRenderer(this.camera, SpriteRenderer.DrawOrder.Reversed);

            this.smiley = graphics.CreateTexture2D(GetEmbeddedStream("RendererTest.smiley.png"), ImageFormat.PNG);

            graphics.DefaultDrawState = new DrawState()
            {
                Blend     = BlendMode.Alpha,
                DepthTest = DepthTestMode.None
            };

            window.OnMouseButtonPressed += this.MousePressed;
            window.OnMouseMoved         += this.MouseMoved;
        }