Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
vdp2.h File Reference

Jo Engine VDP2 definition and tools. More...

Go to the source code of this file.

Macros

#define jo_nbg2_printf(X, Y, ...)
 NBG2 printf implementation (jo_set_nbg2_8bits_font must be called before).
#define jo_nbg3_printf(X, Y, ...)
 NBG3 printf implementation (jo_set_nbg3_8bits_font must be called before).
#define JO_NBG1_SCROLL_TABLE_SIZE
 512 entries. One offset for each line because the background size is a 512x512 pixels by default.
#define JO_NBG1_VERTICAL_CELL_SCROLL_TABLE_SIZE
 Entries of the NBG1 vertical cell scroll table: one for each column of 8 pixels on the screen (and one more when the screen is scrolled by a fraction of a column).
#define JO_NBG0_SCROLL_TABLE_SIZE
 512 entries. One offset for each line because the background size is a 512x512 pixels by default.
#define JO_VDP2_ADDITIVE_SPRITE_BANK
 Color bank bits of an additive sprite (see jo_enable_additive_sprites(), jo_sprite_set_additive_palette()): the priority register 3 of the sprites (sprite type 3: bits 14 and 13 of a palette pixel).

Functions

int sprintf (char *str, const char *format,...)
 sprintf prototypes
void jo_set_displayed_screens (const jo_scroll_screen scroll_screen_flags)
 Set displayed screens.
void jo_set_default_background_color (const jo_color background_color)
 Set default background color.
void jo_set_background_line_colors (const jo_color *const colors)
 Set a color for each line of the back screen (visible where no scroll screen is displayed).
void jo_nbg2_print (int x, int y, char *str)
 NBG2 Print implementation.
void jo_vdp2_set_nbg2_8bits_font (jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled)
 Set 8 bits NBG2 font image.
void jo_nbg2_clear (void)
 Clear NBG2.
void jo_nbg3_print (int x, int y, char *str)
 NBG3 Print implementation.
void jo_vdp2_set_nbg3_8bits_font (jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled)
 Set 8 bits NBG3 font image.
void jo_nbg3_clear (void)
 Clear NBG3.
void jo_vdp2_set_nbg1_8bits_image (jo_img_8bits *img, int palette_id, bool vertical_flip)
 Add 8 bits NBG1 image.
void jo_vdp2_set_nbg1_8bits_image_repeat (jo_img_8bits *img, int palette_id, bool vertical_flip, bool repeat)
 Add 8 bits NBG1 image, repeated or not.
