chrisdill / raylib-cs

C# bindings for raylib, a simple and easy-to-use library to learn videogames programming

Home Page:http://www.raylib.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

feature request - LoadFontEx / LoadFont

guillaC opened this issue · comments

commented

image

Unfortunately, the signature doesn't make it straightforward to use the LoadFontEx method, unlike the LoadFont method which accepts a string for the file path.

in the meantime, I'm doing:

    public static Raylib_cs.Font LoadFontEx(string fileName, int fontSize)
    {
        byte[] cheminBytes = System.Text.Encoding.ASCII.GetBytes(fileName);

        unsafe
        {
            fixed (byte* pChemin = cheminBytes)
            {
                return Raylib.LoadFontEx((sbyte*)pChemin, fontSize, null, 0);
            }
        }
    }

There is an existing utility method for LoadFontEx here. Look at the FontLoading example to see how it is used.