forked from mahsu/MariOCaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewport.mli
25 lines (18 loc) · 844 Bytes
/
viewport.mli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
open Actors
type viewport = {
pos: Actors.xy; (* Absolute position of viewport relative to map *)
v_dim: Actors.xy; (* Dimensions of viewport *)
m_dim: Actors.xy; (* Dimensions of map *)
}
(* Makes a new viewport of viewport dimensions and map dimensions*)
val make : float*float -> float*float -> viewport
(* Calculates the viewport origin point *)
val calc_viewport_point : float -> float -> float -> float
(* Whether the supplied position is outside of the viewport *)
val in_viewport : viewport -> Actors.xy -> bool
(* Whether the supplied position is below the viewport *)
val out_of_viewport_below : viewport -> float -> bool
(* Converts absolute coordinates to viewport coodinates *)
val coord_to_viewport : viewport -> Actors.xy -> Actors.xy
(* Update the viewport *)
val update : viewport -> Actors.xy -> viewport