Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with cstring parameters #5

Open
planetis-m opened this issue Mar 6, 2022 · 4 comments
Open

Deal with cstring parameters #5

planetis-m opened this issue Mar 6, 2022 · 4 comments

Comments

@planetis-m
Copy link
Owner

No description provided.

@planetis-m
Copy link
Owner Author

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.

@actondev
Copy link

actondev commented May 29, 2023

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 :) ευχαριστώ!

@planetis-m
Copy link
Owner Author

planetis-m commented May 29, 2023

Γεια σου φιλε Χρήστο,

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.

@actondev
Copy link

Oh, was assuming I'd have to copy to obtain a null-terminated one. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants