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
Text Rendering Support via SDL2_ttf #307
Comments
I want this. |
I'd love to try implementing this as a collaborator, but I don't really know where to start in regards to extending Piston. I think that I should add rust-sdl2_ttf as a submodule then begin writing the wrapper class in Piston, yes? Or would including it in the project be enough? Let me know if you'd like me to try and what approach I should start with. |
We use symlinks. You can set them up with I added you as collaborator. Fork the rust-sdl2_ttf repository and build it locally. When you have written the wrapper class we will add it as a submodule in Piston-Workspace and modify the scripts to set up the symlinks. |
I've begin work on the wrapper, and you can see my current progress here. Let me know if I'm on the right track. Currently I'm stuck because I'm trying to implement the generic backend and write the SDL2 implementation from that (like Coeuvre did for the AudioBackEnd), but unlike for Audio, TextBackEnd needs to be passed a This is because Therefore, TextBackEnd uses |
Also, am I converting from |
Just make it work and we'll figure out this later. https://github.com/Indiv0/piston/blob/add-ttf/src/game_window_sdl2.rs#L18 You can take a |
Perhaps you can render to a SDL2 surface without using the Piston graphics API? This wouldn't be too different from how 'hgl-rs' renders OpenGL without using Rust-Graphics. |
We could try adding text support to Rust-Graphics, but that requires a bit of planning. http://www.piston.rs/docs/rust-sdl2/sdl2/render/type.TextureAccess.html
|
Perhaps you could write an example https://github.com/Indiv0/piston/tree/master/examples
|
Or, just add an example drawing some text without using Rust-Graphics, so we can add the dependency to Piston-Workspace and take it step by step from there. |
It might happen that we need to do some changes to Rust-Graphics or the OpenGL back-end to make this work correctly. We probably need to split this issue into several ones and discuss the details closer. |
Ok so what's the next step for me then? Because I could try rendering text without Rust-Graphics, but I don't have much OpenGL experience. Additionally, I don't think OpenGL supports TTF rendering. Maybe use something like FTGL? |
I've bound FreeType2 to Rust, and integrated with Piston. |
Since we can use freetype-rs I'm closing this. |
Added `_args` methods to use with if let
Are there any plans to support TrueType font rendering in Piston via sdl2_ttf?
Current text implementations involve either drawing textures or using polygons, both of which seem inefficient and are definitely overcomplicated.
The text was updated successfully, but these errors were encountered: