-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathg-js.ml.x
28 lines (23 loc) · 858 Bytes
/
g-js.ml.x
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
(** DO NOT EDIT THIS FILE *)
(** This file is a "wrapper" for Graphics
- Graphics_js: the version of the library needed when we build our GUI
programs to run in the web browser as a Javascript program. *)
(* This flag records whether the program is running in Javascript or native
mode. It is needed in Gctx to configure parameters related to
creating a new GUI window and setting the fonts (since those details differ
between native and web mode. *)
let js_mode = true
;; include Graphics_js
open Js_of_ocaml
open Js_of_ocaml_lwt
module Html = Dom_html
(* Opens the ocaml JS graphics window *)
let open_graphics' () =
let doc = Html.document in
let c = Html.createCanvas doc in
c##.width := 640;
c##.height := 480;
Dom.appendChild doc##.body c;
Graphics_js.open_canvas c;
Graphics_js.resize_window 640 480;
clear_graph ()