Jo Engine 2026.11.6
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
vdp2.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35 /*
36 ▲ IMPORTANT NOTE ABOUT VDP2 USAGE (extract from ST-058-R2-060194.pdf p61):
37 Depending on the color count of NBG0 and NBG1, the scroll screen that cannot be displayed will appear.
38
39 - When NBG0 is set as 2048 or 32768 colors, NBG2 can not longer be displayed.
40 - When NBG0 is set at 16,770,000 colors, NBG1 to NBG3 can not longer be displayed.
41 - When NBG1 is set at 2048 or 32768 colors, NBG3 can longer be displayed.
42 */
43
44#ifndef __JO_VDP2_H__
45# define __JO_VDP2_H__
46
53int sprintf(char* str, const char* format, ...);
54
59
63void jo_set_displayed_screens(const jo_scroll_screen scroll_screen_flags);
64
68void jo_set_default_background_color(const jo_color background_color);
69
75void jo_set_background_line_colors(const jo_color * const colors);
76
77/*
78███╗ ██╗██████╗ ██████╗ ██████╗ ██╗██████╗ ███████╗ ██████╗ ███╗ ██╗████████╗
79████╗ ██║██╔══██╗██╔════╝ ╚════██╗ ██╔╝╚════██╗ ██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝
80██╔██╗ ██║██████╔╝██║ ███╗ █████╔╝ ██╔╝ █████╔╝ █████╗ ██║ ██║██╔██╗ ██║ ██║
81██║╚██╗██║██╔══██╗██║ ██║██╔═══╝ ██╔╝ ╚═══██╗ ██╔══╝ ██║ ██║██║╚██╗██║ ██║
82██║ ╚████║██████╔╝╚██████╔╝███████╗██╔╝ ██████╔╝ ██║ ╚██████╔╝██║ ╚████║ ██║
83╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝
84*/
85
86#ifndef JO_COMPILE_WITH_PRINTF_SUPPORT
87
93void jo_nbg2_print(int x, int y, char * str);
94
100# define jo_nbg2_printf(X, Y, ...) do {jo_snprintf(__jo_sprintf_buf, JO_PRINTF_BUF_SIZE, __VA_ARGS__); jo_nbg2_print(X, Y, __jo_sprintf_buf); } while(0)
101
110void jo_vdp2_set_nbg2_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled);
111
114void jo_nbg2_clear(void);
115
121void jo_nbg3_print(int x, int y, char * str);
122
128# define jo_nbg3_printf(X, Y, ...) do {jo_snprintf(__jo_sprintf_buf, JO_PRINTF_BUF_SIZE, __VA_ARGS__); jo_nbg3_print(X, Y, __jo_sprintf_buf); } while(0)
129
138void jo_vdp2_set_nbg3_8bits_font(jo_img_8bits *img, char *mapping, int palette_id, bool vertical_flip, bool enabled);
139
142void jo_nbg3_clear(void);
143
144#endif
145
146/*
147██████╗ ██████╗ █████╗ ██╗ ██╗ ██╗███╗ ███╗ █████╗ ██████╗ ███████╗
148██╔══██╗██╔══██╗██╔══██╗██║ ██║ ██║████╗ ████║██╔══██╗██╔════╝ ██╔════╝
149██║ ██║██████╔╝███████║██║ █╗ ██║ ██║██╔████╔██║███████║██║ ███╗█████╗
150██║ ██║██╔══██╗██╔══██║██║███╗██║ ██║██║╚██╔╝██║██╔══██║██║ ██║██╔══╝
151██████╔╝██║ ██║██║ ██║╚███╔███╔╝ ██║██║ ╚═╝ ██║██║ ██║╚██████╔╝███████╗
152╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝
153
154*/
155
162void jo_vdp2_set_nbg1_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip);
163
172void jo_vdp2_set_nbg1_8bits_image_repeat(jo_img_8bits *img, int palette_id, bool vertical_flip, bool repeat);
173
174#ifndef JO_COMPILE_WITH_PRINTF_SUPPORT
182void jo_vdp2_set_nbg0_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
183#endif
184
192void jo_vdp2_set_nbg2_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
193
201void jo_vdp2_set_nbg3_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled);
202
213bool jo_vdp2_set_nbg1_8bits_bitmap(const int palette_id);
214
217
222
227
231void jo_vdp2_clear_bitmap_nbg1_8bits(const unsigned char index);
232
238void jo_vdp2_put_pixel_bitmap_nbg1_8bits(const int x, const int y, const unsigned char index);
239
245void jo_vdp2_draw_bitmap_nbg1_8bits_image(const jo_img_8bits * const img, const int x, const int y);
246
252void jo_vdp2_set_nbg1_image(const jo_img * const img, short left, short top);
253
256
265
270
271/*
272███╗ ███╗ ██████╗ ██╗ ██╗███████╗ ██╗ ███████╗ ██████╗ ██████╗ ███╗ ███╗
273████╗ ████║██╔═══██╗██║ ██║██╔════╝ ██║ ╚══███╔╝██╔═══██╗██╔═══██╗████╗ ████║
274██╔████╔██║██║ ██║██║ ██║█████╗ ████████╗ ███╔╝ ██║ ██║██║ ██║██╔████╔██║
275██║╚██╔╝██║██║ ██║╚██╗ ██╔╝██╔══╝ ██╔═██╔═╝ ███╔╝ ██║ ██║██║ ██║██║╚██╔╝██║
276██║ ╚═╝ ██║╚██████╔╝ ╚████╔╝ ███████╗ ██████║ ███████╗╚██████╔╝╚██████╔╝██║ ╚═╝ ██║
277╚═╝ ╚═╝ ╚═════╝ ╚═══╝ ╚══════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝
278
279*/
280
287void jo_vdp2_move_nbg1(const int x, const int y);
288
294
299void jo_vdp2_zoom_nbg1f(const float width_factor, const float height_factor);
300
306void jo_vdp2_zoom_nbg1_fixed(const jo_fixed width_factor, const jo_fixed height_factor);
307
311static __jo_force_inline void jo_vdp2_zoom_nbg1(const float factor)
312{
313 jo_vdp2_zoom_nbg1f(factor, factor);
314}
315
322void jo_vdp2_move_nbg0(const int x, const int y);
323
328void jo_vdp2_zoom_nbg0f(const float width_factor, const float height_factor);
329
335void jo_vdp2_zoom_nbg0_fixed(const jo_fixed width_factor, const jo_fixed height_factor);
336
342
346static __jo_force_inline void jo_vdp2_zoom_nbg0(const float factor)
347{
348 jo_vdp2_zoom_nbg0f(factor, factor);
349}
350
351/*
352██████╗ █████╗ ███████╗██╗ ██████╗ ██████╗ ██████╗ █████╗ ██╗ ██╗██╗███╗ ██╗ ██████╗
353██╔══██╗██╔══██╗██╔════╝██║██╔════╝ ██╔══██╗██╔══██╗██╔══██╗██║ ██║██║████╗ ██║██╔════╝
354██████╔╝███████║███████╗██║██║ ██║ ██║██████╔╝███████║██║ █╗ ██║██║██╔██╗ ██║██║ ███╗
355██╔══██╗██╔══██║╚════██║██║██║ ██║ ██║██╔══██╗██╔══██║██║███╗██║██║██║╚██╗██║██║ ██║
356██████╔╝██║ ██║███████║██║╚██████╗ ██████╔╝██║ ██║██║ ██║╚███╔███╔╝██║██║ ╚████║╚██████╔╝
357╚═════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
358*
359** ▲ ONLY WORKS IN BITMAP MODE
360*/
361
369void jo_vdp2_draw_bitmap_nbg1_line(int x0, int y0, int x1, int y1, const jo_color color);
370
378static __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)
379{
380 jo_vdp2_draw_bitmap_nbg1_line(x, y, x + width, y, color);
381 jo_vdp2_draw_bitmap_nbg1_line(x + width, y + height, x + width, y, color);
382 jo_vdp2_draw_bitmap_nbg1_line(x, y + height, x + width, y + height, color);
383 jo_vdp2_draw_bitmap_nbg1_line(x, y + height, x, y, color);
384}
385
391static __jo_force_inline void jo_vdp2_put_pixel_bitmap_nbg1(const int x, const int y, const jo_color color)
392{
393 // (the bitmap at its first use, see __jo_vdp2_reserve_nbg1_bitmap())
395 return;
396 *(((unsigned short *)JO_VDP2_VRAM_A0) + x + y * JO_VDP2_WIDTH) = color;
397}
398
406static __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)
407{
409}
410
411/*
412██████╗ ██████╗ ██████╗ ██╗ █████╗ ███╗ ██╗███████╗███████╗
413╚════██╗██╔══██╗ ██╔══██╗██║ ██╔══██╗████╗ ██║██╔════╝██╔════╝
414 █████╔╝██║ ██║ ██████╔╝██║ ███████║██╔██╗ ██║█████╗ ███████╗
415 ╚═══██╗██║ ██║ ██╔═══╝ ██║ ██╔══██║██║╚██╗██║██╔══╝ ╚════██║
416██████╔╝██████╔╝ ██║ ███████╗██║ ██║██║ ╚████║███████╗███████║
417╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝
418** - Two planes are available: A and B
419** - Each plane is 512 x 512 size
420*/
421
425
430void jo_vdp2_set_rbg0_far_limit(const int max_zoom_out);
431
435
443void jo_vdp2_set_rbg0_plane_a_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip);
444
453void jo_vdp2_set_rbg0_plane_a_8bits_island(jo_img_8bits *img, int palette_id, bool vertical_flip);
454
462void jo_vdp2_set_rbg0_plane_b_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip);
463
471
479
480
486void jo_vdp2_draw_rbg0_plane_a(const bool use_scroll_format_matrix);
487
493void jo_vdp2_draw_rbg0_plane_b(const bool use_scroll_format_matrix);
494
506void jo_vdp2_draw_rbg0_plane_b_flat(const int x, const int y);
507
508
509/*
510███╗ ███╗ ██████╗ ███████╗ █████╗ ██╗ ██████╗
511████╗ ████║██╔═══██╗╚══███╔╝██╔══██╗██║██╔════╝
512██╔████╔██║██║ ██║ ███╔╝ ███████║██║██║
513██║╚██╔╝██║██║ ██║ ███╔╝ ██╔══██║██║██║
514██║ ╚═╝ ██║╚██████╔╝███████╗██║ ██║██║╚██████╗
515╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═════╝
516*/
517
518
525void jo_enable_screen_mozaic(const jo_scroll_screen screens, short x, short y);
526
530
531
532/*
533██╗ ██╗ ██████╗ ██████╗ ██╗███████╗ ██████╗ ███╗ ██╗████████╗ █████╗ ██╗
534██║ ██║██╔═══██╗██╔══██╗██║╚══███╔╝██╔═══██╗████╗ ██║╚══██╔══╝██╔══██╗██║
535███████║██║ ██║██████╔╝██║ ███╔╝ ██║ ██║██╔██╗ ██║ ██║ ███████║██║
536██╔══██║██║ ██║██╔══██╗██║ ███╔╝ ██║ ██║██║╚██╗██║ ██║ ██╔══██║██║
537██║ ██║╚██████╔╝██║ ██║██║███████╗╚██████╔╝██║ ╚████║ ██║ ██║ ██║███████╗
538╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚═╝ ╚═╝╚══════╝
539
540██╗ ██╗███╗ ██╗███████╗ ███████╗ ██████╗██████╗ ██████╗ ██╗ ██╗
541██║ ██║████╗ ██║██╔════╝ ██╔════╝██╔════╝██╔══██╗██╔═══██╗██║ ██║
542██║ ██║██╔██╗ ██║█████╗ ███████╗██║ ██████╔╝██║ ██║██║ ██║
543██║ ██║██║╚██╗██║██╔══╝ ╚════██║██║ ██╔══██╗██║ ██║██║ ██║
544███████╗██║██║ ╚████║███████╗ ███████║╚██████╗██║ ██║╚██████╔╝███████╗███████╗
545╚══════╝╚═╝╚═╝ ╚═══╝╚══════╝ ╚══════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚══════╝
546
547▲ ONLY WORKS IF BACKGROUND IMAGE IS LOADED THROUH jo_vdp2_set_nbg1_8bits_image() ▲
548 OTHERWISE IT MAY GLITCH
549*/
550
553# define JO_NBG1_SCROLL_TABLE_SIZE (512)
554
560
564
566# define JO_NBG1_SCROLL_XY_TABLE_LINES (256)
567
578
582void jo_vdp2_compute_nbg1_line_scroll(unsigned short offset);
583
587# define JO_NBG1_VERTICAL_CELL_SCROLL_TABLE_SIZE (64)
588
597
601
604# define JO_NBG0_SCROLL_TABLE_SIZE (512)
605
611
615
619void jo_vdp2_compute_nbg0_line_scroll(unsigned short offset);
620
621/*
622████████╗██████╗ █████╗ ███╗ ██╗███████╗██████╗ █████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ ██╗
623╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝
624 ██║ ██████╔╝███████║██╔██╗ ██║███████╗██████╔╝███████║██████╔╝█████╗ ██╔██╗ ██║██║ ╚████╔╝
625 ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██╔═══╝ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ╚██╔╝
626 ██║ ██║ ██║██║ ██║██║ ╚████║███████║██║ ██║ ██║██║ ██║███████╗██║ ╚████║╚██████╗ ██║
627 ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝
628
629*/
630
634
639void jo_enable_screen_transparency(const jo_scroll_screen screen, const unsigned short transparency_level);
640
644# define JO_VDP2_ADDITIVE_SPRITE_BANK (0x6000)
645
654
657
658/*
659** Windows: the screens shown only in a part of the screen (or hidden there)
660*/
661
663# define JO_VDP2_WINDOW_0 (0)
665# define JO_VDP2_WINDOW_1 (1)
666
675
684void jo_vdp2_set_window(const int window, int x, int y, int width, int height);
685
694bool jo_vdp2_set_window_lines(const int window, const int top, const int count, const short * const left, const short * const right);
695
703bool jo_vdp2_set_window_circle(const int window, const int x, const int y, const int radius);
704
711void jo_vdp2_enable_window(const jo_scroll_screen screens, const int window, const jo_vdp2_window_area area);
712
717
718/*
719** Color calculation: the screens mixed with the image under them
720*/
721
734
736# define JO_VDP2_BLEND_RATIO_MAX (31)
737
742
748void jo_vdp2_enable_blend(const jo_scroll_screen screens, unsigned char ratio);
749
756void jo_vdp2_blend_rgb_sprites_only(const bool rgb_only);
757
762
763/*
764** Line color screen: a color for each line, mixed with a screen instead of the image under it (fog that thickens toward
765** the horizon, a gradient over a floor or a sea)
766*/
767
769# define JO_VDP2_LINE_COLOR_LINES (512)
770
775# define JO_VDP2_LINE_COLOR(PALETTE_ID, INDEX) ((unsigned short)((PALETTE_ID) * 256 + (INDEX)))
776
784bool jo_vdp2_set_line_colors(const unsigned short * const colors, const int count);
785
790bool jo_vdp2_set_line_color(const unsigned short color);
791
801
806
817
820
821/*
822** Sprites of the 640 and 704 pixels modes (8 bits per pixel: the color index of a sprite is also its priority or its
823** transparency)
824*/
825
837
843
852void jo_vdp2_set_sprite_priorities(const unsigned char p0, const unsigned char p1, const unsigned char p2, const unsigned char p3);
853
862void jo_vdp2_set_sprite_blend_ratios(const unsigned char r0, const unsigned char r1, const unsigned char r2, const unsigned char r3);
863
864/*
865** Special colors: some colors of a palette screen have their own priority or their own transparency
866*/
867
871# define JO_VDP2_SPECIAL_COLOR(INDEX) ((unsigned char)(1 << (((INDEX) & 15) >> 1)))
872
877void jo_vdp2_set_special_colors(const unsigned char codes);
878
886
891
897
902
903/*
904** Shadows: the sprites drawn with JO_VDP2_SHADOW_COLOR darken the screens under them
905*/
906
910# define JO_VDP2_SHADOW_COLOR (0x07FE)
911
916
919
920/*
921** Mosaic
922*/
923
929void jo_vdp2_enable_mosaic(const jo_scroll_screen screens, const int width, const int height);
930
933
934/*
935** Registers
936*/
937
943const unsigned short *jo_vdp2_get_registers(void);
944
952
953#endif /* !__JO_VDP2_H__ */
954
955/*
956** END OF FILE
957*/
#define JO_COLOR_SATURN_RGB(R, G, B)
Internal, you should not use this macro.
Definition colors.h:92
#define JO_PRINTF_BUF_SIZE
Max character in available in jo_printf().
Definition conf.h:146
#define JO_VDP2_WIDTH
VDP2 Background bitmap width.
Definition conf.h:141
int radius
Definition entity.h:3
int height
Definition entity.h:4
#define JO_VDP2_VRAM_A0
VDP2 VRAM Bank A0 (128 kilobytes).
Definition sega_saturn.h:145
int sprintf(char *str, const char *format,...)
sprintf prototypes
char __jo_sprintf_buf[JO_PRINTF_BUF_SIZE]
Internal sprintf buffer.
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
unsigned short jo_color
15 bits color type
Definition types.h:53
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
jo_scroll_screen
Sega Saturn Scroll Screen Ids.
Definition types.h:340
15 bits image struct
Definition types.h:242
8 bits image struct
Definition types.h:250
void jo_enable_additive_sprites(void)
The light of the additive sprites is added to the image under them (the VDP2 color calculation "add",...
void jo_enable_screen_mozaic(const jo_scroll_screen screens, short x, short y)
Enable mozaic effect for scroll screen.
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.
Definition vdp2.h:391
void jo_vdp2_set_rbg0_plane_a_8bits_image(jo_img_8bits *img, int palette_id, bool repeat, bool vertical_flip)
Setup plane A.
bool jo_vdp2_set_window_lines(const int window, const int top, const int count, const short *const left, const short *const right)
Set a window of any shape: its left and right pixels on each line.
void jo_nbg2_print(int x, int y, char *str)
NBG2 Print implementation.
void jo_vdp2_disable_special_priority(const jo_scroll_screen screens)
The screens have one priority again (see jo_vdp2_enable_special_priority()).
void jo_vdp2_zoom_nbg1f(const float width_factor, const float height_factor)
Zoom NBG1 width and height independently.
void jo_vdp2_disable_line_color(const jo_scroll_screen screens)
The screens are no longer mixed with the line color screen (see jo_vdp2_enable_line_color()).
void jo_vdp2_set_nbg2_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip, bool enabled)
Set 8 bits NBG2 image.
bool jo_vdp2_enable_blur(const jo_scroll_screen screen)
Blur a screen horizontally where it is mixed: under a transparent screen (jo_vdp2_enable_blend()),...
void jo_nbg3_clear(void)
Clear NBG3.
void jo_vdp2_enable_special_blend(const jo_scroll_screen screens)
Only the special colors of the screens are mixed (jo_vdp2_enable_blend()): the other pixels are opaqu...
void jo_set_displayed_screens(const jo_scroll_screen scroll_screen_flags)
Set displayed screens.
void jo_vdp2_set_special_colors(const unsigned char codes)
Choose the special colors of the screens (see jo_vdp2_enable_special_priority() and jo_vdp2_enable_sp...
jo_vdp2_window_area
Where the screens of a window are shown (see jo_vdp2_enable_window()).
Definition vdp2.h:669
@ JO_VDP2_WINDOW_SHOW_OUTSIDE
The screens are hidden inside the window.
Definition vdp2.h:673
@ JO_VDP2_WINDOW_SHOW_INSIDE
The screens are shown only inside the window.
Definition vdp2.h:671
void jo_vdp2_enable_window(const jo_scroll_screen screens, const int window, const jo_vdp2_window_area area)
Show screens only inside a window, or hide them there.
jo_vdp2_hires_sprite_mode
What the 2 highest bits of the color index of a sprite choose in the 640 and 704 pixels modes.
Definition vdp2.h:828
@ JO_VDP2_HIRES_SPRITES_PRIORITY
The priority (jo_vdp2_set_sprite_priorities()): the colors 0 to 63 at the priority 0,...
Definition vdp2.h:833
@ JO_VDP2_HIRES_SPRITES_PRIORITY_BLEND
The bit 7 the priority (0 or 1), the bit 6 the blend ratio (0 or 1).
Definition vdp2.h:835
@ JO_VDP2_HIRES_SPRITES_BLEND
The blend ratio (jo_vdp2_set_sprite_blend_ratios()): 256 colors, one priority (default).
Definition vdp2.h:830
void jo_vdp2_set_sprite_priorities(const unsigned char p0, const unsigned char p1, const unsigned char p2, const unsigned char p3)
The priorities of the sprites (by default all the sprites have the priority of jo_core_set_screens_or...
void jo_vdp2_draw_rbg0_plane_b(const bool use_scroll_format_matrix)
Draw plane B.
void jo_vdp2_zoom_nbg0f(const float width_factor, const float height_factor)
Zoom NBG0 width and height independently.
void jo_disable_additive_sprites(void)
The additive sprites are opaque again (see jo_enable_additive_sprites()).
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_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_vdp2_enable_mosaic(const jo_scroll_screen screens, const int width, const int height)
Enable the mosaic effect (big pixels).
void jo_vdp2_move_nbg1(const int x, const int y)
Move NBG1 (scrolling).
bool jo_vdp2_set_window_circle(const int window, const int x, const int y, const int radius)
Set a round window (a spotlight, a transition).
bool jo_vdp2_set_line_colors(const unsigned short *const colors, const int count)
Set one color for each line of the line color screen.
static __jo_force_inline void jo_vdp2_zoom_nbg0(const float factor)
Zoom NBG0.
Definition vdp2.h:346
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_vdp2_set_nbg1_16bits_bitmap(void)
The NBG1 bitmap in 32768 colors again (see jo_vdp2_set_nbg1_8bits_bitmap()): draw it again.
const unsigned short * jo_vdp2_get_registers(void)
The values the engine gave to the VDP2 registers (most of them can't be read from the VDP2): the next...
void jo_vdp2_draw_rbg0_plane_a(const bool use_scroll_format_matrix)
Draw plane A.
int * jo_vdp2_enable_nbg1_line_scroll_xy(void)
Enable the NBG1 horizontal and vertical line scroll: each line of the screen shows its own part of th...
void jo_vdp2_disable_window(const jo_scroll_screen screens)
The screens are shown on all the screen again (see jo_vdp2_enable_window()).
void jo_vdp2_enable_line_color(const jo_scroll_screen screens)
Mix screens with the line color screen instead of the image under them (as slLineColDisp() of the SGL...
void jo_vdp2_disable_special_blend(const jo_scroll_screen screens)
All the pixels of the screens are mixed again (see jo_vdp2_enable_special_blend()).
void jo_vdp2_disable_nbg0_line_scroll(void)
Disable NBG0 horizontal line scroll effect.
void jo_vdp2_draw_bitmap_nbg1_8bits_image(const jo_img_8bits *const img, const int x, const int y)
Copy an image in the 256 colors NBG1 bitmap (see jo_vdp2_set_nbg1_8bits_bitmap()).
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_disable_shadow(void)
No screen is darkened by the shadows (see jo_vdp2_enable_shadow()).
static __jo_force_inline void jo_vdp2_zoom_nbg1(const float factor)
Zoom NBG1.
Definition vdp2.h:311
void jo_vdp2_enable_rbg0(void)
Enable 3D planes.
int * jo_vdp2_enable_nbg1_line_scroll(void)
Enable NBG1 horizontal line scroll effect.
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_set_rbg0_plane_a_8bits_island(jo_img_8bits *img, int palette_id, bool vertical_flip)
Setup plane A as an island: the image once, its top left cell (8 x 8 pixels) repeated around it to th...
void jo_vdp2_enable_shadow(const jo_scroll_screen screens)
The shadows darken these screens.
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_compute_nbg0_line_scroll(unsigned short offset)
Compute NBG0 horizontal line scroll effect using specific offset.
void jo_vdp2_clear_bitmap_nbg1_8bits(const unsigned char index)
Fill the 256 colors NBG1 bitmap (see jo_vdp2_set_nbg1_8bits_bitmap()).
int jo_vdp2_get_nbg1_8bits_bitmap_width(void)
Width of the 256 colors NBG1 bitmap (see jo_vdp2_set_nbg1_8bits_bitmap()).
jo_vdp2_blend_mode
How the screens are mixed with the image under them (see jo_vdp2_set_blend_mode()).
Definition vdp2.h:724
@ JO_VDP2_BLEND_EXTENDED
Option of JO_VDP2_BLEND_RATIO and JO_VDP2_BLEND_ADD (example: JO_VDP2_BLEND_RATIO | JO_VDP2_BLEND_EXT...
Definition vdp2.h:732
@ JO_VDP2_BLEND_RATIO
A part of the color of the screen and a part of the image under it (transparency).
Definition vdp2.h:726
@ JO_VDP2_BLEND_ADD
The color of the screen is added to the image under it (light, fire, glow).
Definition vdp2.h:728
int * jo_vdp2_enable_nbg0_line_scroll(void)
Enable NBG0 horizontal line scroll effect.
bool __jo_vdp2_nbg1_bitmap_reserved
The NBG1 bitmap is in the VRAM (Internal usage, see __jo_vdp2_reserve_nbg1_bitmap()).
void jo_vdp2_replace_rbg0_plane_b_8bits_image(jo_img_8bits *img, bool vertical_flip)
Replace plane B image.
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.
Definition vdp2.h:378
bool __jo_vdp2_reserve_nbg1_bitmap(void)
Allocate and display the NBG1 bitmap at its first use (Internal usage).
bool jo_vdp2_set_nbg1_8bits_bitmap(const int palette_id)
The NBG1 bitmap in 256 colors at the resolution of the screen (one pixel of the bitmap = one pixel of...
void jo_vdp2_disable_rbg0(void)
Disable 3D planes.
void jo_vdp2_disable_blend(const jo_scroll_screen screens)
The screens are opaque again (see jo_vdp2_enable_blend()).
void jo_vdp2_move_nbg0_fixed(const jo_fixed x, const jo_fixed y)
Scroll NBG0 with a fraction of pixel (fixed point: 8 bits of fraction are used).
void jo_vdp2_set_nbg1_image(const jo_img *const img, short left, short top)
Set NBG1 bitmap image.
void jo_disable_all_screen_mozaic(void)
Disable mozaic effect for all scroll screen.
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_vdp2_clear_bitmap_nbg1(const jo_color color)
Clear NBG1 bitmap.
bool jo_vdp2_set_line_color(const unsigned short color)
Set one color for the whole line color screen.
void jo_vdp2_set_nbg1_8bits_image(jo_img_8bits *img, int palette_id, bool vertical_flip)
Add 8 bits NBG1 image.
void jo_set_default_background_color(const jo_color background_color)
Set default background color.
void jo_vdp2_disable_nbg1_line_scroll(void)
Disable NBG1 horizontal line scroll effect.
void jo_vdp2_disable_blur(void)
No blur (see jo_vdp2_enable_blur()): the color RAM has 2048 colors again.
void jo_vdp2_zoom_nbg1_fixed(const jo_fixed width_factor, const jo_fixed height_factor)
Zoom NBG1 (fixed point: without the float functions of libgcc).
void jo_vdp2_enable_special_priority(const jo_scroll_screen screens)
The special colors of the screens are drawn one priority above the others pixels of the screen (a win...
void jo_vdp2_set_sprite_blend_ratios(const unsigned char r0, const unsigned char r1, const unsigned char r2, const unsigned char r3)
The 4 blend ratios of the sprites (jo_vdp2_enable_blend() gives the same ratio to all of them),...
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.
void jo_nbg2_clear(void)
Clear NBG2.
void jo_vdp2_enable_blend(const jo_scroll_screen screens, unsigned char ratio)
Mix screens with the image under them.
void jo_vdp2_put_pixel_bitmap_nbg1_8bits(const int x, const int y, const unsigned char index)
Put a pixel in the 256 colors NBG1 bitmap (see jo_vdp2_set_nbg1_8bits_bitmap()).
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_compute_nbg1_line_scroll(unsigned short offset)
Compute NBG1 horizontal line scroll effect using specific offset.
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.
Definition vdp2.h:406
void jo_vdp2_replace_rbg0_plane_a_8bits_image(jo_img_8bits *img, bool vertical_flip)
Replace plane A image.
void jo_vdp2_set_hires_sprite_mode(const jo_vdp2_hires_sprite_mode mode)
Choose what the color index of the sprites gives in the 640 and 704 pixels modes (sprite types F,...
void jo_vdp2_zoom_nbg0_fixed(const jo_fixed width_factor, const jo_fixed height_factor)
Zoom NBG0 (fixed point: without the float functions of libgcc).
void jo_nbg3_print(int x, int y, char *str)
NBG3 Print implementation.
void jo_vdp2_disable_nbg1_vertical_cell_scroll(void)
Disable the NBG1 vertical cell scroll and free its table.
void jo_vdp2_move_nbg0(const int x, const int y)
Move NBG0 (scrolling).
void jo_enable_screen_transparency(const jo_scroll_screen screen, const unsigned short transparency_level)
Enable screen transparency.
void jo_disable_all_screens_transparency(void)
Disable all screens transparency.
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 it...
int jo_vdp2_get_nbg1_8bits_bitmap_height(void)
Height of the 256 colors NBG1 bitmap (see jo_vdp2_set_nbg1_8bits_bitmap()).
void jo_vdp2_blend_rgb_sprites_only(const bool rgb_only)
Mix only the RGB pixels of the sprites (jo_vdp2_enable_blend(JO_SPRITE_SCREEN, ratio)): the palette p...
void jo_vdp2_restore(void)
Give the VDP2 back to the engine after the game wrote its registers and its VRAM by itself (a video i...
void jo_vdp2_set_window(const int window, int x, int y, int width, int height)
Set a rectangle window.
void jo_vdp2_move_nbg1_fixed(const jo_fixed x, const jo_fixed y)
Scroll NBG1 with a fraction of pixel (fixed point: 8 bits of fraction are used).
void jo_vdp2_disable_mosaic(void)
Disable the mosaic effect (see jo_vdp2_enable_mosaic()).
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_vdp2_set_blend_mode(const jo_vdp2_blend_mode mode)
Set how the screens are mixed (jo_vdp2_enable_blend()): the same for all the screens.