@@ -20,7 +20,7 @@ let render = (sprite, (posx, posy)) => {
2020 let sx = sx +. float_of_int (sprite .frame .contents ) *. sw
2121 /* print_endline (string_of_int !(sprite.frame)); */
2222 /* 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 ))
2424}
2525
2626/* Draws two background images, which needs to be done because of the
@@ -37,7 +37,7 @@ let clear_canvas = canvas => {
3737 let context = Dom_html .canvasRenderingContext2DToJsObj (canvas ["getContext" ]("2d" ))
3838 let cwidth = float_of_int (canvas ["width" ])
3939 let cheight = float_of_int (canvas ["height" ])
40- \ "@@" ( ignore , context ["clearRect" ](0 ., 0 ., cwidth , cheight ))
40+ ignore ( context ["clearRect" ](0 ., 0 ., cwidth , cheight ))
4141}
4242
4343/* Displays the text for score and coins. */
@@ -46,42 +46,41 @@ let hud = (canvas, score, coins) => {
4646 let coin_string = string_of_int (coins )
4747 let canvas = Dom_html .canvasElementToJsObj (canvas )
4848 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 (
5251 context ["fillText" ]("Score: " ++ score_string , float_of_int (canvas ["width" ]) -. 140 ., 18 .),
5352 )
54- \ "@@" ( ignore , context ["fillText" ]("Coins: " ++ coin_string , 120 ., 18 .))
53+ ignore ( context ["fillText" ]("Coins: " ++ coin_string , 120 ., 18 .))
5554}
5655
5756/* Displays the fps. */
5857let fps = (canvas , fps_val ) => {
5958 let fps_str = int_of_float (fps_val ) |> string_of_int
6059 let canvas = Dom_html .canvasElementToJsObj (canvas )
6160 let context = Dom_html .canvasRenderingContext2DToJsObj (canvas ["getContext" ]("2d" ))
62- \ "@@" ( ignore , context ["fillText" ](fps_str , 10 ., 18 .))
61+ ignore ( context ["fillText" ](fps_str , 10 ., 18 .))
6362}
6463
6564/* game_win displays a black screen when you finish a game. */
6665let game_win = ctx => {
6766 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 .))
7473 failwith ("Game over." )
7574}
7675
7776/* gave_loss displays a black screen stating a loss to finish that level play. */
7877let game_loss = ctx => {
7978 let ctx = Dom_html .canvasRenderingContext2DToJsObj (ctx )
80- \ "@@" ( ignore , ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
79+ ignore ( ctx ["rect" ](0 ., 0 ., 512 ., 512 .))
8180 ctx ["fillStyle" ] = "black"
82- \ "@@" ( ignore , ctx ["fill" ]())
81+ ignore ( ctx ["fill" ]())
8382 ctx ["fillStyle" ] = "white"
8483 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 .))
8685 failwith ("Game over." )
8786}
0 commit comments