Hi, I’m trying to learn OCaml and the SDL graphics library simultaneously at the moment, and I’m still struggling with how to eat my way through an OCaml API.
I’m using the Tsdl library, and it seems to have two types to work with SDL formats. Given an “Sdl.surface”, to use the function
Sdl.map_rgb: pixel_format -> uint8 -> uint8 -> uint8 -> uint32
I need its “pixel_format”. But I can only find a function
Sdl.get_surface_format_enum: surface -> Pixel.format_enum
I don’t see a way to get from the enum to the “pixel_format” type anywhere (except for allocating a new format and releasing it after, which works, but I only want to read the format, not allocate anything), but that might be because I’m not at all used to reading OCaml APIs.
Thanks for any input!