stb_image callbacks that operate on a sf::InputStream
| 65 | { |
| 66 | // stb_image callbacks that operate on a sf::InputStream |
| 67 | int read(void* user, char* data, int size) |
| 68 | { |
| 69 | auto& stream = *static_cast<sf::InputStream*>(user); |
| 70 | const std::optional count = stream.read(data, static_cast<std::size_t>(size)); |
| 71 | return count ? static_cast<int>(*count) : -1; |
| 72 | } |
| 73 | |
| 74 | void skip(void* user, int size) |
| 75 | { |