Syntax Reference - QB64

From QB64 Wiki
Revision as of 22:55, 1 January 2010 by imported>Cyperium
Jump to navigation Jump to search

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 fullscreen.


  • _AUTODISPLAY → Turns on autodisplay if it was disabled using _DISPLAY.


  • 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.
  • 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.


  • _CLEARCOLOR RGBsettings[, ImageHandle] → Defines the transparent color for all images or a specific one.
  • colorvalue = _CLEARCOLOR [(handle)] → Returns the current transparent color.
  • status = _CONNECTED(handle)
  • address$ = _CONNECTIONADDRESS(handle)
  • copyhandle& = _COPYIMAGE& [(handle)] → Returns a handle to a copy of a image.


  • _DEFINE range or letter[, range2 or letter2[, range3 or letter3[, ...]]] AS [ _UNSIGNED ] datatype → Defines variables starting with a letter or range of letters (like A-Z) as a datatype.
  • _DELAY seconds! → Delays the program the specified number of seconds.
  • _DEST {handle | 0|1|2|3|...} → Sets the drawing destination image.
  • handle = _DEST → Returns the current drawing destination image handle.
  • _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.


  • erline = _ERRORLINE → In case of error returns the line that produced the error.


  • ...AS [ _UNSIGNED ] _FLOAT
  • _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.


  • 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])
  • green_intensity% = _GREEN32(color32value)


  • height& = _HEIGHT(i&) → Returns the height of image 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


  • _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.


  • 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.
  • _MOUSESHOW → Shows the mouse.
  • xposmouse = _MOUSEX → Returns the x position of the mouse.
  • yposmouse = _MOUSEY → Returns the y position of the mouse.


  • handle& = _NEWIMAGE& (width, height[, BPPmode]) → Creates and gives the handle to a new image.



  • color32value& = _PALETTECOLOR(attribute_number&, handle&)
  • BytesPerPixel& = _PIXELSIZE (imagehandle&) → Returns the number of bytes a pixel takes up in a certain image.
  • PRINT #handle, data [,data2, ...etc] → In QB64 sends data using the QB64 format to a open TCP/IP connection handle.
  • _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 [(srcx, srcy)][-(srcx2, srcy2)], [srchandle], [desthandle][,(destx, desty)][-(destx2, desty2)] → Puts a image from a area of a source image to a area of a destination image.


  • red = _RED(palette_index/32_bit_color[, image_handle])
  • red_intensity% = _RED32(color32value)
  • 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)



  • 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.
  • ...AS [ _UNSIGNED ] datatype → _UNSIGNED makes the datatype always positive, increases the maximum value of the datatype.


  • ImageWidth& = _WIDTH(i&) → Returns the width of a image defined by i&.