@@ -361,7 +361,7 @@ <h2><a id="settings">Game Configuration</a></h2>
361361// useful to create your own mouse/touch handler
362362settings.tapEvents = true
363363
364- // set to `false` to disable the `iskeydown()` method
364+ // set to `false` to disable the built in keyboard functions
365365// useful to create your own keyboard handler
366366settings.keyboardEvents = true</ code > </ pre >
367367
@@ -454,7 +454,7 @@ <h2><a id="drawing">Functions for Drawing</a></h2>
454454// Sets the font family for texts
455455textfont(fontName: string): void
456456
457- // Sets the font size (default: 32 )
457+ // Sets the font size (default: 18 )
458458textsize(size: number): void
459459
460460/**
@@ -534,9 +534,15 @@ <h2><a id="sound">Functions for Sound</a></h2>
534534
535535 < h2 > < a id ="keyboard "> Functions for Keyboard</ a > </ h2 >
536536
537- < pre > < code class ="language-typescript "> // Checks if which key is currently pressed in your keyboard.
538- // note: you can check if any key is pressed using `iskeydown("any")`.
539- iskeydown(key: string): boolean</ code > </ pre >
537+ < pre > < code class ="language-typescript "> // Checks if any or which key is currently pressed in your keyboard.
538+ // example: iskeydown('space') // returns true if space bar is down
539+ // example: iskeydown() // returns true for any key
540+ iskeydown(key: string): boolean
541+
542+ // Checks if any or which key just got pressed in your keyboard.
543+ // example: iskeypressed('space') // returns true if space bar is pressed
544+ // example: iskeypressed() // returns true for any key
545+ iskeypressed(key: string): boolean</ code > </ pre >
540546
541547 < h2 > < a id ="math "> Functions for Math</ a > </ h2 >
542548
@@ -553,6 +559,11 @@ <h2><a id="math">Functions for Math</a></h2>
553559// Convert radians to degrees
554560rad2deg(n: number): number
555561
562+ // Returns the rounded value of an number to optional precision.
563+ // example: round(PI) return 3
564+ // example: round(PI, 3) return 3.142
565+ round(value: number, precision = 0): number
566+
556567// Constrains a number between `min` and `max`.
557568// example: clamp(50, 0, 100) return 50
558569// example: clamp(150, 0, 100) return 100
0 commit comments