BACKGROUND

Description

  • A Background is a bitmap image. It can be created at runtime or loaded from an external BMP file with the LOADBMP command.
  • The command expects a handle of the bitmap, and not a path to an external file.
  • The Background and Sprites will not show up until a DRAWSPRITES command is issued. The background can be changed at any time.

BMP file that will used in the example:
sprite_jb_back.bmp
sprite_jb_back.bmp

Syntax

GraphicBox Control

  1. Print #Handle.Extension, "Background BMPHandle"
  2. #Handle.Extension "Background BMPHandle"

Graphics Type Window

  1. Print #main, "Background BMPHandle"
  2. #main "Background BMPHandle"

Hints

  • Only one graphicbox or graphics window in a program may use sprites.

Example

This example uses the image from this article. Save it to a folder of your choice and run this code from the same folder.
NOMAINWIN
LOADBMP "BMPBACK","sprite_jb_back.bmp"
WindowWidth=500 : WindowHeight=250
Open "Just BASIC - Sprite Demo - Background" For Graphics_nsb_nf as #main
    #main "Trapclose [quit]"
    #main "Background BMPBACK"
    #main "Drawsprites"
    Wait
 
[quit]
Close #main
UNLOADBMP "BMPBACK"
End

Useful Functions

Place a useful function using this keyword here