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

            font = Content.Load <SpriteFont>("arial");

            texX     = Content.Load <Texture2D>("X");
            texO     = Content.Load <Texture2D>("O");
            texReset = Content.Load <Texture2D>("Reset");

            lineTex = new Texture2D(GraphicsDevice, 1, 1);
            lineTex.SetData <Color>(
                new Color[] { Color.Black }
                );

            textures = new Dictionary <string, Texture2D>()
            {
                { "X", texX },
                { "O", texO },
                { "Reset", texReset },
                { "Line", lineTex }
            };

            ComponentLocator.RegisterTextures(textures);
            ComponentLocator.RegisterSpriteFonts(new Dictionary <string, SpriteFont>()
            {
                { "arial", font }
            });
            ComponentLocator.RegisterGraphicsDeviceManager(graphics);

            stateManager.ChangeState(new MainMenu(stateManager));
        }