User Tools


reference:display_specifications

Display Specifications

About Display Elements

The display of SmileBASIC4 is composed of the following elements

・Screen
・Graphic Pages
・Text Screen
・Sprites
・Layers

Screen

Literally, it refers to the entire display.

As elements related to the entire display, you can specify the resolution (XSCREEN), the background color (BACKCOLOR), and the fader (FADE).

Graphic Pages

The graphic pages are a drawing destination of graphic drawing commands, and is also used as a drawing material storage place for sprites and text screens.

There are 6 graphic pages, GRP0 to GRP5, and GRP-1 as a special graphic page.

The graphic pages of GRP0 to GRP5 each have a size of 2048x2048, and can store pixel data with ARGB8888 which is 1 pixel 32 bits.

GRP-1 is a special graphic page that cannot be written. When referenced, white pixels (&HFFFFFFFF) are always referenced regardless of the coordinates.

GRP5 is a page for storing text fonts and can be freely read and written, but the text display will be corrupted if the page contents are rewritten. GRP5 is also called alias GRPF.

Text screens and sprites can specify one graphic page as drawing material.

Also, one page of graphic drawing can be designated as the drawing destination graphic page.

The default assignment of display elements and graphic pages is as follows:

Text Screen (Normal Characters) GRP5 Unchangeable
Text Screen (User-Defined Characters) Optional for Each Text surface, GRP4(1024,0) by default Changeable by TPAGE
Sprites Optional for Each Sprite, GRP4(0,0) by default Changeable by SPPAGE

Text Screen

SmileBASIC4 has five text screens for drawing characters and is represented by numbers from 0 to 4.

The text screen 4 is a special text surface, and is used as an output destination of BASIC interpreter and console output commands such as traditional PRINT and INPUT.

(However, you can ignore them and use the following functions.)

On the text screen, 8x8 or 16x16 fonts can be displayed in the same size or larger.

Font display settings can be changed for each text surface.

Two types of fonts can be used: normal fonts and user-defined fonts.

Normal font means font data stored in GRPF, and general characters are displayed using these fonts.

The user-defined fonts are 4096 characters from &HE800 to &HF7FF, and when this range of character codes is displayed, from the settingable user-defined font page, any 512x512 (It's for 8x8 font. When it's 16x16 font, it'll be 1024x1024.) pixel area is displayed as a font image.

On the text screen, the following attributes can be set for each character unit.

・Color
・Rotation (0, 90, 180, 270 degrees)
・Flip Vertical
・Flip Horizontal

The following attributes can be set for each text screen unit.

・Color
・Blend Method (Usually Addition)
・Display Position
・Z
・Home Position (Display Position, Rotation, Enlargement Origin)
・Rotation (Arbitrary Angle)
・Enlargement

Depending on the specifications of the graphic hardware, the neighboring pixels of the font pixel that should be referenced may be referred to.

Note that this issue is likely to occur if Real ​​are used for rotation/enlargement or display position/home position values.

Graphic Drawing

The graphic drawing function of SmileBASIC4 is implemented as a function which is capable of performing any drawing on graphic pages.

Therefore, in addition to using it as a normal graphic drawing function, it is also used as a function for preparing sprites and font images.

Specifically, graphic drawing can be possible on all graphic pages, and can also be drawn in real time on a graphic page currently used for a sprite or other thins.

SmileBASIC4 does not have its own graphic page, but instead uses one of the sprites for graphic drawing.

Sprites

Sprites can be drawn with various transformations on an arbitrary rectangular area of ​​a graphic page. Up to 4096 sprites can be displayed in the system.

Sprites that can be referred to by the constant #GSPRITE (No.4095 for SmileBASIC4) are used for graphic page by default, and settings will be reset for graphic page when ACLS or XSCREEN is used. (If graphic page is not required, it can be used as a normal sprite by resetting it later.)

The following parameters can be set individually for each sprite.

・Reference Graphic Page
・Reference Coordinates (UV)
・UV Rotation (0, 90, 180, 270 degrees)
・UV Flip Vertical
・UV Flip Horizontal
・Color
・Blend Method (Usually Addition)
・Display Position
・Z
・Home Position (Display Position, Rotation, Enlargement Origin)
・Rotation (Arbitrary Angle)
・Enlargement

Depending on the specifications of the graphic hardware, the neighboring pixels of the font pixel that should be referenced may be referred to.

Note that this issue is likely to occur if Real ​​are used for rotation/enlargement or display position/home position values.

To strictly avoid this issue, it is preferable to leave a gap of 1 pixel in a transparent color between adjacent sprite images.

Layers

Layers provide a mechanism for grouping display elements (text screens and sprites) and for special effects and special composition.

Number and Priority of Layers

There are 8 layers from 0 to 7, and they are drawn in descending order as 7, 6, 5, 4, 3, 2, 1, 0.

As a result, the smaller the number, the closer it is drawn.

TLAYER for text screens and SPLAYER for sprites can be used to change layers.

Note that if you change the layers, it prioritizes the display priority of the layer over the display priority of the display element, so the final display priority will change.

Layer Effect: Customize Drawing Matrix

You can customize the transformation matrix applied to the elements in the layer using the LMATRIX command.

You can specify a 4x4 unique matrix to express beyond the conventional 2D representation, or specify 2D conversion parameters to translate, scale, and rotate freely.

Layer Effect: Clipping

A clipping area can be specified when drawing the element belonging to a layer with the LCLIP command.

Layer Effect: Filter

Special effects such as blurring and mosaic can be applied to the entire layer with the LFILTER command.

Layer Effect: Composite

The LAYER command can be used to change the composition method between layers.

Normal/addition/multiplication composite can be performed, and colors can be multiplied during composite.

Coordinate System

All display elements have a coordinate system in which the upper left is the origin and the lower right direction is positive.

Depth (Z) is used as the display priority of the display element, with 4095 at the back and -4095 at the front.

Display Priority

Display priority can be set individually for texts and sprites.

Within one layer, the display priority is displayed in the foreground as the value is smaller.

In addition, the display elements are displayed in the following order between display elements having the same priority.

・The smaller the ID among tests is displayed in front
・The smaller the ID among sprites is displayed in front.
・In texts and sprites, sprites are always displayed in front regardless of ID.

The initial display priority of the sprite is 0.

The initial display priority of the text is -4095 for the 4th and 0 for the others.

If the layers are different, the smaller the layer ID, the closer it is displayed.

About Colors

All drawing is done in 32-bit color (ARGB8888) with an alpha channel.

About Overload Mode

When the GPU drawing processing time exceeds 6V (1/10 second), the overload mode is activated.

When the overload mode is entered, a warning indicating of the overload mode is displayed on the display, the program being executed is forcibly stopped, and all displayed sprites will be turned off.

When the overload condition is cleared, the warning disappears and it can be used normally. However, since the sprite display does not return automatically, it is necessary to reset the display by executing an ACLS command or others.

reference/display_specifications.txt · Last modified: 2020/08/24 12:17 (external edit)

Page Tools