LINE (0,0)-(200,200), _RGB(255,0,0), BF ' filled red square CIRCLE (400,300), 50, _RGB(0,255,0) PAINT (400,300), _RGB(0,255,0), _RGB(0,255,0) ' fill circle Loading an image:
AND, OR, NOT, XOR PRINT formatting:
WHILE done% = 0 ' code WEND 6.1 One-Dimensional Arrays DIM scores(1 TO 10) AS INTEGER ' 10 elements scores(1) = 95 FOR i = 1 TO 10 PRINT scores(i) NEXT i 6.2 Dynamic Arrays (Redim) DIM names$() ' empty array REDIM names$(1 TO 5) REDIM _PRESERVE names$(1 TO 10) ' keep existing data 6.3 Multi-Dimensional Arrays DIM grid(5, 5) AS INTEGER ' 6x6 matrix (0-5) FOR row = 0 TO 5 FOR col = 0 TO 5 grid(row, col) = row * col NEXT col NEXT row 6.4 User-Defined Types (TYPE) TYPE Player name AS STRING * 20 ' fixed-length string score AS LONG active AS _BIT END TYPE DIM p AS Player p.name = "Hero" p.score = 1000 Chapter 7: Graphics Programming 7.1 Screen Modes Legacy mode (SCREEN 0-13): qb64 manual pdf
PRINT "Hello" ' normal PRINT "A"; "B" ' no newline (A B) PRINT "X", "Y" ' tab-separated columns PRINT USING "##.##"; 3.14159 ' -> 3.14 LINE (0,0)-(200,200), _RGB(255,0,0), BF ' filled red square
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 | 0) PAINT (400