@@ -245,6 +245,12 @@ function Update()
245245 if isSpacePressed then
246246 Graphics .drawRect (Vec .V2 (0 , 0 ), Vec .V2 (0.1 , 0.2 ), Vec4 .RED )
247247 end
248+
249+ -- If you need to perform something only once when a key is pressed, you can use `isKeyJustPressed`
250+ if Io .isKeyJustPressed (" r" ) then
251+ Debug .print (" R was just pressed!" )
252+ end
253+
248254 -- Print pressed keys
249255 Debug .fprint (Io .getKeysDown ())
250256 -- Print which mouse buttons are pressed
@@ -356,13 +362,13 @@ local Loader = require("@vectarine/loader")
356362local Vec = require (" @vectarine/vec" )
357363local Coord = require (" @vectarine/coord" )
358364
359- local imageResource = Loader .loadImage (" textures/my_image.png" )
365+ local myImage = Loader .loadImage (" textures/my_image.png" )
360366
361367function Update ()
362- if imageResource :isReady () then
368+ if myImage :isReady () then
363369 -- Draw the image at the center of the screen with size 200x200 pixels
364370 local size = Coord .pxDelta (Vec .V2 (200 , 200 ))
365- imageResource . draw (Coord .gl (Vec .ZERO2 ) - size :scale (0.5 ), size )
371+ myImage : draw (Coord .gl (Vec .ZERO2 ) - size :scale (0.5 ), size )
366372 end
367373end
368374```
@@ -384,7 +390,7 @@ local Loader = require("@vectarine/loader")
384390local Text = require (" @vectarine/text" )
385391local Vec = require (" @vectarine/vec" )
386392
387- local fontResource = Loader .loadImage (" fonts/my_font.ttf" )
393+ local fontResource = Loader .loadFont (" fonts/my_font.ttf" )
388394
389395function Update ()
390396 if not fontResource :isReady () then
@@ -393,14 +399,14 @@ function Update()
393399 -- Using your own font:
394400 fontResource :drawText (" Hello" , Vec .V2 (0 , 0 ), 0.16 )
395401
396- -- Using the default font
402+ -- Or using the default font (Roboto)
397403 Text .font :drawText (" world" , Vec .V2 (0 , - 0.16 ), 0.16 )
398404end
399405```
400406
401407## Sound and Music
402408
403- Loading sounds works just like Images , but you call the ` loadAudio ` function instead of ` loadImage ` .
409+ Loading sounds works just like images , but you call the ` loadAudio ` function instead of ` loadImage ` .
404410
405411# ✂️ Splitting and organizing your code
406412
0 commit comments