PANORAMIC: USER's GUIDE

FOR THE VERSION 0.9.27

PART 4 - SCENE2D AND SPRITES

MAIN PAGE / DOCUMENTATION


1 - HANDLING THE SPRITES


1 - HANDLING THE SPRITES

A SPRITE is a picture which can be moved on a SCENE2D without disturbing it, the black color is said "transparent".
A SPRITE must be created.
When it exists, it can then receive a picture (in BMP format), be moved, scaled, hidden, showed again, destroyed.
For all the following commands, N is the number of the SPRITE.

to the top

1.1 - Create

SPRITE N Creates the SPRITE number N in the "targeted" SCENE2D.
SPRITE_CREATE_SHOW

The next created SPRITEs will be visible

SPRITE_CREATE_HIDE

The next created SPRITEs will not be visible

The "targeted" SCENE2D is the system object which displays SPRITEs.
It is:

- the only existing SCENE2D if there is only one SCENE2D,
- the first created SCENE2D if there are several SCENE2Ds and no one has been designated as "target",
- The SCENE2D which has been designated as a "target" by the command SPRITE_TARGET_IS if there are several SCENE2Ds.

to the top

1.2 - Load a picture

SPRITE_FILE_LOAD N, F Loads into the SPRITE number N the picture (BMP) from the file F
SPRITE_IMAGE_LOAD N1, N2 Loads into the SPRITE number N1 the picture from the system object number N2.

The file F is defined either with an absolute path, or relative to the current directory.

to the top

1.3 - Load a text

SPRITE_TEXT N, T The SPRITE number N displays the text T.
The text is displayed with font, size, color and style defined for the SCENE2D.

to the top

1.4 - Image processing

SPRITE_BRIGHTNESS N,V Changes the brigthness of SPRITE number N.
SPRITE_CONTRAST N,V Changes the contrast of SPRITE number N.
SPRITE_GAMMA N,V Changes the gamma of SPRITE number N.

For the 3 commands, V must be between -128 and 127
Every time a command is executed:
- if V=0, the picture remains unchanged,
- if V<0, its brightness or contrast or gamma decreases,
- if V>0, its brightness or contrast or gamma increases.

to the top

1.5 - Delete

SPRITE_DELETE N Deletes the SPRITE number N.

to the top

1.6 - Show or hide

SPRITE_SHOW N Shows the SPRITE number N.
SPRITE_HIDE N

Hides the SPRITE number N.

SPRITE_SHOW_ALL Shows all the SPRITE.
SPRITE_HIDE_ALL Hides all the SPRITE.

The default state of a SPRITE when created is: visible.

to the top

1.7 - Move

SPRITE_X_POSITION N, X Set X-coordinate of the SPRITE number N.
SPRITE_Y_POSITION N, Y Set Y-coordinate of the SPRITE number N.
SPRITE_POSITION N, X, Y Set X and Y-coordinates of the SPRITE number N.

The position of a SPRITE is the position of its upper left corner of its picture, it is expressed in pixels.

The X and Y coordinates are related to the SCENE2D to which the SPRITE belongs, and are "screen" coordinates:

- the origin (0,0) is the upper left corner of the SCENE2D
- the X-axis is the horizontal axis from the origin: X is more and more positive when we move to the right
- the Y-axis is the vertical axis from the origin: Y is more and more positive when we move to the bottom

to the top

1.8 - Scale

SPRITE_X_SCALE N, CX Shrinks or stretches the width of the SPRITE number N.
Shrinks if CX <1, stretches if CX > 1
SPRITE_Y_SCALE N, CY Shrinks or stretches the height of the SPRITE number N.
Shrinks if CY <1, stretches if CY > 1
SPRITE_SCALE N, CX, CY Shrinks or stretches the width and height of the SPRITE number N.

to the top

1.9 - Get the position

SPRITE_X_POSITION(N) Returns the X-coordinate of the SPRITE number N.
SPRITE_Y_POSITION(N) Returns the Y-coordinate of the SPRITE number N.

to the top

1.10 - Misc

NUMBER_SPRITES Returns the number of SPRITEs.
SPRITE_EXISTS(N)

Returns 1 if the SPRITE number N exists, 0 otherwise

to the top


Last update: January 22, 2017