borodust / bodge-nuklear

Thin wrapper over Nuklear for Common Lisp
MIT License
61 stars 11 forks source link

nk_text_calculate_text_bounds is not available #5

Open WarrenWilkinson opened 3 years ago

WarrenWilkinson commented 3 years ago

Hi, I've been making good progress using your nuklear library, but I noticed the utility method nk_text_calculate_text_bounds is not currently exported. It also doesn't seem to be in your blob:

nm -g x86_64/libnuklear.so.bodged | grep calculate

(no results).

It's not mentioned in the src/spec/* files either and I'm not sure how those are populated.

Would it be possible to add this utility? It's very nice for computing how much space a string of text will take on screen.

borodust commented 3 years ago

It is probably in a newer version of Nuklear than the wrapped one. If you are using nanovg-based renderer, there's a function there to calculate text bounds. If you are using native Nuklear renderer, well, you are out of luck for a while.

I'm heavily focusing on :claw revamp (which this project also uses) atm, and gonna regenerate bindings at some point but not in the nearest future. I can bump nuklear version then. We can leave this issue open so I won't forget to do so.

WarrenWilkinson commented 3 years ago

No worries, In my case I can just multiply the number of characters by 7.0f0 and it works well enough. The function does seem to be in the version of nuklear.h that your reference as a git submodule though.

Your proposal sounds fine to me.

borodust commented 3 years ago

Hmm, in that case, i guess you are not using latest version then. You can get latest version from bodge testing dist:

(ql-dist:install-dist "http://bodge.borodust.org/dist/org.borodust.bodge.testing.txt")
(ql:update-all-dists)

Unfortunately, looks like this function ain't wrapped anyway, but at least it's mentioned in the blob.