void jo_vdp2_set_nbg0_8bits_image (jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
 Set 8 bits NBG0 image.
void jo_vdp2_set_nbg2_8bits_image (jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
 Set 8 bits NBG2 image.
void jo_vdp2_set_nbg3_8bits_image (jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
 Set 8 bits NBG3 image.
void jo_vdp2_set_nbg1_image (const jo_img *const img, short left, short top)
 Set NBG1 bitmap image.
bool __jo_vdp2_reserve_nbg1_bitmap (void)
 Allocate and display the NBG1 bitmap at its first use (Internal usage).
void jo_vdp2_clear_bitmap_nbg1 (const jo_color color)
 Clear NBG1 bitmap.
void __jo_vdp2_nbg1_bitmap_fill (const int x, const int y, int width, int height, const jo_color color)
 Fill a rectangle in the NBG1 bitmap (Internal usage).
void __jo_vdp2_nbg1_bitmap_blit (const jo_img *const img, const int src_x, const int src_y, int width, int height, const int x, const int y)
 Copy a part of an image in the NBG1 bitmap (Internal usage).
void jo_vdp2_move_nbg1 (const int x, const int y)
 Move NBG1 (scrolling).
void jo_vdp2_zoom_nbg1f (const float width_factor, const float height_factor)
 Zoom NBG1 width and height independently.
static __jo_force_inline void jo_vdp2_zoom_nbg1 (const float factor)
 Zoom NBG1.
void jo_vdp2_move_nbg0 (const int x, const int y)
 Move NBG0 (scrolling).
void jo_vdp2_zoom_nbg0f (const float width_factor, const float height_factor)
 Zoom NBG0 width and height independently.
static __jo_force_inline void jo_vdp2_zoom_nbg0 (const float factor)
 Zoom NBG0.
void jo_vdp2_draw_bitmap_nbg1_line (int x0, int y0, int x1, int y1, const jo_color color)
 Draw a NBG1 line using Bresenham's line algorithm.
static __jo_force_inline void jo_vdp2_draw_bitmap_nbg1_square (const int x, const int y, const short width, const short height, const jo_color color)
 Draw a square on NBG1.
static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1 (const int x, const int y, const jo_color color)
 Put pixel in NBG1 using color.
static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1_rgb (const int x, const int y, unsigned char r, unsigned char g, unsigned char b)
 Put pixel in NBG1 using composite color.
void jo_vdp2_enable_rbg0 (void)
 Enable 3D planes.
void jo_vdp2_set_rbg0_far_limit (const int max_zoom_out)
 Hide the farthest part of the 3D planes (the back screen is visible instead).
void jo_vdp2_disable_rbg0 (void)
 Disable 3D planes.
void jo_vdp2_set_rbg0_plane_a_8bits_image (jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip)
 Setup plane A.
void jo_vdp2_set_rbg0_plane_b_8bits_image (jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip)
 Setup plane B.
void jo_vdp2_replace_rbg0_plane_a_8bits_image (jo_img_8bits *img, bool vertical_flip)
 Replace plane A image.
void jo_vdp2_replace_rbg0_plane_b_8bits_image (jo_img_8bits *img, bool vertical_flip)
 Replace plane B image.
void jo_vdp2_draw_rbg0_plane_a (const bool use_scroll_format_matrix)
 Draw plane A.
void jo_vdp2_draw_rbg0_plane_b (const bool use_scroll_format_matrix)
 Draw plane B.
void jo_vdp2_draw_rbg0_plane_b_flat (const int x, const int y)
 Draw plane B as a flat image, without perspective: a sky behind the plane A (sea, ground).
void jo_enable_screen_mozaic (const jo_scroll_screen screens, short x, short y)
 Enable mozaic effect for scroll screen.
void jo_disable_all_screen_mozaic (void)
 Disable mozaic effect for all scroll screen.
int * jo_vdp2_enable_nbg1_line_scroll (void)
 Enable NBG1 horizontal line scroll effect.
void jo_vdp2_disable_nbg1_line_scroll (void)
 Disable NBG1 horizontal line scroll effect.
void jo_vdp2_compute_nbg1_line_scroll (unsigned short offset)
 Compute NBG1 horizontal line scroll effect using specific offset.
int * jo_vdp2_enable_nbg1_vertical_cell_scroll (void)
 Enable the NBG1 vertical cell scroll: each column of 8 pixels of the screen is moved vertically by its own offset (added to the vertical scroll of the screen).
void jo_vdp2_disable_nbg1_vertical_cell_scroll (void)
 Disable the NBG1 vertical cell scroll and free its table.
int * jo_vdp2_enable_nbg0_line_scroll (void)
 Enable NBG0 horizontal line scroll effect.
void jo_vdp2_disable_nbg0_line_scroll (void)
 Disable NBG0 horizontal line scroll effect.
void jo_vdp2_compute_nbg0_line_scroll (unsigned short offset)
 Compute NBG0 horizontal line scroll effect using specific offset.
void jo_disable_all_screens_transparency (void)
 Disable all screens transparency.
void jo_enable_screen_transparency (const jo_scroll_screen screen, const unsigned short transparency_level)
 Enable screen transparency.
void jo_enable_additive_sprites (void)
 The light of the additive sprites is added to the image under them (the VDP2 color calculation "add", like the glows, see jo/glow.h): a halo without edge (the sun, a flare) drawn by the VDP1. An additive sprite is a palette sprite (8 bits) drawn with jo_sprite_set_additive_palette(): its pixels have the priority register 3 of the sprites, the only one with the color calculation. Black adds nothing, the colors saturate to white.
void jo_disable_additive_sprites (void)
 The additive sprites are opaque again (see jo_enable_additive_sprites()).

Variables

char __jo_sprintf_buf [JO_PRINTF_BUF_SIZE]
 Internal sprintf buffer.
bool __jo_vdp2_nbg1_bitmap_reserved
 The NBG1 bitmap is in the VRAM (Internal usage, see __jo_vdp2_reserve_nbg1_bitmap()).

Detailed Description

Jo Engine VDP2 definition and tools.

Author
Johannes Fetz
Bug
No known bugs.

Macro Definition Documentation

◆ JO_NBG0_SCROLL_TABLE_SIZE

#define JO_NBG0_SCROLL_TABLE_SIZE

512 entries. One offset for each line because the background size is a 512x512 pixels by default.

◆ JO_NBG1_SCROLL_TABLE_SIZE

#define JO_NBG1_SCROLL_TABLE_SIZE

512 entries. One offset for each line because the background size is a 512x512 pixels by default.

◆ JO_NBG1_VERTICAL_CELL_SCROLL_TABLE_SIZE

#define JO_NBG1_VERTICAL_CELL_SCROLL_TABLE_SIZE

Entries of the NBG1 vertical cell scroll table: one for each column of 8 pixels on the screen (and one more when the screen is scrolled by a fraction of a column).

◆ jo_nbg2_printf

#define jo_nbg2_printf ( X,
Y,
... )

NBG2 printf implementation (jo_set_nbg2_8bits_font must be called before).

Parameters
XHorizontal position from top left screen corner
YVertical position from top left screen corner
...Arguments

◆ jo_nbg3_printf

#define jo_nbg3_printf ( X,
Y,
... )

NBG3 printf implementation (jo_set_nbg3_8bits_font must be called before).

Parameters
XHorizontal position from top left screen corner
YVertical position from top left screen corner
...Arguments

◆ JO_VDP2_ADDITIVE_SPRITE_BANK

#define JO_VDP2_ADDITIVE_SPRITE_BANK

Color bank bits of an additive sprite (see jo_enable_additive_sprites(), jo_sprite_set_additive_palette()): the priority register 3 of the sprites (sprite type 3: bits 14 and 13 of a palette pixel).

Function Documentation

◆ __jo_vdp2_nbg1_bitmap_blit()

void __jo_vdp2_nbg1_bitmap_blit ( const jo_img *const img,
const int src_x,
const int src_y,
int width,
int height,
const int x,
const int y )

Copy a part of an image in the NBG1 bitmap (Internal usage).

Parameters
imgImage
src_xHorizontal position of the part in the image
src_yVertical position of the part in the image
widthPart width (must be inside the image)
heightPart height (must be inside the image)
xHorizontal position in the bitmap (wrapped around JO_VDP2_WIDTH)
yVertical position in the bitmap (wrapped around JO_VDP2_HEIGHT)
Remarks
The part wraps around the borders of the bitmap like the NBG1 scroll

◆ __jo_vdp2_nbg1_bitmap_fill()

void __jo_vdp2_nbg1_bitmap_fill ( const int x,
const int y,
int width,
int height,
const jo_color color )

Fill a rectangle in the NBG1 bitmap (Internal usage).

Parameters
xHorizontal position in the bitmap (wrapped around JO_VDP2_WIDTH)
yVertical position in the bitmap (wrapped around JO_VDP2_HEIGHT)
widthRectangle width
heightRectangle height
colorFill color
Remarks
The rectangle wraps around the borders of the bitmap like the NBG1 scroll

◆ __jo_vdp2_reserve_nbg1_bitmap()

bool __jo_vdp2_reserve_nbg1_bitmap ( void )

Allocate and display the NBG1 bitmap at its first use (Internal usage).

Returns
false if it can't be at the start of the bank A0 (the bank is used by other screens: line scroll tables, cells of NBG1 or RBG0). The drawing functions of the bitmap call it
Remarks
The bitmap takes 256 KB of the VDP2 VRAM (the banks A0 and A1): a program that never draws in it doesn't allocate it. JO_COMPATIBILITY_NBG1_BITMAP_AT_INIT = 1 in the makefile: allocated and displayed by jo_core_init() (the old behavior)

◆ jo_disable_additive_sprites()

void jo_disable_additive_sprites ( void )

The additive sprites are opaque again (see jo_enable_additive_sprites()).

◆ jo_disable_all_screen_mozaic()

void jo_disable_all_screen_mozaic ( void )

Disable mozaic effect for all scroll screen.

◆ jo_disable_all_screens_transparency()

void jo_disable_all_screens_transparency ( void )

Disable all screens transparency.

◆ jo_enable_additive_sprites()

void jo_enable_additive_sprites ( void )

The light of the additive sprites is added to the image under them (the VDP2 color calculation "add", like the glows, see jo/glow.h): a halo without edge (the sun, a flare) drawn by the VDP1. An additive sprite is a palette sprite (8 bits) drawn with jo_sprite_set_additive_palette(): its pixels have the priority register 3 of the sprites, the only one with the color calculation. Black adds nothing, the colors saturate to white.

Remarks
The color calculation mode is the same for all the screens: no transparency of a screen (see jo_enable_screen_transparency()) at the same time

◆ jo_enable_screen_mozaic()

void jo_enable_screen_mozaic ( const jo_scroll_screen screens,
short x,
short y )

Enable mozaic effect for scroll screen.

Parameters
screensScroll screens (You can pass multiple value using pipe(|). Example: JO_NBG1_SCREEN|JO_NBG2_SCREEN)
xHorizontal mozaic size [1-16]
yVertical mozaic size [1-16]
Warning
Only JO_NBG0_SCREEN, JO_NBG1_SCREEN, JO_NBG2_SCREEN, JO_NBG3_SCREEN and JO_RBG0_SCREEN supports this feature

◆ jo_enable_screen_transparency()

void jo_enable_screen_transparency ( const jo_scroll_screen screen,
const unsigned short transparency_level )

Enable screen transparency.

Parameters
screenScroll screen
transparency_levelTransparency Level 0 (fully visible) to 31 (almost invisible)

◆ jo_nbg2_clear()

void jo_nbg2_clear ( void )

Clear NBG2.

◆ jo_nbg2_print()

void jo_nbg2_print ( int x,
int y,
char * str )

NBG2 Print implementation.

Parameters
xHorizontal position from top left screen corner
yVertical position from top left screen corner
strString

◆ jo_nbg3_clear()

void jo_nbg3_clear ( void )

Clear NBG3.

◆ jo_nbg3_print()

void jo_nbg3_print ( int x,
int y,
char * str )

NBG3 Print implementation.

Parameters
xHorizontal position from top left screen corner
yVertical position from top left screen corner
strString

◆ jo_set_background_line_colors()

void jo_set_background_line_colors ( const jo_color *const colors)

Set a color for each line of the back screen (visible where no scroll screen is displayed).

Parameters
colorsJO_TV_HEIGHT colors (the first one is the top of the screen)
Remarks
Useful for a sky gradient. The colors are copied: the function can be called every frame.
jo_set_default_background_color() goes back to a single color

◆ jo_set_default_background_color()

void jo_set_default_background_color ( const jo_color background_color)

Set default background color.

Parameters
background_colorColor

◆ jo_set_displayed_screens()

void jo_set_displayed_screens ( const jo_scroll_screen scroll_screen_flags)

Set displayed screens.

Parameters
scroll_screen_flagsScroll screens (You can pass multiple value using pipe(|). Example: JO_NBG1_SCREEN|JO_NBG2_SCREEN)

◆ jo_vdp2_clear_bitmap_nbg1()

void jo_vdp2_clear_bitmap_nbg1 ( const jo_color color)

Clear NBG1 bitmap.

Parameters
colorClear color

◆ jo_vdp2_compute_nbg0_line_scroll()

void jo_vdp2_compute_nbg0_line_scroll ( unsigned short offset)

Compute NBG0 horizontal line scroll effect using specific offset.

Parameters
offsetOffset in scroll table returned by jo_vdp2_enable_nbg1_line_scroll()

◆ jo_vdp2_compute_nbg1_line_scroll()

void jo_vdp2_compute_nbg1_line_scroll ( unsigned short offset)

Compute NBG1 horizontal line scroll effect using specific offset.

Parameters
offsetOffset in scroll table returned by jo_vdp2_enable_nbg1_line_scroll()

◆ jo_vdp2_disable_nbg0_line_scroll()

void jo_vdp2_disable_nbg0_line_scroll ( void )

Disable NBG0 horizontal line scroll effect.

◆ jo_vdp2_disable_nbg1_line_scroll()

void jo_vdp2_disable_nbg1_line_scroll ( void )

Disable NBG1 horizontal line scroll effect.

◆ jo_vdp2_disable_nbg1_vertical_cell_scroll()

void jo_vdp2_disable_nbg1_vertical_cell_scroll ( void )

Disable the NBG1 vertical cell scroll and free its table.

◆ jo_vdp2_disable_rbg0()

void jo_vdp2_disable_rbg0 ( void )

Disable 3D planes.

◆ jo_vdp2_draw_bitmap_nbg1_line()

void jo_vdp2_draw_bitmap_nbg1_line ( int x0,
int y0,
int x1,
int y1,
const jo_color color )

Draw a NBG1 line using Bresenham's line algorithm.

Parameters
x0horizontal location of the beginning of the line
y0vertical location of the beginning of the line
x1horizontal location of the end of the line
y1vertical location of the end of the line
colorColor (ex: JO_COLOR_Red)

◆ jo_vdp2_draw_bitmap_nbg1_square()

__jo_force_inline void jo_vdp2_draw_bitmap_nbg1_square ( const int x,
const int y,
const short width,
const short height,
const jo_color color )
static

Draw a square on NBG1.

Parameters
xSquare horizontal location
ySquare vertical location
widthSquare width
heightSquare height
colorColor (ex: JO_COLOR_Red)

◆ jo_vdp2_draw_rbg0_plane_a()

void jo_vdp2_draw_rbg0_plane_a ( const bool use_scroll_format_matrix)

Draw plane A.

Parameters
use_scroll_format_matrixConvert current matrix to scroll format matrix

◆ jo_vdp2_draw_rbg0_plane_b()

void jo_vdp2_draw_rbg0_plane_b ( const bool use_scroll_format_matrix)

Draw plane B.

Parameters
use_scroll_format_matrixConvert current matrix to scroll format matrix

◆ jo_vdp2_draw_rbg0_plane_b_flat()

void jo_vdp2_draw_rbg0_plane_b_flat ( const int x,
const int y )

Draw plane B as a flat image, without perspective: a sky behind the plane A (sea, ground).

Parameters
xHorizontal position in the image of the left of the screen (pixels, the image is repeated horizontally)
yVertical position in the image of the top of the screen (pixels)
Remarks
The plane B is displayed where the plane A is transparent: above its horizon and after its far limit (see jo_vdp2_set_rbg0_far_limit()). Above the image (y < 0), the top left cell (8 x 8 pixels) of the image is repeated: the top of the image must be one color (the top of the sky). Below the image, the image is repeated (hidden by the plane A)
The image (jo_vdp2_set_rbg0_plane_b_8bits_image()) must be as wide as the plane (512 pixels) or a divisor of it
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_enable_nbg0_line_scroll()

int * jo_vdp2_enable_nbg0_line_scroll ( void )

Enable NBG0 horizontal line scroll effect.

Returns
An array of 512 entries. One offset for each line because the background size is a 512x512 pixels by default.
Warning
Only works with 8 bits background image

◆ jo_vdp2_enable_nbg1_line_scroll()

int * jo_vdp2_enable_nbg1_line_scroll ( void )

Enable NBG1 horizontal line scroll effect.

Returns
An array of 512 entries. One offset for each line because the background size is a 512x512 pixels by default.
Warning
Only works with 8 bits background image

◆ jo_vdp2_enable_nbg1_vertical_cell_scroll()

int * jo_vdp2_enable_nbg1_vertical_cell_scroll ( void )

Enable the NBG1 vertical cell scroll: each column of 8 pixels of the screen is moved vertically by its own offset (added to the vertical scroll of the screen).

Returns
An array of JO_NBG1_VERTICAL_CELL_SCROLL_TABLE_SIZE jo_fixed offsets in VRAM (from the left of the screen, all 0 at first), JO_NULL when there is no memory
Remarks
Needs a free VRAM access slot (T0 to T2) in the bank of the table: without it, the offsets are ignored
Works with a bitmap or a cell screen, without the line scroll of NBG1

◆ jo_vdp2_enable_rbg0()

void jo_vdp2_enable_rbg0 ( void )

Enable 3D planes.

◆ jo_vdp2_move_nbg0()

void jo_vdp2_move_nbg0 ( const int x,
const int y )

Move NBG0 (scrolling).

Parameters
xhorizontal location
yvertical location

◆ jo_vdp2_move_nbg1()

void jo_vdp2_move_nbg1 ( const int x,
const int y )

Move NBG1 (scrolling).

Parameters
xhorizontal location
yvertical location

◆ jo_vdp2_put_pixel_bitmap_nbg1()

__jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1 ( const int x,
const int y,
const jo_color color )
static

Put pixel in NBG1 using color.

Parameters
xhorizontal location
yvertical location
colorColor (ex: JO_COLOR_Red)

◆ jo_vdp2_put_pixel_bitmap_nbg1_rgb()

__jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1_rgb ( const int x,
const int y,
unsigned char r,
unsigned char g,
unsigned char b )
static

Put pixel in NBG1 using composite color.

Parameters
xhorizontal location
yvertical location
rRed color component
gGreen color component
bBlue color component

◆ jo_vdp2_replace_rbg0_plane_a_8bits_image()

void jo_vdp2_replace_rbg0_plane_a_8bits_image ( jo_img_8bits * img,
bool vertical_flip )

Replace plane A image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
vertical_flipFlip image vertically
Warning
jo_vdp2_set_rbg0_plane_a_8bits_image() MUST be called before
Image need to be clockwised rotated (right) because of an optimisation and the previous palette is preserved

◆ jo_vdp2_replace_rbg0_plane_b_8bits_image()

void jo_vdp2_replace_rbg0_plane_b_8bits_image ( jo_img_8bits * img,
bool vertical_flip )

Replace plane B image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
vertical_flipFlip image vertically
Warning
jo_vdp2_set_rbg0_plane_b_8bits_image() MUST be called before
Image need to be clockwised rotated (right) because of an optimisation and the previous palette is preserved

◆ jo_vdp2_set_nbg0_8bits_image()

void jo_vdp2_set_nbg0_8bits_image ( jo_img_8bits * img,
int palette_id,
bool vertical_flip,
bool enabled )

Set 8 bits NBG0 image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
enabledDisplay NBG0 now
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg1_8bits_image()

void jo_vdp2_set_nbg1_8bits_image ( jo_img_8bits * img,
int palette_id,
bool vertical_flip )

Add 8 bits NBG1 image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg1_8bits_image_repeat()

void jo_vdp2_set_nbg1_8bits_image_repeat ( jo_img_8bits * img,
int palette_id,
bool vertical_flip,
bool repeat )

Add 8 bits NBG1 image, repeated or not.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8, 512 x 512 at most)
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
repeattrue: the image is repeated in the 512 x 512 pixels of the screen; false: transparent out of the image (shows an empty cell of the image there: repeated when the image has no 8 x 8 transparent cell)
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg1_image()

