OggFile(Gosu::Reader reader) : reader_(buffer_.frontReader()) { buffer_.resize(reader.resource().size() - reader.position()); reader.read(buffer_.data(), buffer_.size()); setup(); }
void FI(loadImageFile)(Bitmap& bitmap, Gosu::Reader input) { // Read all available input std::vector<BYTE> data(input.resource().size() - input.position()); input.read(&data[0], data.size()); FIMEMORY* fim = FreeImage_OpenMemory(&data[0], data.size()); FREE_IMAGE_FORMAT fif = FreeImage_GetFileTypeFromMemory(fim); FIBITMAP* fib = FreeImage_LoadFromMemory(fif, fim, GOSU_FIFLAGS); checkForFreeImageErrors(fib != 0); fibToBitmap(bitmap, fib, fif); }