GetService() 공개 메소드

public GetService ( Type type ) : object
type Type
리턴 object
예제 #1
0
    public void TestServiceConstructor() {
      var services = new GameServiceContainer();

      using (var manager = new InputManager(services)) {
        Assert.IsNotNull(services.GetService(typeof(IInputService)));
      }

      Assert.IsNull(services.GetService(typeof(IInputService)));
    }
예제 #2
0
파일: Grid.cs 프로젝트: HaKDMoDz/armadillo
        public static Grid FromBitmap(GameServiceContainer services, string bitmapName)
        {
            var texture = ((ContentManager)services.GetService(typeof(ContentManager))).Load<Texture2D>(bitmapName);
            var grid = new Grid(texture.Width, texture.Height);

            for (var i = 0; i < grid.Size.Width; i++)
            {
                for (var j = 0; j < grid.Size.Height; j++)
                {
                    var c = new Color[1];
                    texture.GetData(0, new Rectangle(i, j, 1, 1), c, 0, 1);
                    grid.Weight[i, j] = (byte)((c[0].R + c[0].G + c[0].B)/3);
                }
            }

            return grid;
        }