コード例 #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
        public GamePadReader()
            : base()
        {
            this.Window.Title = "Snowball GamePad Reader";

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

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

            this.contentLoader = new ContentLoader(this.Services);
        }