@@ -20,7 +20,7 @@ let render = (sprite, (posx, posy)) => {
20
20
let sx = sx +. float_of_int (sprite .frame .contents ) *. sw
21
21
/* print_endline (string_of_int !(sprite.frame)); */
22
22
/* context##clearRect(0.,0.,sw, sh); */
23
- \ "@@" ( ignore , context ["drawImage" ](sprite .img , sx , sy , sw , sh , dx , dy , dw , dh ))
23
+ ignore ( context ["drawImage" ](sprite .img , sx , sy , sw , sh , dx , dy , dw , dh ))
24
24
}
25
25
26
26
/* Draws two background images, which needs to be done because of the
@@ -37,7 +37,7 @@ let clear_canvas = canvas => {
37
37
let context = Dom_html .canvasRenderingContext2DToJsObj (canvas ["getContext" ]("2d" ))
38
38
let cwidth = float_of_int (canvas ["width" ])
39
39
let cheight = float_of_int (canvas ["height" ])
40
- \ "@@" ( ignore , context ["clearRect" ](0 ., 0 ., cwidth , cheight ))
40
+ ignore ( context ["clearRect" ](0 ., 0 ., cwidth , cheight ))
41
41
}
42
42
43
43
/* Displays the text for score and coins. */
@@ -46,42 +46,41 @@ let hud = (canvas, score, coins) => {
46
46
let coin_string = string_of_int (coins )
47
47
let canvas = Dom_html .canvasElementToJsObj (canvas )
48
48
let context = Dom_html .canvasRenderingContext2DToJsObj (canvas ["getContext" ]("2d" ))
49
- \"@@" (ignore , context ["font" ] = "10px 'Press Start 2P'" )
50
- \"@@" (
51
- ignore ,
49
+ ignore (context ["font" ] = "10px 'Press Start 2P'" )
50
+ ignore (
52
51
context ["fillText" ]("Score: " ++ score_string , float_of_int (canvas ["width" ]) -. 140 ., 18 .),
53
52
)
54
- \ "@@" ( ignore , context ["fillText" ]("Coins: " ++ coin_string , 120 ., 18 .))
53
+ ignore ( context ["fillText" ]("Coins: " ++ coin_string , 120 ., 18 .))
55
54
}
56
55
57
56
/* Displays the fps. */
58
57
let fps = (canvas , fps_val ) => {
59
58
let fps_str = int_of_float (fps_val ) |> string_of_int
60
59
let canvas = Dom_html .canvasElementToJsObj (canvas )
61
60
let context = Dom_html .canvasRenderingContext2DToJsObj (canvas ["getContext" ]("2d" ))
62
- \ "@@" ( ignore , context ["fillText" ](fps_str , 10 ., 18 .))
61
+ ignore ( context ["fillText" ](fps_str , 10 ., 18 .))
63
62
}
64
63
65
64
/* game_win displays a black screen when you finish a game. */
66
65
let game_win = ctx => {
67
66
let ctx = Dom_html .canvasRenderingContext2DToJsObj (ctx )
68
- \ "@@" ( ignore , ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
69
- \ "@@" ( ignore , ctx ["fillStyle" ] = "black" )
70
- \ "@@" ( ignore , ctx ["fill" ]())
71
- \ "@@" ( ignore , ctx ["fillStyle" ] = "white" )
72
- \ "@@" ( ignore , ctx ["font" ] = "20px 'Press Start 2P'" )
73
- \ "@@" ( ignore , ctx ["fillText" ]("You win!" , 180 ., 128 .))
67
+ ignore ( ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
68
+ ignore ( ctx ["fillStyle" ] = "black" )
69
+ ignore ( ctx ["fill" ]())
70
+ ignore ( ctx ["fillStyle" ] = "white" )
71
+ ignore ( ctx ["font" ] = "20px 'Press Start 2P'" )
72
+ ignore ( ctx ["fillText" ]("You win!" , 180 ., 128 .))
74
73
failwith ("Game over." )
75
74
}
76
75
77
76
/* gave_loss displays a black screen stating a loss to finish that level play. */
78
77
let game_loss = ctx => {
79
78
let ctx = Dom_html .canvasRenderingContext2DToJsObj (ctx )
80
- \ "@@" ( ignore , ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
79
+ ignore ( ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
81
80
ctx ["fillStyle" ] = "black"
82
- \ "@@" ( ignore , ctx ["fill" ]())
81
+ ignore ( ctx ["fill" ]())
83
82
ctx ["fillStyle" ] = "white"
84
83
ctx ["font" ] = "20px 'Press Start 2P'"
85
- \ "@@" ( ignore , ctx ["fillText" ]("GAME OVER. You lose!" , 60 ., 128 .))
84
+ ignore ( ctx ["fillText" ]("GAME OVER. You lose!" , 60 ., 128 .))
86
85
failwith ("Game over." )
87
86
}
0 commit comments