Module Video

module Video: sig  end
Low level video routines

type t = {
   mutable surf : Sdlvideo.surface;
   mutable last_mode : int;
   mutable provide : unit -> Sdlvideo.surface;
   mutable cam_pos : int * int;
   mutable rect : Sdlvideo.rect;
   mutable vmem : bool;
TODO Type t is a type which represents an image for the actual mode or an. Atutomagically updated on videomode change.
val create_surface : ?alpha:bool -> int * int -> Sdlvideo.surface
create_surface (w, h) returns an initially undefined surface with dimensions (w, h)
val load_image : string -> t
Loads a given image of any type supported by SDLimage. You should consider using Video.optimize on the loaded image to make blitting efficient. If the display won't be initialized (eg. on server side) it doesn't matter.
val duplicate_surface : Sdlvideo.surface -> Sdlvideo.surface
duplicate_surface surf creates a copy of surf. Since drawing on surfaces destroys them if you want to do so and keep the original image use this function
val create_context : int -> int -> int -> int -> int * int -> t
create_context x y w h (cam_x, cam_y) creates a context at (x, y) with size (w, h) with initial camera position set to (cam_x, cam_y)
val get_cam_pos : ?on:t -> unit -> int * int
get_cam_pos context () returns the coordinates of the world shown by upper left corner of context.
val set_cam_pos : ?on:t -> int * int -> unit
set_cam_pos context (x, y) sets the coordinates of the world shown by upper left corner of context to (x, y).
val set_cam_pos_center : ?on:t -> int * int -> unit
set_cam_pos_center context (x, y) sets the coordinates of the world displayed in center point of context to (x, y).
val move_cam : ?on:t -> int * int -> unit
move_cam context (x, y) adds (x, y) to the coordinates of world displayed in context.
val blit : t ->
?src_rect:Sdlvideo.rect ->
?on:t -> ?surf:Sdlvideo.surface -> int -> int -> unit
blit surf src_rect context x y Copies src_rect from surf to x, y on context. It clips to the context.
val fill : ?on:t ->
?surf:Sdlvideo.surface ->
?rect:Sdlvideo.rect -> ?alpha:int -> Sdlvideo.color -> unit
fill context rect color Fills the given rect on the given context. It clips to the context.
val line : ?on:t ->
?surf:Sdlvideo.surface ->
int * int -> int * int -> ?alpha:int -> Sdlvideo.color -> unit
line surf x1 y1 x2 y2 color draws a line from (x1, y1) to (x2, y2) using color. It is optimized if line is horizontal or vertical.
val point : ?on:t -> int * int -> ?alpha:int -> Sdlvideo.color -> unit
val ellipse : ?on:t ->
int * int -> int * int -> bool -> ?alpha:int -> Sdlvideo.color -> unit
ellipse ?on (x, y) (rx, ry) fill color draws an optionally filled ellipse at (x, y) with radius (rx, ry) using color.
Raises Invalid_argument if rx or ry is not greater than zero.
val get_resolution : unit -> int * int
get_resolution () returns the current video resolution
val set_mode : bool -> int * int -> int -> unit
set_mode full_screen (width, height) bpp
val flip : unit -> unit
Flips the front and back buffers
val quit : unit -> unit
quit deinitializes video mode. quit should be always called, even if an exception occurs.
val color_surface : Sdlvideo.surface ->
(Sdlvideo.color * int -> Sdlvideo.color * int) -> Sdlvideo.surface
val describe_surface : Sdlvideo.surface -> string
describe_surface surf returns a string containing all information about surf
val provide_image : (unit -> Sdlvideo.surface) -> t
provide_image provide_fun Creates a Video.t image that will refresh itself using the given fun when needed (video mode change).
val optimize : ?alpha:bool -> t -> t
val color_key : ?ck:Sdlvideo.color -> t -> t
val update_image : t -> unit
val image_size : t -> int * int
image_size image returns the dimensions of image
val color_image : t -> (Sdlvideo.color * int -> Sdlvideo.color * int) -> t
val tile_fill : ?on:t ->
?surf:Sdlvideo.surface -> t -> int * int -> int * int -> unit
val shade_tile : t
val shade : ?on:t -> ?surf:Sdlvideo.surface -> int * int -> int * int -> unit