void jo_vdp2_set_nbg1_image ( const jo_img *const img,
short left,
short top )

Set NBG1 bitmap image.

Parameters
imgPointer to an image struct
leftLeft location
topTop location

◆ jo_vdp2_set_nbg2_8bits_font()

void jo_vdp2_set_nbg2_8bits_font ( jo_img_8bits * img,
char * mapping,
int palette_id,
bool vertical_flip,
bool enabled )

Set 8 bits NBG2 font image.

Parameters
img8 bits 255 colors max image. (height must be a multiple of 8). Width must be 8.
mappingImage pattern : " 0123456789ABCDEFGH...". The first character must be an empty space.
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
enabledDisplay NBG2 now
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg2_8bits_image()

void jo_vdp2_set_nbg2_8bits_image ( jo_img_8bits * img,
int palette_id,
bool vertical_flip,
bool enabled )

Set 8 bits NBG2 image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
enabledDisplay NBG2 now
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg3_8bits_font()

void jo_vdp2_set_nbg3_8bits_font ( jo_img_8bits * img,
char * mapping,
int palette_id,
bool vertical_flip,
bool enabled )

Set 8 bits NBG3 font image.

Parameters
img8 bits 255 colors max image. (height must be a multiple of 8). Width must be 8
mappingImage pattern : "0123456789ABCDEFGH...". The first character must be an empty space.
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
enabledDisplay NBG2 now
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_nbg3_8bits_image()

