Closed aktau closed 11 years ago
Thank you! I'll close the other issue.
Alright, no problem!
It seems some older commits I made were made again in this branch, so some commits are double now. I think/hope this leaves the source code intact, though the history is a tad bit messier, which is a shame. It seems my rebase-fu is still weak. (this "cleaning up a pull request" thing is actually the first time I seriously used rebase). Didn't know it would change commits that were even older than the ones I left out.
Looks like things worked out just fine :) My gcc does not seem to support c11, so I had to tune it down to c99 on my makefile.
Just heads up, I'm planning to change the API a bit. I have been testing different coding styles and arrangements recently, and currently I'm leaning towards the style in https://github.com/memononen/nanosvg Also, I have been using the lib in a project and I'm going fiddle a bit with the rendering abstraction too. The formatting will be the more drastic change.
I'm switching over to premake too to make the example more widely available. I'd love to keep the analyzer setup around (even I don't seem to have it installed atm), do you know if it can be made to work with premake? I could leave it as a makefile too, or maybe a shell script?
There's a cool project called mio that also features a font stash which renders with stb_truetype
. It features an immediate-mode API, which is in general nice to use. I don't agree with all stylistic and design decisions nor the implications of such an API, but it's pretty easy to work with. And, what I guess is most important for mio, it's unbelievably easy to bind to a scripting engine such as lua. Which is what motivated the author to design the API the way he did, I'm sure. There's also some things missing, like currently the text routines don't return the advance value so it's difficult to place multi-styles text next to each other. I guess the best thing about is, is that it doesn't use deprecated immediate mode functionality, which would fit in better in modern engines I suppose (including mine, which is why I'm making a Frankenstein).
As for premake, I've never used it, so I can't tell you anything about that. It would be quite easy to "port" the make analyze target to a shell-script, for sure. I really like lua, but for now make serves me needs quite well (including the MingW version on windows). I copy the code as a dependency anyway so it's no big deal, I can keep the Makefile on the side.
About the new style and formatting: go for it, I'll see it when you get there.
mio is cute! :) I like api. I have tried to keep my recent APIs as state free as possible, though. I have favoured immediate mode (or html canvas) type of APIs in the past. I don't like the current style struct at all. I had crazy idea of using chaining, to set the style params, but it's just weird, i.e: drawText(100,100,"foo")->color(255,0,0,255)->size(10.0f); Or the equally exotic var args version: drawText(100,100,"foo", color(255,0,0,255), size(10.0f)); Or slow ass let's-put-everything-in-the-string: drawText(100,100,"[color=red][size=10]foo"); The last one is also cumbersome because strings are annoying to handle in C. I think I'll give the mio API a go, I like how they pass the matrix as first param too. Makes the whole thing more usable in 3D context too.
The same set of fixes, without any changes to stock stb_truetype