Syntax Reference - QB64
From QB64 Wiki
In alphabetical order. GET/PUT/PRINT/INPUT reffer to TCP/IP. Keyword that syntax refers to is linked. A brief explanation in grey next to the syntax.
Best viewed with maximized browser window.
_A
-
result& = _ALPHA(c&[, imageHandle&])→ Returns the alpha opacity for the image specified or the current image.
-
result& = _ALPHA32(c&[, imageHandle&])→ Returns the alpha opacity for the image specified or the current image.
-
_AUTODISPLAY→ Turns on autodisplay if it was disabled using _DISPLAY.
_B
-
BG = _BACKGROUNDCOLOR→ Returns the current background color.
-
...AS [_UNSIGNED] _BIT [*numberofbits]→ The bit can only hold -1 or 0, unsigned bit can hold 1 or 0.
-
_BLEND [imagehandle]→ Turns on alpha blending.
-
enabledflag = _BLEND [(imagehandle)]→ Returns -1 if alpha blending is enabled on the current image or a specific one, otherwise it returns 0.
-
blue = _BLUE(palette_index/32_bit_color[, image_handle])
-
blue_intensity% = _BLUE32(color32value)
-
...AS [_UNSIGNED] _BYTE→ A byte can hold 256 values from -128 to 127, unsigned byte can hold 0 to 255.
_C
-
_CLEARCOLOR RGBsettings[, ImageHandle]→ Defines the transparent color for all images or a specific one.
-
colorvalue = _CLEARCOLOR [(handle)]→ Returns the current transparent color.
-
PUT [STEP](column, row), image[, _CLIP] [{XOR|PSET|AND|OR|PRESET}][, omitcolor]]→ Clips parts of the image that is offscreen.
-
result$ = _CLIPBOARD$→ Retrieve the contents of the clipboard.
-
_CLIPBOARD$ = string_expression$→ Set the contents of the clipboard.
-
status = _CONNECTED(handle)
-
address$ = _CONNECTIONADDRESS(handle)
-
_CONTROLCHR {OFF|ON}→ Turns on/off functionality of ASCII control characters
-
copyhandle& = _COPYIMAGE& [(handle)]→ Returns a handle to a copy of a image.
-
_COPYPALETTE [sourceImageHandle&[, destinationImageHandle&]]
-
result = _CV(numericalType, stringValue$)
_D
-
result& = _DEFAULTCOLOR [(imageHandle&)]→ Returns the current default color of a specified image
-
_DEFINE range or letter[, range2 or letter2[, range3 or letter3[, ...]]] AS [_UNSIGNED] datatype→ Defines variables starting with a letter as a datatype.
-
_DELAY seconds!→ Delays the program the specified number of seconds.
-
_DEST handle→ Sets the drawing destination image.
-
handle = _DEST→ Returns the current drawing destination image handle.
-
device$ = _DEVICE$(device_number)→ Returns the name and type of the device for a given device number
-
devicecount = _DEVICES→ Returns the number of devices. Must be used before _DEVICE$ and _LASTBUTTON
-
direxists = _DIREXISTS (filepath$)→ Returns -1 if the directory exists that the filepath points to.
-
_DISPLAY→ Turns off automatic display, while displaying the buffer to the screen.
-
displayedimage = _DISPLAY→ Returns the current displayed image.
-
_DONTBLEND [imagehandle]→ Turns off alpha blending.
-
SHELL [_DONTWAIT] [commandline$]→ Don't wait for the SHELLed program to end before returning control to the calling program.
_E
-
erline = _ERRORLINE→ In case of error returns the line that produced the error.
-
quit% = _EXIT→ Turns control over exit to program, gives values depending on how the user tries to exit.
_F
-
fileexists = _FILEEXISTS (filepath$)→ Returns -1 if file exists at the specified path
-
...AS [_UNSIGNED] _FLOAT→ Defines a variable or array to use float precision values, gives maximum precision in QB64.
-
_FONT Font_handle[, Image_handle&]→ Set the font for the current image or a specified one.
-
font_handle = _FONT [(image_handle)]→ Returns the font handle for the current image or a specified one.
-
character_height_in_pixels = _FONTHEIGHT [(font_handle)]→ Returns the height of a font defined by font_handle.
-
character_width_in_pixels = _FONTWIDTH [(font_handle)]→ Returns the width of a font defined by font_handle.
-
_FREEFONT font_handle→ Closes the font defined by font_handle.
-
_FREEIMAGE [handle]→ Closes the image defined by handle.
-
timerhandle = _FREETIMER→ Returns the handle of the next free timer.
-
full = _FULLSCREEN→ Returns the current fullscreen mode.
-
_FULLSCREEN [{_OFF|_STRETCH|_SQUAREPIXELS}]→ Set fullscreen mode.
_G
-
GET #handle, ,b$→ In QB64 gets a raw (unformatted) string from a open TCP/IP connection handle.-
GET #handle, ,x%→ In QB64 gets a raw (unformatted) integer from a open TCP/IP connection handle.
-
-
green = _GREEN(palette_index/32_bit_color[, image_handle])→ Returns the green component of the color specified.
-
green_intensity% = _GREEN32(color32value)→ Returns the green component of the color specified.
_H
-
height& = _HEIGHT(i&)→ Returns the height of image i&.
-
SHELL _HIDE StringCommandLine$→ Used to hide the SHELLed program.
_I
-
_ICON handle→ Sets the program icon to the image defined by handle.
-
INPUT #handle, data1[, data2, ...etc]→ In QB64 retrieves data using the QB64 format from a open TCP/IP connection handle.
-
...AS [_UNSIGNED] _INTEGER64→ Defines a variable or array to use 64-bit integers.
_L
-
button_count% = _LASTBUTTON(device_number)→ Returns the number of buttons of the specified device. _DEVICES must have been called first.
-
_LIMIT (FramesPerSecond%)→ Limits the framerate of a loop.
-
font_handle = _LOADFONT(ttf_filename$, height [,"BOLD,ITALIC,UNDERLINE,DONTBLEND,MONOSPACE"])→ Loads a font and returns the handle to it.
-
handle& = _LOADIMAGE& (filename$[, mode])→ Loads a image and returns the handle to it.
_M
-
_MAPTRIANGLE (sx1, sy1)-(sx2, sy2)-(sx3, sy3), source&, TO (dx1, dy1)-(dx2, dy2)-(dx3, dy3)[, destination&]
-
_MAPUNICODE Unicode& TO ascii_code%
-
UTFvalue& = _MAPUNICODE(Ascii_code%)
-
_SCREENMOVE {column&, row&|_MIDDLE}→ Used to move the window to the center of the screen.
-
stringvalue$ = _MK$(numericaltype, numbervalue)
-
buttontriggered = _MOUSEBUTTON (Button%)→ Returns -1 if the mouse button is triggered.
-
_MOUSEHIDE→ Hides the mouse.
-
newmouseinput = _MOUSEINPUT→ Returns -1 if there are new input from the mouse.
- _MOUSEMOVE x, y → Moves the mouse pointer to a designated position.
-
xmovement = _MOUSEMOVEMENTX→ Returns the number of pixels in the x direction that the mouse has moved since the latest call. Also hides the mouse.
-
ymovement = _MOUSEMOVEMENTY→ Returns the number of pixels in the y direction that the mouse has moved since the latest call. Also hides the mouse.
-
_MOUSESHOW→ Shows the mouse.
-
scroll% = _MOUSEWHEEL→ Returns the number of wheel turns of the mouse.
-
xposmouse = _MOUSEX→ Returns the x position of the mouse.
-
yposmouse = _MOUSEY→ Returns the y position of the mouse.
_N
-
handle& = _NEWIMAGE& (width, height[, BPPmode])→ Creates and gives the handle to a new image.
-
_CLEARCOLOR _NONE[, imageHandle&]→ Used to specify that there should be no clearcolor (transparent color) on the image.
_O
-
...variable AS _OFFSET→ Defines a variable to be of the type _OFFSET which is used to hold a pointer to memory.
-
offset%& = _OFFSET(variable)→ Returns the memory offset that is used to hold the variable.
-
client_handle = _OPENCLIENT(stringargument)
-
connect_handle = _OPENCONNECTION(host_handle)
-
host_handle = _OPENHOST(stringargument)
-
osinfo$ = _OS$→ Returns a string representing the Operating System and if it is 32 or 64 bit.
_P
-
_PALETTECOLOR index%, colour&[, imageHandle&]→ Set the color of a palette index in a 8-bit (or less) image.
-
color32value& = _PALETTECOLOR(attribute_number&, handle&)
-
BytesPerPixel& = _PIXELSIZE (imagehandle&)→ Returns the number of bytes a pixel takes up in a certain image.
-
REDIM _PRESERVE Array(newelements%)→ Optional argument to REDIM used to preserve the contents of an array while re-dimensioning.
-
PRINT #handle, data [, data2, ...etc]→ In QB64 sends data using the QB64 format to a open TCP/IP connection handle.
-
_PRINTIMAGE imagehandle→ Sends the image to the printer, stretching it to full paper size first
-
_PRINTMODE mode[, image_handle]
-
status% = _PRINTMODE [(image_handle)]
-
_PRINTSTRING (column, row), text_to_print$[, image_handle&]→ Prints text to the screen.
-
pixel_width = _PRINTWIDTH(text_to_print$[, image_handle&])
-
PUT #handle, , data→ In QB64; Transmits raw data to a open TCP/IP connection handle.
-
_PUTIMAGE [(destx, desty)][-(destx2, desty2)], [srchandle], [desthandle][,(srcx, srcy)][-(srcx2, srcy2)]→ Puts an area of one image onto an area of another.
_R
-
red = _RED(palette_index/32_bit_color[, image_handle])→ Returns the red component of the color specified.
-
red_intensity% = _RED32(color32value)→ Returns the red component of the color specified.
-
colorindex = _RGB(red, green, blue[, image_handle])→ Returns the color index for a mix of Red, Green and Blue components.
-
color32 = _RGB32(red, green, blue)→ Returns the 32-bit color value for a mix of Red, Green and Blue components.
-
colorindex = _RGBA(red, green, blue, alpha[, image_handle])→ Returns the color index for a mix of Red, Green, Blue and alpha components.
-
color32 = _RGBA32(red, green, blue, alpha)→ Returns the 32-bit color value for a mix of Red, Green, Blue and alpha components.
-
roundedvalue = _ROUND(value)→ Rounds to the nearest integer with preference for even numbers, 1.5 and 2.5 rounds to 2
_S
-
_SCREENCLICK x%, y%→ Simulates clicking on the screen at the specified location.
-
handle& = _SCREENIMAGE→ Takes a snapshot of the screen and gives the image to it.
-
_SCREENMOVE {x&, y&|_MIDDLE}→ Moves the window to the specified location.
-
_SCREENPRINT text$→ Simulates typing on the keyboard.
-
xpos = _SCREENX→ Returns the current x position of the window.
-
ypos = _SCREENY→ Returns the current y position of the window.
-
_SETALPHA alpha&, [c& [TO c2&]] [, imageHandle&]
-
_SNDBAL handle&[, x!][, y!][, z!]
-
_SNDCLOSE handle&→ Closes the sound specified by the handle
-
new_handle& = _SNDCOPY& (handle&)→ Copies the sound and gives the handle to the copy.
-
seconds = _SNDGETPOS!(handle&)→ Get play position in seconds of the sound specified
-
lenseconds = _SNDLEN! (handle&)→ Get the length in seconds of the sound specified
-
_SNDLIMIT handle&, limit!
-
_SNDLOOP handle&
-
sound_handle& = _SNDOPEN (filename$, [capabilities$])→ Open and load a sound into memory, the handle to the sound is returned.
-
_SNDPAUSE handle&→ Pause the sound specified.
-
paused% = _SNDPAUSED (handle&)→ Returns -1 if specified sound is paused, otherwise returns 0.
-
_SNDPLAY handle&→ Start playing the sound specified.
-
_SNDPLAYCOPY handle&[, volume!]
-
_SNDPLAYFILE filename$[, sync%][, volume!]
-
playing% = _SNDPLAYING% (handle&)→ Returns -1 if sound is playing, otherwise returns 0.
-
rate = _SNDRATE→ Returns the sample frequency.
-
_SNDRAW leftsample& [rightsample&]→ Turns the speaker membrane in or out -1 to 1 (1 being fully out).
-
length# = _SNDRAWLEN→ Returns the length in seconds of the sample.
-
_SNDSETPOS handle&, position!→ Set the position in seconds of the sound specified.
-
_SNDSTOP handle&→ Stop the sound specified.
-
_SNDVOL handle&, volume→ Set the volume of the sound specified.
-
_SOURCE handle&→ Sets the source image that information is retrieved from.
-
present_source& = _SOURCE→ Returns the handle of the current source image.
_T
-
t = TIMER(accuracy)→ Returns the current timer value with a chosen accuracy (can be down to .001, which is millisecond accuracy).
-
_TITLE Text$→ Sets the title of the program window.
_U
-
...AS [_UNSIGNED] datatype→ _UNSIGNED makes the datatype always positive, increases the maximum value of the datatype.
_W
-
ImageWidth& = _WIDTH(i&)→ Returns the width of a image defined by i&.
