示例#1
0
        public void GetGUID()
        {
            ControllerType guid = GamePad.GetGUIDEXT(PlayerIndex.One).GetControllerTypeFromGUID();

            Console.WriteLine($"1: {guid:X}, {guid}, {guid.GetControllerName()}");
            guid = GamePad.GetGUIDEXT(PlayerIndex.Two).GetControllerTypeFromGUID();
            Console.WriteLine($"2: {guid:X}, {guid}, {guid.GetControllerName()}");
            guid = GamePad.GetGUIDEXT(PlayerIndex.Three).GetControllerTypeFromGUID();
            Console.WriteLine($"3: {guid:X}, {guid}, {guid.GetControllerName()}");
            guid = GamePad.GetGUIDEXT(PlayerIndex.Four).GetControllerTypeFromGUID();
            Console.WriteLine($"4: {guid:X}, {guid}, {guid.GetControllerName()}");
            //Console.WriteLine("----------");
            //SDL2.SDL.SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");

            /*for (int i = 0; i < SDL2.SDL.SDL_NumJoysticks(); i++)
             * {
             *      Console.WriteLine($"{i}: {SDL2.SDL.SDL_IsGameController(i)}");
             *      Console.WriteLine($"{SDL2.SDL.SDL_GetError()}");
             *      Console.WriteLine($"{SDL2.SDL.SDL_GameControllerNameForIndex(i)}");
             *      IntPtr controller = SDL2.SDL.SDL_GameControllerOpen(i);
             *      if (controller == IntPtr.Zero)
             *      {
             *              Console.WriteLine($"Could not open game controller {i}: {SDL2.SDL.SDL_GetError()}");
             *      }
             *
             *      Console.WriteLine($"MappingForGUID: {SDL2.SDL.SDL_GameControllerMappingForGUID(new Guid("3b0704a1000000000000504944564944"))}");
             *      Console.WriteLine($"SDL_GetError(): {SDL2.SDL.SDL_GetError()}");
             * }*/
        }