VMUPro SDK v1.0.0
Application Development SDK for the VMUPro
Loading...
Searching...
No Matches
vmupro_display.h
Go to the documentation of this file.
1
37#pragma once
38
39#include <stdint.h>
40#include <stdbool.h>
41
42#ifdef __cplusplus
43extern "C"
44{
45#endif
46
70
79
88
107
139 void vmupro_set_global_brightness(int brightness);
140
151
162
173
182
189
203
215
224
237 void vmupro_draw_rect(int x1, int y1, int x2, int y2, vmupro_color_t color);
238
251 void vmupro_draw_fill_rect(int x1, int y1, int x2, int y2, vmupro_color_t color);
252
269 void vmupro_blit_buffer_at(uint8_t *buffer, int x, int y, int width, int height);
270
285 void vmupro_blit_buffer_with_palette(uint8_t *buffer, int16_t *palette);
286
303 void vmupro_blit_buffer_transparent(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t transparent_color);
304
323 void vmupro_blit_buffer_blended(uint8_t *buffer, int x, int y, int width, int height, uint8_t alpha_level);
324
344 void vmupro_blit_buffer_dithered(uint8_t *buffer, int x, int y, int width, int height, int dither_strength);
345
361 void vmupro_blit_buffer_flip_h(uint8_t *buffer, int x, int y, int width, int height);
362
377 void vmupro_blit_buffer_flip_v(uint8_t *buffer, int x, int y, int width, int height);
378
400 void vmupro_blit_buffer_scaled(uint8_t* buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height,
401 int dest_x, int dest_y, int dest_width, int dest_height);
402
421 void vmupro_blit_buffer_rotated_90(uint8_t* buffer, int x, int y, int width, int height, int rotation);
422
441 void vmupro_blit_buffer_rotated_precise(uint8_t* buffer, int x, int y, int width, int height, int rotation_degrees);
442
460 void vmupro_blit_tile_pattern(uint8_t *tile_buffer, int tile_width, int tile_height,
461 int dest_x, int dest_y, int dest_width, int dest_height);
462
486 void vmupro_blit_buffer_advanced(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height,
487 int dest_x, int dest_y, int dest_width, int dest_height,
488 int flip_h, int flip_v, int transparent_color);
489
501 void vmupro_draw_line(int x1, int y1, int x2, int y2, vmupro_color_t color);
502
513 void vmupro_draw_circle(int cx, int cy, int radius, vmupro_color_t color);
514
525 void vmupro_draw_circle_filled(int cx, int cy, int radius, vmupro_color_t color);
526
538 void vmupro_draw_ellipse(int cx, int cy, int rx, int ry, vmupro_color_t color);
539
551 void vmupro_draw_ellipse_filled(int cx, int cy, int rx, int ry, vmupro_color_t color);
552
565 void vmupro_draw_polygon(int *points, int num_points, vmupro_color_t color);
566
579 void vmupro_draw_polygon_filled(int *points, int num_points, vmupro_color_t color);
580
595 void vmupro_flood_fill(int x, int y, vmupro_color_t fill_color, vmupro_color_t boundary_color);
596
611 void vmupro_flood_fill_tolerance(int x, int y, vmupro_color_t fill_color, int tolerance);
612
613 // Background Scrolling Functions
627 void vmupro_blit_scrolling_background(uint8_t *bg_buffer, int bg_width, int bg_height,
628 int scroll_x, int scroll_y, int dest_width, int dest_height);
629
643 void vmupro_blit_infinite_scrolling_background(uint8_t *tile_buffer, int tile_width, int tile_height,
644 int scroll_x, int scroll_y, int dest_width, int dest_height);
645
659 void vmupro_blit_parallax_background(uint8_t *bg_buffer, int bg_width, int bg_height,
660 int scroll_x, int scroll_y, int parallax_factor_x, int parallax_factor_y);
661
676 void vmupro_blit_multi_parallax(uint8_t **bg_layers, int *layer_widths, int *layer_heights, int num_layers,
677 int *parallax_factors_x, int *parallax_factors_y, int scroll_x, int scroll_y);
678
690 void vmupro_blit_line_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height,
691 int *scroll_x_per_line, int *scroll_y_per_line);
692
704 void vmupro_blit_column_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height,
705 int *scroll_x_per_column, int *scroll_y_per_column);
706
707 // Visual Effects Functions
720 void vmupro_blit_buffer_mosaic(uint8_t *buffer, int x, int y, int width, int height, int mosaic_size);
721
738 void vmupro_blit_buffer_blurred(uint8_t *buffer, int x, int y, int width, int height, int blur_radius);
739
751 void vmupro_apply_mosaic_to_screen(int x, int y, int width, int height, int mosaic_size);
752
765 void vmupro_blit_buffer_shadow_highlight(uint8_t *buffer, int x, int y, int width, int height, int mode);
766
781 void vmupro_blit_buffer_color_multiply(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_filter);
782
797 void vmupro_blit_buffer_color_add(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_offset);
798
799 // Collision Detection Functions
815 int vmupro_sprite_collision_check(int sprite1_x, int sprite1_y, int sprite1_w, int sprite1_h,
816 int sprite2_x, int sprite2_y, int sprite2_w, int sprite2_h);
817
835 int vmupro_sprite_pixel_collision(uint8_t *sprite1, uint8_t *sprite2, int x1, int y1, int x2, int y2,
836 int width1, int height1, int width2, int height2);
837
838 // Enhanced Blending Functions
851 void vmupro_blit_buffer_fixed_alpha(uint8_t *buffer, int x, int y, int width, int height, int alpha_mode);
852
863 void vmupro_blend_layers_additive(uint8_t *layer1, uint8_t *layer2, int width, int height);
864
875 void vmupro_blend_layers_multiply(uint8_t *layer1, uint8_t *layer2, int width, int height);
876
887 void vmupro_blend_layers_screen(uint8_t *layer1, uint8_t *layer2, int width, int height);
888
889 // Windowing & Masking Functions
901 void vmupro_set_color_window(int x1, int y1, int x2, int y2, vmupro_color_t mask_color);
902
915 void vmupro_blit_buffer_masked(uint8_t *buffer, uint8_t *mask, int x, int y, int width, int height);
916
923
924 // Palette Operations
939 void vmupro_blit_buffer_palette_swap(uint8_t *buffer, int x, int y, int width, int height,
940 uint16_t *old_palette, uint16_t *new_palette, int palette_size);
941
952 void vmupro_animate_palette_range(uint16_t *palette, int start_index, int end_index, int shift_amount);
953
965 void vmupro_interpolate_palette(uint16_t *palette1, uint16_t *palette2, uint16_t *result, int size, int factor_256);
966
967 // Sprite System
971 typedef struct {
972 uint8_t *buffer;
973 int x, y;
974 int width, height;
975 int flip_h, flip_v;
976 uint8_t alpha;
980
989 void vmupro_sprite_batch_render(vmupro_sprite_t *sprites, int num_sprites);
990
991 // Multi-Layer System
992 #define VMUPRO_MAX_LAYERS 8
993
997 typedef struct {
998 bool active;
999 uint8_t *buffer;
1000 int width, height;
1001 int scroll_x, scroll_y;
1003 uint8_t alpha;
1005
1015 void vmupro_layer_create(int layer_id, int width, int height);
1016
1024 void vmupro_layer_destroy(int layer_id);
1025
1035 void vmupro_layer_set_scroll(int layer_id, int scroll_x, int scroll_y);
1036
1045 void vmupro_layer_set_priority(int layer_id, int priority);
1046
1055 void vmupro_layer_set_alpha(int layer_id, uint8_t alpha);
1056
1067 void vmupro_layer_blit_background(int layer_id, uint8_t *bg_buffer, int bg_width, int bg_height);
1068
1075
1096 void vmupro_blit_tile(uint8_t *buffer, int x, int y, int src_x, int src_y, int width, int height, int tilemap_width);
1097
1098 // return whether the last buffer sent to the GPU was
1099 // fb_side == 0, or fb_side == 1
1100 // so we don't throw new frames at it before it finishes
1102
1103#ifdef __cplusplus
1104}
1105#endif
Layer structure for multi-layer rendering.
Sprite structure for batch rendering.
vmupro_color_t transparent_color
void vmupro_set_global_brightness(int brightness)
uint8_t * vmupro_get_front_fb()
Get pointer to the front framebuffer.
void vmupro_blit_buffer_color_multiply(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_filter)
Apply color multiplication filter.
void vmupro_render_all_layers(void)
Render all active layers.
void vmupro_blit_buffer_masked(uint8_t *buffer, uint8_t *mask, int x, int y, int width, int height)
Blit buffer using mask.
void vmupro_animate_palette_range(uint16_t *palette, int start_index, int end_index, int shift_amount)
Animate palette color cycling.
int vmupro_get_global_brightness(void)
void vmupro_layer_set_priority(int layer_id, int priority)
Set layer rendering priority.
void vmupro_draw_fill_rect(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a filled rectangle.
void vmupro_blit_buffer_blended(uint8_t *buffer, int x, int y, int width, int height, uint8_t alpha_level)
Blit a buffer with alpha blending.
void vmupro_flood_fill(int x, int y, vmupro_color_t fill_color, vmupro_color_t boundary_color)
Flood fill an area with color.
void vmupro_blit_buffer_palette_swap(uint8_t *buffer, int x, int y, int width, int height, uint16_t *old_palette, uint16_t *new_palette, int palette_size)
Swap palette colors in buffer.
void vmupro_stop_double_buffer_renderer()
Stop the double buffer renderer.
void vmupro_blit_line_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height, int *scroll_x_per_line, int *scroll_y_per_line)
Blit background with per-line scrolling (Mega Drive style)
void vmupro_blit_tile_pattern(uint8_t *tile_buffer, int tile_width, int tile_height, int dest_x, int dest_y, int dest_width, int dest_height)
Blit a tiled pattern to fill an area.
void vmupro_interpolate_palette(uint16_t *palette1, uint16_t *palette2, uint16_t *result, int size, int factor_256)
Interpolate between two palettes.
void vmupro_blit_buffer_fixed_alpha(uint8_t *buffer, int x, int y, int width, int height, int alpha_mode)
Apply fixed alpha blending.
void vmupro_blit_multi_parallax(uint8_t **bg_layers, int *layer_widths, int *layer_heights, int num_layers, int *parallax_factors_x, int *parallax_factors_y, int scroll_x, int scroll_y)
Blit multiple parallax layers.
vmupro_color_t
Predefined color values for VMUPro display.
@ VMUPRO_COLOR_BLUE
@ VMUPRO_COLOR_RED
@ VMUPRO_COLOR_NAVY
@ VMUPRO_COLOR_ORANGE
@ VMUPRO_COLOR_GREY
@ VMUPRO_COLOR_VIOLET
@ VMUPRO_COLOR_YELLOW
@ VMUPRO_COLOR_WHITE
@ VMUPRO_COLOR_YELLOWGREEN
@ VMUPRO_COLOR_VMUINK
@ VMUPRO_COLOR_GREEN
@ VMUPRO_COLOR_MAGENTA
@ VMUPRO_COLOR_BLACK
@ VMUPRO_COLOR_VMUGREEN
int vmupro_sprite_pixel_collision(uint8_t *sprite1, uint8_t *sprite2, int x1, int y1, int x2, int y2, int width1, int height1, int width2, int height2)
Check pixel-perfect sprite collision.
void vmupro_blit_infinite_scrolling_background(uint8_t *tile_buffer, int tile_width, int tile_height, int scroll_x, int scroll_y, int dest_width, int dest_height)
Blit an infinitely scrolling tiled background.
void vmupro_blend_layers_additive(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers additively.
uint8_t * vmupro_get_back_fb()
Get pointer to the back framebuffer.
void vmupro_blit_buffer_with_palette(uint8_t *buffer, int16_t *palette)
Blit a paletted buffer to the display.
void vmupro_pause_double_buffer_renderer()
Pause the double buffer renderer.
uint8_t vmupro_get_last_blitted_fb_side()
int vmupro_sprite_collision_check(int sprite1_x, int sprite1_y, int sprite1_w, int sprite1_h, int sprite2_x, int sprite2_y, int sprite2_w, int sprite2_h)
Check rectangular sprite collision.
void vmupro_blit_column_scroll_background(uint8_t *bg_buffer, int bg_width, int bg_height, int *scroll_x_per_column, int *scroll_y_per_column)
Blit background with per-column scrolling.
void vmupro_layer_destroy(int layer_id)
Destroy a layer.
void vmupro_display_clear(vmupro_color_t color)
Clear the display with a solid color.
void vmupro_blit_buffer_color_add(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t color_offset)
Apply color addition filter.
void vmupro_draw_polygon(int *points, int num_points, vmupro_color_t color)
Draw a polygon outline.
void vmupro_blit_buffer_flip_v(uint8_t *buffer, int x, int y, int width, int height)
Blit a buffer with vertical flipping.
void vmupro_resume_double_buffer_renderer()
Resume the double buffer renderer.
void vmupro_clear_color_window(void)
Clear the color window.
void vmupro_blit_buffer_shadow_highlight(uint8_t *buffer, int x, int y, int width, int height, int mode)
Apply shadow/highlight effect to buffer.
void vmupro_blend_layers_screen(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers using screen mode.
void vmupro_blit_buffer_blurred(uint8_t *buffer, int x, int y, int width, int height, int blur_radius)
Apply blur effect to buffer.
void vmupro_display_refresh()
Refresh the display.
void vmupro_layer_blit_background(int layer_id, uint8_t *bg_buffer, int bg_width, int bg_height)
Blit background to layer.
void vmupro_start_double_buffer_renderer()
Start the double buffer renderer.
void vmupro_draw_ellipse_filled(int cx, int cy, int rx, int ry, vmupro_color_t color)
Draw a filled ellipse.
void vmupro_blit_scrolling_background(uint8_t *bg_buffer, int bg_width, int bg_height, int scroll_x, int scroll_y, int dest_width, int dest_height)
Blit a scrolling background.
void vmupro_blit_buffer_mosaic(uint8_t *buffer, int x, int y, int width, int height, int mosaic_size)
Apply mosaic effect to buffer.
void vmupro_blit_buffer_dithered(uint8_t *buffer, int x, int y, int width, int height, int dither_strength)
Blit a buffer with dithering effect.
void vmupro_blit_buffer_advanced(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y, int dest_width, int dest_height, int flip_h, int flip_v, int transparent_color)
Advanced blit with multiple effects combined.
void vmupro_blit_buffer_at(uint8_t *buffer, int x, int y, int width, int height)
Blit a buffer to the display at specified coordinates.
void vmupro_blit_buffer_transparent(uint8_t *buffer, int x, int y, int width, int height, vmupro_color_t transparent_color)
Blit a buffer with transparency support.
void vmupro_blit_buffer_flip_h(uint8_t *buffer, int x, int y, int width, int height)
Blit a buffer with horizontal flipping.
uint8_t * vmupro_get_back_buffer()
Get pointer to the back buffer.
void vmupro_blit_tile(uint8_t *buffer, int x, int y, int src_x, int src_y, int width, int height, int tilemap_width)
Blit a single tile from a tilemap/tileset.
void vmupro_apply_mosaic_to_screen(int x, int y, int width, int height, int mosaic_size)
Apply mosaic effect directly to screen.
void vmupro_push_double_buffer_frame()
Swap and display the current framebuffer.
void vmupro_layer_create(int layer_id, int width, int height)
Create a new layer.
void vmupro_draw_circle_filled(int cx, int cy, int radius, vmupro_color_t color)
Draw a filled circle.
void vmupro_layer_set_alpha(int layer_id, uint8_t alpha)
Set layer alpha transparency.
void vmupro_layer_set_scroll(int layer_id, int scroll_x, int scroll_y)
Set layer scroll position.
void vmupro_sprite_batch_render(vmupro_sprite_t *sprites, int num_sprites)
Render multiple sprites in priority order.
void vmupro_draw_rect(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a rectangle outline.
void vmupro_blit_parallax_background(uint8_t *bg_buffer, int bg_width, int bg_height, int scroll_x, int scroll_y, int parallax_factor_x, int parallax_factor_y)
Blit background with parallax effect.
void vmupro_draw_circle(int cx, int cy, int radius, vmupro_color_t color)
Draw a circle outline.
void vmupro_blit_buffer_scaled(uint8_t *buffer, int buffer_width, int src_x, int src_y, int src_width, int src_height, int dest_x, int dest_y, int dest_width, int dest_height)
Blit a buffer with scaling support.
void vmupro_blit_buffer_rotated_90(uint8_t *buffer, int x, int y, int width, int height, int rotation)
Blit a buffer with 90-degree rotation increments.
void vmupro_set_color_window(int x1, int y1, int x2, int y2, vmupro_color_t mask_color)
Set a color window for masking.
void vmupro_draw_line(int x1, int y1, int x2, int y2, vmupro_color_t color)
Draw a line between two points.
void vmupro_draw_ellipse(int cx, int cy, int rx, int ry, vmupro_color_t color)
Draw an ellipse outline.
void vmupro_flood_fill_tolerance(int x, int y, vmupro_color_t fill_color, int tolerance)
Flood fill with color tolerance.
void vmupro_blend_layers_multiply(uint8_t *layer1, uint8_t *layer2, int width, int height)
Blend two layers multiplicatively.
void vmupro_draw_polygon_filled(int *points, int num_points, vmupro_color_t color)
Draw a filled polygon.
void vmupro_blit_buffer_rotated_precise(uint8_t *buffer, int x, int y, int width, int height, int rotation_degrees)
Blit a buffer with precise rotation (1-degree increments)