void jo_vdp2_set_nbg3_8bits_image ( jo_img_8bits * img,
int palette_id,
bool vertical_flip,
bool enabled )

Set 8 bits NBG3 image.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
vertical_flipFlip image vertically
enabledDisplay NBG3 now
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_rbg0_far_limit()

void jo_vdp2_set_rbg0_far_limit ( const int max_zoom_out)

Hide the farthest part of the 3D planes (the back screen is visible instead).

Parameters
max_zoom_outBiggest reduction of the texture (0: no limit, 16: the plane stops where 16 texels are in 1 pixel)
Remarks
Far away, a plane is very reduced and looks noisy: with a back screen color like the horizon, it fades in the distance

◆ jo_vdp2_set_rbg0_plane_a_8bits_image()

void jo_vdp2_set_rbg0_plane_a_8bits_image ( jo_img_8bits * img,
int palette_id,
bool repeat,
bool vertical_flip )

Setup plane A.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
repeatRepeat the plane infinitely.
vertical_flipFlip image vertically
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_set_rbg0_plane_b_8bits_image()

void jo_vdp2_set_rbg0_plane_b_8bits_image ( jo_img_8bits * img,
int palette_id,
bool repeat,
bool vertical_flip )

Setup plane B.

Parameters
img8 bits 255 colors max image. (Width AND height must be a multiple of 8)
palette_idpalette id from TGA (see also jo_palette)
repeatRepeat the plane infinitely.
vertical_flipFlip image vertically
Warning
Image need to be clockwised rotated (right) because of an optimisation

