Beispiel #1
0
        /// <summary>
        /// Load all delegate functions
        /// </summary>
        public static void Load()
        {
            var    loader = Platform.GetDllLoader();
            string lib;

            //mac libraries
            if (!Environment.Is64BitProcess)
            {
                lib = "libSDL2.x86.dylib";
            }
            else
            {
                lib = "libSDL2.x64.dylib";
            }
            //linux + windows libraries (don't need a specific path)
            if (Platform.CurrentPlatform == Platforms.Linux)
            {
                lib = "libSDL2.so";
            }
            else if (Platform.CurrentPlatform == Platforms.Windows)
            {
                if (Environment.Is64BitProcess)
                {
                    lib = "SDL2.x64.dll";
                }
                else
                {
                    lib = "SDL2.x86.dll";
                }
            }
            var sdl2_ptr = loader.LoadLibrary(InteropHelper.ResolvePath(lib));

            InteropHelper.LoadFunctions(typeof(SDL2), (x) => loader.GetProcAddress(sdl2_ptr, x));
            Loaded = true;
        }
Beispiel #2
0
        public static void Load()
        {
            var    loader  = Platform.GetDllLoader();
            IntPtr library = IntPtr.Zero;
            string libPath = "";

            switch (Platform.CurrentPlatform)
            {
            case Platforms.Linux:
                libPath = "libfreetype.so.6";
                break;

            case Platforms.Windows:
                if (Environment.Is64BitProcess)
                {
                    libPath = "freetype6.x64.dll";
                }
                else
                {
                    libPath = "freetype6.x86.dll";
                }
                break;

            case Platforms.OSX:
                if (Environment.Is64BitProcess)
                {
                    libPath = "libfreetype.6.x64.dylib";
                }
                else
                {
                    libPath = "libfreetype.6.x86.dylib";
                }
                break;
            }
            library = loader.LoadLibrary(InteropHelper.ResolvePath(libPath));
            InteropHelper.LoadFunctions(typeof(FT), (x) => loader.GetProcAddress(library, x));
            Loaded = true;
        }