naylib
naylib copied to clipboard
Deal with cstring parameters
Left: initWindow, setWindowTitle, setClipboardText, getShaderLocation, getShaderLocationAttrib, takeScreenshot, traceLog, setGamepadMappings, loadImageAnim, exportImage, exportImageAsCode, genImageText, imageText, imageDrawText, exportFontAsCode, drawText, measureText, exportMesh, exportWave, exportWaveAsCode. Needs to be done automatically else don't do it at all.
What is the idea for cstrings? I just found myself editing the drawTextEx for raylib to pass the size, so that (from nim side) you can use openArray[char], and call the raylib api by converting it to cstring (casting the openArray's [0].addr) and passing as well its .len.
edit: FYI I opened this ticket in raylib PS: thank you so much for naylib :) ευχαριστώ!
Γεια σου φιλε Χρήστο,
I agree that calling TextLength when we are already know the size is not optimal, and it's also problematic for strings that contain \0 before the end. But nim's string type has a (non-retrievable) ending \0 for compatibility reasons with C. If you need to use another string type, then you did good to open a ticket in raylib. But I don't have high hopes that Ray will consider it, although it makes a lot of sense for other languages as well.
Oh, was assuming I'd have to copy to obtain a null-terminated one. Thanks!