◆ jo_vdp2_zoom_nbg0()

__jo_force_inline void jo_vdp2_zoom_nbg0 ( const float factor)
static

Zoom NBG0.

Parameters
factorZoom factor

◆ jo_vdp2_zoom_nbg0f()

void jo_vdp2_zoom_nbg0f ( const float width_factor,
const float height_factor )

Zoom NBG0 width and height independently.

Parameters
width_factorWidth zoom factor
height_factorHeight zoom factor

◆ jo_vdp2_zoom_nbg1()

__jo_force_inline void jo_vdp2_zoom_nbg1 ( const float factor)
static

Zoom NBG1.

Parameters
factorZoom factor

◆ jo_vdp2_zoom_nbg1f()

void jo_vdp2_zoom_nbg1f ( const float width_factor,
const float height_factor )

Zoom NBG1 width and height independently.

Parameters
width_factorWidth zoom factor
height_factorHeight zoom factor

◆ sprintf()

int sprintf ( char * str,
const char * format,
... )

sprintf prototypes

Parameters
strString
formatFormat string
...Arguments
Returns
If successful, the total number of characters written is returned excluding the null-character appended at the end of the string, otherwise a negative number is returned in case of failure.

Variable Documentation

◆ __jo_sprintf_buf

char __jo_sprintf_buf[JO_PRINTF_BUF_SIZE]
extern

Internal sprintf buffer.

Warning
MC Hammer: don't touch this

◆ __jo_vdp2_nbg1_bitmap_reserved

bool __jo_vdp2_nbg1_bitmap_reserved
extern

The NBG1 bitmap is in the VRAM (Internal usage, see __jo_vdp2_reserve_nbg1_bitmap()).