package stk

  1. Overview
  2. Docs
SDL-based GUI toolkit

Install

Dune Dependency

Authors

Maintainers

Sources

ocaml-stk-0.1.0.tar.bz2
md5=c334ffabde8b710f1eba6699db0f601a
sha512=7978e3f10bc196ee6177ded9ae0313a5ba65e1a74e501fbecbe5ebc216ca6ee7117deaff5bc4c414083a4a55851a81e5dedaa8d0a880ad72689b3f56f3b064f5

doc/stk/Stk/G/index.html

Module Stk.GSource

Geometry.

This module is used to represent and compute widget coordinates.

Sourcetype t = {
  1. x : int;
  2. y : int;
  3. w : int;
    (*

    width

    *)
  4. h : int;
    (*

    height

    *)
}

A geometry is rectangle. x and y are coordinates of top-left corner.

Sourceval to_string : t -> string
Sourceval pp : Format.formatter -> t -> unit
Sourceval create : x:int -> y:int -> w:int -> h:int -> t

Convenient function to create a t.

Sourceval seg_inter : int -> int -> int -> int -> (int * int) option

seg_inter x1 w1 x2 w2 returns the intersection segment (left..right) between segments (x1..(x1+w1)) and (x2..(x2+w2)), if any.

Sourceval inter : t -> t -> t option

Intersection between two rectangles, if any.

Sourceval union : t -> t -> t

Union of two rectangles, i.e. returns the rectangle containing both.

Sourceval zero : t

Zero geometry, all fields set to 0.

Sourceval is_zero : t -> bool
Sourceval inside : x:int -> y:int -> t -> bool

inside ~x ~y g returns true is point (x, y) is inside g.

Sourceval translate : ?x:int -> ?y:int -> t -> t

translate ~x ~y g returns a new geometry, adding x (resp. y) to g.x (resp. g.y) if specified.

Sourceval enlarge : ?w:int -> ?h:int -> t -> t

enlarge ~w ~h g returns a new geometry whose width (resp. height) is increased by 2 * w (resp. 2 * h). g.x (resp. g.y) is translated by -w (resp. -h) so that the final geometry remains centered with report to the original one.

Sourceval to_rect : t -> Tsdl.Sdl.rect

to_rect g creates a Tsdl.Sdl.rect from g.

Sourceval of_rect : Tsdl.Sdl.rect -> t

of_rect r creates a geometry t from a Tsdl.Sdl.rect.

Sourceval has_intersect : t -> t -> bool

has_intersect g1 g2 returns true if intersection g1 g2 <> None.

Sourceval remove_border : t -> int Props.trbl -> t

remove_border g borders returns a new geometry by removing borders from g. It is ensured that the returned geometry has non-negative width and height.

OCaml

Innovation. Community. Security.