sprite& = _NEWIMAGE(32, 32, 32) _DEST sprite& ' draw onto sprite CLS , _RGB(255,0,0) ' red background _DEST 0 ' back to main screen _PUTIMAGE (mouseX, mouseY), sprite& SCREEN _NEWIMAGE(800, 600, 32) _DISPLAY ' start rendering DO _LIMIT 60 ' 60 FPS CLS ' draw frame... x = x + 1 _PUTIMAGE (x, 300), player& _DISPLAY ' show frame LOOP Chapter 8: Audio & Sound 8.1 Legacy Sound (PC Speaker) SOUND 440, 18 ' 440Hz for 1 second (18 ticks = 1 sec) BEEP ' simple beep PLAY "MB L8 O3 C D E F G" ' music macro language 8.2 Modern Sound (_SND Commands) Load and play:
OPEN "data.txt" FOR OUTPUT AS #1 WRITE #1, "John", 25, 85.5 PRINT #1, "Jane", 22, 92.0 CLOSE #1 qb64 manual pdf
QB64 is open source under GPLv2/LGPL. Manual text © 2024. Freely distributable. sprite& = _NEWIMAGE(32, 32, 32) _DEST sprite& '
COLOR _RGB(255, 255, 0) ' yellow text COLOR _RGB(0, 0, 0), _RGB(255, 255, 255) ' black on white PSET (100, 200), _RGB(255,0,0) ' draw a red pixel | Command | Syntax | Description | |---------|--------|-------------| | PSET | PSET (x,y), color | Set single pixel | | LINE | LINE (x1,y1)-(x2,y2), color | Line or rectangle | | CIRCLE | CIRCLE (cx,cy), radius, color | Circle/ellipse | | PAINT | PAINT (x,y), fill_color, border_color | Flood fill | Freely distributable
FOR i = 1 TO 10 STEP 2 PRINT i NEXT i ' outputs 1,3,5,7,9
SCREEN _NEWIMAGE(1024, 768, 32) ' width, height, bits-per-pixel (32 = true color) _RGB(red, green, blue) ' 0-255 each → 32-bit color value _RGBA(255,0,0,128) ' with alpha (128 = half transparent) _RGB32(&HFF00FF) ' from hex (magenta) Examples:
sprite& = _NEWIMAGE(32, 32, 32) _DEST sprite& ' draw onto sprite CLS , _RGB(255,0,0) ' red background _DEST 0 ' back to main screen _PUTIMAGE (mouseX, mouseY), sprite& SCREEN _NEWIMAGE(800, 600, 32) _DISPLAY ' start rendering DO _LIMIT 60 ' 60 FPS CLS ' draw frame... x = x + 1 _PUTIMAGE (x, 300), player& _DISPLAY ' show frame LOOP Chapter 8: Audio & Sound 8.1 Legacy Sound (PC Speaker) SOUND 440, 18 ' 440Hz for 1 second (18 ticks = 1 sec) BEEP ' simple beep PLAY "MB L8 O3 C D E F G" ' music macro language 8.2 Modern Sound (_SND Commands) Load and play:
OPEN "data.txt" FOR OUTPUT AS #1 WRITE #1, "John", 25, 85.5 PRINT #1, "Jane", 22, 92.0 CLOSE #1
QB64 is open source under GPLv2/LGPL. Manual text © 2024. Freely distributable.
COLOR _RGB(255, 255, 0) ' yellow text COLOR _RGB(0, 0, 0), _RGB(255, 255, 255) ' black on white PSET (100, 200), _RGB(255,0,0) ' draw a red pixel | Command | Syntax | Description | |---------|--------|-------------| | PSET | PSET (x,y), color | Set single pixel | | LINE | LINE (x1,y1)-(x2,y2), color | Line or rectangle | | CIRCLE | CIRCLE (cx,cy), radius, color | Circle/ellipse | | PAINT | PAINT (x,y), fill_color, border_color | Flood fill |
FOR i = 1 TO 10 STEP 2 PRINT i NEXT i ' outputs 1,3,5,7,9
SCREEN _NEWIMAGE(1024, 768, 32) ' width, height, bits-per-pixel (32 = true color) _RGB(red, green, blue) ' 0-255 each → 32-bit color value _RGBA(255,0,0,128) ' with alpha (128 = half transparent) _RGB32(&HFF00FF) ' from hex (magenta) Examples: