@@ -361,7 +361,7 @@ <h2><a id="settings">Game Configuration</a></h2>
361
361
// useful to create your own mouse/touch handler
362
362
settings.tapEvents = true
363
363
364
- // set to `false` to disable the `iskeydown()` method
364
+ // set to `false` to disable the built in keyboard functions
365
365
// useful to create your own keyboard handler
366
366
settings.keyboardEvents = true</ code > </ pre >
367
367
@@ -454,7 +454,7 @@ <h2><a id="drawing">Functions for Drawing</a></h2>
454
454
// Sets the font family for texts
455
455
textfont(fontName: string): void
456
456
457
- // Sets the font size (default: 32 )
457
+ // Sets the font size (default: 18 )
458
458
textsize(size: number): void
459
459
460
460
/**
@@ -534,9 +534,15 @@ <h2><a id="sound">Functions for Sound</a></h2>
534
534
535
535
< h2 > < a id ="keyboard "> Functions for Keyboard</ a > </ h2 >
536
536
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 >
540
546
541
547
< h2 > < a id ="math "> Functions for Math</ a > </ h2 >
542
548
@@ -553,6 +559,11 @@ <h2><a id="math">Functions for Math</a></h2>
553
559
// Convert radians to degrees
554
560
rad2deg(n: number): number
555
561
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
+
556
567
// Constrains a number between `min` and `max`.
557
568
// example: clamp(50, 0, 100) return 50
558
569
// example: clamp(150, 0, 100) return 100
0 commit comments