コード例 #1
0
ファイル: DemoGame.cs プロジェクト: smack0007/Snowball_v1
        public DemoGame()
            : base()
        {
            this.Window.Title = "Snowball Demo Game";

            this.graphicsDevice = new GraphicsDevice(this.Window);
            this.Services.AddService(typeof(IGraphicsDevice), this.graphicsDevice);

            this.keyboard = new Keyboard();
            this.Services.AddService(typeof(IKeyboard), this.keyboard);

            this.mouse = new Mouse(this.Window);
            this.Services.AddService(typeof(IMouse), this.mouse);

            this.gamePad = new GamePad(GamePadIndex.One);

            this.soundDevice = new SoundDevice();
            this.Services.AddService(typeof(ISoundDevice), this.soundDevice);

            this.starfield = new Starfield(this.graphicsDevice);

            this.ship = new Ship(this.graphicsDevice, this.keyboard, this.gamePad);

            this.console = new GameConsole(this.Window, this.graphicsDevice);
            this.console.InputEnabled = true;
            this.console.InputColor = Color.Blue;
            this.console.InputReceived += (s, e) => { this.console.WriteLine(e.Text); };
            this.console.IsVisibleChanged += (s, e) => { this.console.WriteLine("Console toggled."); };

            this.contentManager = new ContentManager<DemoGameContent>(this.Services);

            this.RegisterContent();
        }
コード例 #2
0
ファイル: SoundEffect.cs プロジェクト: smack0007/Snowball_v1
        public static SoundEffect FromFile(SoundDevice soundDevice, string fileName)
        {
            if (!File.Exists(fileName))
                throw new FileNotFoundException("Unable to load file \"" + fileName + "\".");

            using(Stream stream = File.OpenRead(fileName))
                return FromStream(soundDevice, stream);
        }
コード例 #3
0
ファイル: SoundEffect.cs プロジェクト: smack0007/Snowball_v1
 public static SoundEffect FromStream(SoundDevice soundDevice, Stream stream)
 {
     SharpDX.Multimedia.SoundStream waveStream = new SharpDX.Multimedia.SoundStream(stream);
     return new SoundEffect(soundDevice.InternalDevice, waveStream);
 }