-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmoveimage.ml
More file actions
30 lines (22 loc) · 768 Bytes
/
moveimage.ml
File metadata and controls
30 lines (22 loc) · 768 Bytes
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
26
27
28
29
(*
* "THE BEER-WARE LICENSE" (Revision 42):
* <sebastian.benque@gmail.com> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return Sebastian Benque
*)
open Batteries
open Imagetypes
(* open Helpers *)
(* TODO: y/x-step should be dependent on imagesize *)
let xstep state = 50
let ystep state = 50
let move_vert op state =
let (x,y) = state.offset in
{state with offset = (x,op y (ystep state))}
let move_hor op state =
let (x,y) = state.offset in
{state with offset = (op x (xstep state),y)}
let move_up = move_vert (-)
let move_down = move_vert (+)
let move_right = move_hor (+)
let move_left = move_hor (-)