January 2018
Beginner to intermediate
454 pages
10h 8m
English
To display these pieces of information, we'll need to use fonts. No additional external dependencies are required, however, we'll need to use a feature, so we need to update our Cargo.toml:
[features]
default = ["sdl2/ttf"]
By default, the sdl2 crate doesn't provide the ttf module, you need to enable it by adding the ttf feature to the compilation process. That's what we did by saying to cargo: by default, I want the ttf feature of the sdl2 crate enabled. You can try with and without it to see the difference, after adding this new context initialization:
let ttf_context = sdl2::ttf::init().expect("SDL TTF initialization failed");
Read now
Unlock full access